Program: 174471
Project: 174471
Buggy source:
/** 
 * Methods related to entity interaction.				
 */
public boolean processInteract(EntityPlayer player,EnumHand hand){
  if (!this.world.isRemote) {
    if (hand == EnumHand.MAIN_HAND) {
      ItemStack stack=player.getHeldItemMainhand();
      if (stack.getItem() == ModItems.GEM_STAFF || stack.getItem() == ModItems.COMMANDER_STAFF) {
        if (this.isTamed()) {
          if (player.isSneaking()) {
            if (this.isOwner(player)) {
              if (this.getHeldItemMainhand().getItem() == ModItems.COMMANDER_STAFF) {
                this.entityDropItem(this.getHeldItemMainhand(),0.0F);
                this.setHeldItem(EnumHand.MAIN_HAND,ItemStack.EMPTY);
                this.playObeySound();
              }
 else {
                this.alternateInteract(player);
                this.playObeySound();
              }
            }
          }
 else {
            if (this.isOwner(player)) {
              this.setSitting(player,!this.isSitting());
              this.playObeySound();
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
 else         if (stack.getItem() != ModItems.COMMANDER_STAFF) {
          this.setOwnerId(player.getUniqueID());
          this.setLeader(player);
          this.setServitude(EntityGem.SERVE_HUMAN);
          this.navigator.clearPath();
          this.setAttackTarget(null);
          this.setHealth(this.getMaxHealth());
          this.playTameEffect();
          this.world.setEntityState(this,(byte)7);
          this.playObeySound();
          player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
          return true;
        }
      }
 else       if (stack.getItem() == Items.WATER_BUCKET && player.isSneaking()) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            this.setUniformColor(this.nativeColor);
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.TRANSFER_CONTRACT) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
 else {
            ItemTransferContract contract=(ItemTransferContract)stack.getItem();
            if (this.isOwnerId(contract.getOwner(stack))) {
              if (contract.getOwner(stack).equals(this.getOwnerId())) {
                if (this.leader.equals(this.getOwnerId())) {
                  this.setLeader(player);
                }
                this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
              }
 else {
                for (                UUID ownerId : this.jointOwners) {
                  if (contract.getOwner(stack).equals(ownerId)) {
                    if (this.leader.equals(this.getOwnerId())) {
                      this.setLeader(player);
                    }
                    try {
                      this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                    }
 catch (                    Exception e) {
                    }
                    ownerId=EntityPlayer.getUUID(player.getGameProfile());
                  }
                }
              }
              this.playObeySound();
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              this.setOwnerId(EntityPlayer.getUUID(player.getGameProfile()));
              if (!player.capabilities.isCreativeMode) {
                stack.shrink(1);
              }
              return true;
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.JOINT_CONTRACT) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
 else {
            ItemJointContract contract=(ItemJointContract)stack.getItem();
            if (this.isOwnerId(contract.getOwner(stack))) {
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
              for (              UUID ownerId : this.jointOwners) {
                try {
                  this.world.getPlayerEntityByUUID(ownerId).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                }
 catch (                Exception e) {
                }
              }
              this.jointOwners.add(EntityPlayer.getUUID(player.getGameProfile()));
              this.playObeySound();
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              if (!player.capabilities.isCreativeMode) {
                stack.shrink(1);
              }
              return true;
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.LIBERATION_CONTRACT) {
        if (this.isTamed()) {
          ItemLiberationContract contract=(ItemLiberationContract)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setServitude(EntityGem.SERVE_NONE);
            this.setOwnerId((UUID)null);
            this.setLeader((UUID)null);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.AUTONOMY_CONTRACT) {
        if (this.isTamed()) {
          ItemAutonomyContract contract=(ItemAutonomyContract)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setOwnerId((UUID)null);
            this.setLeader((UUID)null);
            this.setServitude(EntityGem.SERVE_ITSELF);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.WAR_DECLARATION) {
        if (this.isTamed()) {
          ItemWarDeclaration contract=(ItemWarDeclaration)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setKillsPlayers(true);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.PEACE_TREATY) {
        if (this.isTamed()) {
          ItemPeaceTreaty contract=(ItemPeaceTreaty)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setKillsPlayers(false);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (DyeUtils.isDye(stack) && this.canChangeUniformColorByDefault() && player.isSneaking()) {
        if (this.isTamed() && this.isOwner(player)) {
          this.setUniformColor(DyeUtils.metaFromStack(stack).orElse(0));
          this.uniformColorChanged=true;
          return true;
        }
      }
 else       if (DyeUtils.isDye(stack) && this.canChangeInsigniaColorByDefault()) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            this.setInsigniaColor(DyeUtils.metaFromStack(stack).orElse(0));
            return true;
          }
        }
      }
 else       if (this.isSoldier) {
        return super.processInteract(player,hand) || this.setAttackWeapon(player,hand,stack);
      }
    }
 else {
      ItemStack stack=player.getHeldItemOffhand();
      if (stack.getItem() == ModItems.COMMANDER_STAFF) {
        if (this.isTamed()) {
          if (this.isOwner(player) && this.getHeldItemMainhand().isEmpty()) {
            this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND,stack.copy());
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.GEM_STAFF) {
        if (this.isTamed()) {
          if (this.isOwner(player) && player.isSneaking()) {
            this.setSelected(!this.isSelected());
          }
        }
      }
    }
  }
  return super.processInteract(player,hand);
}

Fixed version (ground truth):
/** 
 * Methods related to entity interaction.				
 */
public boolean processInteract(EntityPlayer player,EnumHand hand){
  if (!this.world.isRemote) {
    if (hand == EnumHand.MAIN_HAND) {
      ItemStack stack=player.getHeldItemMainhand();
      if (stack.getItem() == ModItems.GEM_STAFF || stack.getItem() == ModItems.COMMANDER_STAFF) {
        if (this.isTamed()) {
          if (player.isSneaking()) {
            if (this.isOwner(player)) {
              if (this.getHeldItemMainhand().getItem() == ModItems.COMMANDER_STAFF || !(this instanceof EntityPearl)) {
                this.entityDropItem(this.getHeldItemMainhand(),0.0F);
                this.setHeldItem(EnumHand.MAIN_HAND,ItemStack.EMPTY);
                this.playObeySound();
              }
 else {
                this.alternateInteract(player);
                this.playObeySound();
              }
            }
          }
 else {
            if (this.isOwner(player)) {
              this.setSitting(player,!this.isSitting());
              this.playObeySound();
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
 else         if (stack.getItem() != ModItems.COMMANDER_STAFF) {
          this.setOwnerId(player.getUniqueID());
          this.setLeader(player);
          this.setServitude(EntityGem.SERVE_HUMAN);
          this.navigator.clearPath();
          this.setAttackTarget(null);
          this.setHealth(this.getMaxHealth());
          this.playTameEffect();
          this.world.setEntityState(this,(byte)7);
          this.playObeySound();
          player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
          return true;
        }
      }
 else       if (stack.getItem() == Items.WATER_BUCKET && player.isSneaking()) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            this.setUniformColor(this.nativeColor);
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.TRANSFER_CONTRACT) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
 else {
            ItemTransferContract contract=(ItemTransferContract)stack.getItem();
            if (this.isOwnerId(contract.getOwner(stack))) {
              if (contract.getOwner(stack).equals(this.getOwnerId())) {
                if (this.leader.equals(this.getOwnerId())) {
                  this.setLeader(player);
                }
                this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
              }
 else {
                for (                UUID ownerId : this.jointOwners) {
                  if (contract.getOwner(stack).equals(ownerId)) {
                    if (this.leader.equals(this.getOwnerId())) {
                      this.setLeader(player);
                    }
                    try {
                      this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                    }
 catch (                    Exception e) {
                    }
                    ownerId=EntityPlayer.getUUID(player.getGameProfile());
                  }
                }
              }
              this.playObeySound();
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              this.setOwnerId(EntityPlayer.getUUID(player.getGameProfile()));
              if (!player.capabilities.isCreativeMode) {
                stack.shrink(1);
              }
              return true;
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.JOINT_CONTRACT) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
 else {
            ItemJointContract contract=(ItemJointContract)stack.getItem();
            if (this.isOwnerId(contract.getOwner(stack))) {
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
              for (              UUID ownerId : this.jointOwners) {
                try {
                  this.world.getPlayerEntityByUUID(ownerId).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                }
 catch (                Exception e) {
                }
              }
              this.jointOwners.add(EntityPlayer.getUUID(player.getGameProfile()));
              this.playObeySound();
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              if (!player.capabilities.isCreativeMode) {
                stack.shrink(1);
              }
              return true;
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.LIBERATION_CONTRACT) {
        if (this.isTamed()) {
          ItemLiberationContract contract=(ItemLiberationContract)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setServitude(EntityGem.SERVE_NONE);
            this.setOwnerId((UUID)null);
            this.setLeader((UUID)null);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.AUTONOMY_CONTRACT) {
        if (this.isTamed()) {
          ItemAutonomyContract contract=(ItemAutonomyContract)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setOwnerId((UUID)null);
            this.setLeader((UUID)null);
            this.setServitude(EntityGem.SERVE_ITSELF);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.WAR_DECLARATION) {
        if (this.isTamed()) {
          ItemWarDeclaration contract=(ItemWarDeclaration)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setKillsPlayers(true);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.PEACE_TREATY) {
        if (this.isTamed()) {
          ItemPeaceTreaty contract=(ItemPeaceTreaty)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setKillsPlayers(false);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (DyeUtils.isDye(stack) && this.canChangeUniformColorByDefault() && player.isSneaking()) {
        if (this.isTamed() && this.isOwner(player)) {
          this.setUniformColor(DyeUtils.metaFromStack(stack).orElse(0));
          this.uniformColorChanged=true;
          return true;
        }
      }
 else       if (DyeUtils.isDye(stack) && this.canChangeInsigniaColorByDefault()) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            this.setInsigniaColor(DyeUtils.metaFromStack(stack).orElse(0));
            return true;
          }
        }
      }
 else       if (this.isSoldier) {
        return super.processInteract(player,hand) || this.setAttackWeapon(player,hand,stack);
      }
    }
 else {
      ItemStack stack=player.getHeldItemOffhand();
      if (stack.getItem() == ModItems.COMMANDER_STAFF) {
        if (this.isTamed()) {
          if (this.isOwner(player) && this.getHeldItemMainhand().isEmpty()) {
            this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND,stack.copy());
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.GEM_STAFF) {
        if (this.isTamed()) {
          if (this.isOwner(player) && player.isSneaking()) {
            this.setSelected(!this.isSelected());
          }
        }
      }
    }
  }
  return super.processInteract(player,hand);
}