示例#1
0
  private static int findFuelValue(ItemStack stack) {
    try {
      Item item = stack.getItem();

      if (item instanceof ItemBlock) {
        Block block = InvTools.getBlockFromStack(stack);

        String name = block.getUnlocalizedName();
        if (name != null && name.contains("blockScaffold")) return 0;
      }

      //            if (itemID == Item.coal.itemID && stack.getItemDamage() == 0)
      //                return 1600;

      if (item == Items.blaze_rod) return 1000;

      FluidStack liquid = FluidItemHelper.getFluidStackInContainer(stack);
      if (liquid != null && Fluids.LAVA.get() == liquid.getFluid()) return liquid.amount;

      String name = stack.getItem().getUnlocalizedName();
      if (name != null && name.contains("itemScrap")) return 0;

      return TileEntityFurnace.getItemBurnTime(stack);
    } catch (Exception ex) {
      Game.logThrowable(
          "Error in Fuel Handler! Is some mod creating items that are not compliant with standards?",
          ex);
    }
    return 0;
  }
示例#2
0
 @Override
 public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
   try {
     TileEntity tile = world.getTileEntity(x, y, z);
     if (tile instanceof TileSignalFoundation) {
       TileSignalFoundation structure = (TileSignalFoundation) tile;
       if (structure.getSignalType().needsSupport()
           && !world.isSideSolid(x, y - 1, z, ForgeDirection.UP))
         world.func_147480_a(x, y, z, true);
       else structure.onNeighborBlockChange(block);
     }
   } catch (StackOverflowError error) {
     Game.logThrowable(Level.ERROR, "Error in BlockSignalBase.onNeighborBlockChange()", 10, error);
     throw error;
   }
 }