When I try to extract an item from a furnace, the furnace is broken. Not like glitched broken, but like survival player mines the block broken. Here is my code:
@Override
public void updateTask() {
if (soldier.wantsToGoTo != BlockPos.NULL_VECTOR) {
soldier.getNavigator().tryMoveToXYZ(soldier.wantsToGoTo.getX(), soldier.wantsToGoTo.getY(),
soldier.wantsToGoTo.getZ(), speedIn);
double distance = soldier.getPosition().getDistance(soldier.wantsToGoTo.getX(), soldier.wantsToGoTo.getY(),
soldier.wantsToGoTo.getZ());
if (distance < 5) {
TileEntityFurnace furnace = soldier.getFurnace();
if (soldier.getHeldItem(EnumHand.MAIN_HAND).isEmpty()) {
soldier.setHeldItem(EnumHand.MAIN_HAND, furnace.getStackInSlot(2));
furnace.getStackInSlot(2).splitStack(furnace.getStackInSlot(2).getCount());
} else if (soldier.getHeldItem(EnumHand.MAIN_HAND) == furnace.getStackInSlot(2)) {
soldier.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(furnace.getStackInSlot(2).getItem(),
furnace.getStackInSlot(2).getCount() + soldier.getHeldItem(EnumHand.MAIN_HAND).getCount()));
furnace.getStackInSlot(2).splitStack(furnace.getStackInSlot(2).getCount());
}
}
}
}