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

Witches can heal undead mobs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 15w50a, Minecraft 15w51b, Minecraft 16w02a, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.11, Minecraft 1.12.1, Minecraft 1.13-pre8, Minecraft 18w32a, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2-pre1, Minecraft 1.13.2, Minecraft 19w08b, Minecraft 19w09a, 1.15.1, 1.15.2 Pre-release 2, 1.15.2
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      When a witch is attacked by an undead mob, the witch will throw a splash potion of poison/instant damage. Which has the opposite effect since the target is undead, thus healing it.

      How to reproduce

      1. Build a setup as seen here.
      2. Switch to survival and go behind the witch.
      3. When the skeleton has shot the witch, switch to creative (F3 + N).
        The witch starts to heal the skeleton

      Code analysis

      The following is based on yarn 1.15.2 Pre-release 2 names.

      In the method net.minecraft.entity.mob.WitchEntity.attack() it just doesn't check for if the mob is undead and to use another potion if so. I write a fix for this issue which hopefully will help to resolve this issue.

      Fix for MC-94281
       @Override
        public void attack(LivingEntity target, float float3) {
      	
      		boolean flag = target instanceof DrownedEntity || target instanceof PhantomEntity || target instanceof WitherSkeletonEntity || target instanceof SkeletonEntity
          			|| target instanceof SkeletonHorseEntity|| target instanceof HuskEntity|| target instanceof StrayEntity 
          			|| target instanceof ZombieEntity|| target instanceof ZombieHorseEntity || target instanceof ZombiePigmanEntity
          			|| target instanceof ZombieVillagerEntity;
              //TODO: The entity class HostileEntity exists, does this include all of these above?
      				
              if (this.isDrinking()) {
                  return;
              }
              Vec3d vec3d4 = ...
              double double5 = ...
              double double7 = ...
              double double9 = ...
              float float11 = ...
              Potion potion12 = flag ? Potions.HEALING : Potions.HARMING;
              if (target instanceof RaiderEntity) {
                  if (...) {
                      potion12 = ...
                  }
                  else {
                      potion12 = ...
                  }
                  this.setTarget(null);
              }
              else if (...)) {
                  potion12 = ...
              }
              else if (target.getHealth() >= 8.0f && flag ? true : !target.hasStatusEffect(StatusEffects.POISON)) {
                  potion12 = flag ? Potions.HEALING : Potions.POISON;
              }
              else if (...) {
                  potion12 = ...
              }
              ThrownPotionEntity thrownPotionEntity13 = ...
              thrownPotionEntity13.setItemStack(...));
              ThrownPotionEntity class_1686 = ...
              thrownPotionEntity13.setVelocity(...);
              this.world.playSound(...);
              this.world.spawnEntity(thrownPotionEntity13);
          }
      

      Note: As per MC-93680, healing is used for both potion options as regeneration does not have the opposite effect on undead mobs.

        Attachments

        1. 2015-12-13_14.44.06.png
          2015-12-13_14.44.06.png
          144 kB
        2. 2015-12-13_14.46.32.png
          2015-12-13_14.46.32.png
          186 kB
        3. 2015-12-13_14.46.36.png
          2015-12-13_14.46.36.png
          190 kB
        4. 2015-12-13_14.46.47.png
          2015-12-13_14.46.47.png
          199 kB

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Oval Oval
            • Votes:
              6 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: