Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-114122

Player gets "Return to Sender" achievement (killing ghast with fireball) even if ghast was not killed


    • Confirmed

      The bug

      The player gets the "Return to Sender" (achievement.ghast) achievement even if the ghast was not killed. You would expect not to get the achievement because the description of it says "Destroy a Ghast with a fireball".

      How to reproduce

      1. Give yourself all required achievements
        /achievement give achievement.portal
      2. Summon a ghast with more than 1000 health, because a fireball reflected by a player does 1000 damage to a ghast
        /summon armor_stand ~ ~ ~ {Invulnerable:1b,Passengers:[{id:"ghast",Attributes:[{Name:"generic.maxHealth",Base:1000.1}],Health:1000.1f}]}
      3. Summon a fireball and punch it towards the ghast
        /summon fireball ~ ~ ~ {direction:[0.0,0.0,0.0]}

        → You will get the achievement even though the ghast was not killed

      Code analysis

      Based on 1.11.2 decompiled using MCP 9.35 rc1

      The method net.minecraft.entity.monster.EntityGhast.attackEntityFrom(DamageSource, float) always gives the achievement regardless of it the ghast is dead.

      Suggested fix
       * Called when the entity is attacked.
      public boolean attackEntityFrom(DamageSource source, float amount)
          if (this.isEntityInvulnerable(source))
              return false;
          else if ("fireball".equals(source.getDamageType()) && source.getEntity() instanceof EntityPlayer)
              // Replaced this
              // super.attackEntityFrom(source, 1000.0F);
              // ((EntityPlayer)source.getEntity()).addStat(AchievementList.GHAST);
              // return true;
              boolean successfullyAttacked = super.attackEntityFrom(source, 1000.0F);
              if (successfullyAttacked && !this.isEntityAlive()) {
              return successfullyAttacked;
              return super.attackEntityFrom(source, amount);

            Unassigned Unassigned
            marcono1234 [Mod] Marcono1234
            2 Vote for this issue
            1 Start watching this issue