@Override
 public void updateEntity() {
   if (!worldObj.isRemote) {
     if (tank.getFluidAmount() > 2400) {
       if (progress > 0) {
         tank.drainInternal(15, true);
         progress--;
       } else if (progress == 0) {
         ItemStack s = MachineCraftingHandler.getFurnaceRecipe(stack[0]);
         if (s != null) {
           if (stack[1] != null) {
             if (TomsModUtils.areItemStacksEqual(stack[1], s, true, true, false)
                 && stack[1].stackSize + s.stackSize <= s.getMaxStackSize()
                 && stack[0].stackSize >= 1) {
               stack[1].stackSize += s.stackSize;
               progress = -1;
               decrStackSize(0, 1);
             }
           } else {
             progress = -1;
             stack[1] = s;
             decrStackSize(0, 1);
           }
         } else {
           progress = -1;
         }
       } else {
         ItemStack s = MachineCraftingHandler.getFurnaceRecipe(stack[0]);
         if (s != null) {
           if (stack[1] != null) {
             if (TomsModUtils.areItemStacksEqual(stack[1], s, true, true, false)
                 && stack[1].stackSize + s.stackSize <= s.getMaxStackSize()
                 && stack[0].stackSize >= 1) {
               progress = MAX_PROCESS_TIME;
             }
           } else {
             progress = MAX_PROCESS_TIME;
           }
         }
         TomsModUtils.setBlockStateWithCondition(worldObj, pos, SteamFurnace.ACTIVE, progress > 0);
       }
     } else {
       TomsModUtils.setBlockStateWithCondition(worldObj, pos, SteamFurnace.ACTIVE, false);
     }
   }
 }
Ejemplo n.º 2
0
 @Override
 public IBlockState onBlockPlaced(
     World worldIn,
     BlockPos pos,
     EnumFacing facing,
     float hitX,
     float hitY,
     float hitZ,
     int meta,
     EntityLivingBase placer) {
   EnumFacing f = TomsModUtils.getDirectionFacing(placer, false);
   return this.getDefaultState().withProperty(FACING, f.getOpposite()).withProperty(ACTIVE, false);
 }
 @Override
 public boolean isUseableByPlayer(EntityPlayer player) {
   return TomsModUtils.isUseable(pos, player, worldObj, this);
 }