Skip to content

Commit

Permalink
use mc fuel calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
MissBismuth committed Jan 11, 2025
1 parent 4f8001f commit d90298e
Showing 1 changed file with 3 additions and 45 deletions.
48 changes: 3 additions & 45 deletions src/main/java/mods/natura/blocks/tech/NetherrackFurnaceLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) {

this.furnaceBurnTime = par1NBTTagCompound.getShort("BurnTime");
this.furnaceCookTime = par1NBTTagCompound.getShort("CookTime");
this.currentItemBurnTime = getFuelTime(this.inventory[1]) * 2;
this.currentItemBurnTime = TileEntityFurnace.getItemBurnTime(this.inventory[1]) * 2;

if (par1NBTTagCompound.hasKey("CustomName")) {
this.field_94130_e = par1NBTTagCompound.getString("CustomName");
Expand Down Expand Up @@ -270,7 +270,7 @@ public void updateEntity() {

if (!this.worldObj.isRemote) {
if (this.furnaceBurnTime == 0 && this.canSmelt()) {
this.currentItemBurnTime = this.furnaceBurnTime = getFuelTime(this.inventory[1]) * 2;
this.currentItemBurnTime = this.furnaceBurnTime = TileEntityFurnace.getItemBurnTime(this.inventory[1]) * 2;

if (this.furnaceBurnTime > 0) {
flag1 = true;
Expand Down Expand Up @@ -357,53 +357,11 @@ public void smeltItem() {
}
}

/**
* Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
* fuel
*/
public static int getFuelTime(ItemStack par0ItemStack) {
if (par0ItemStack == null) {
return 0;
} else {
Item item = par0ItemStack.getItem();

if (par0ItemStack.getItem() instanceof ItemBlock && item != null) {
Block block = BlockUtils.getBlockFromItem(item);

if (block == Blocks.wooden_slab) {
return 150;
}

if (block instanceof BlockLog) {
return 1200;
}

if (block.getMaterial() == Material.wood) {
return 300;
}

if (block == Blocks.coal_block) {
return 16000;
}
}

if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200;
if (item == Items.stick) return 100;
if (item == Items.coal) return 1600;
if (item == Items.lava_bucket) return 20000;
if (BlockUtils.getBlockFromItem(item) == Blocks.sapling) return 100;
if (item == Items.blaze_rod) return 2400;
return GameRegistry.getFuelValue(par0ItemStack);
}
}

/**
* Return true if item is a fuel source (getItemBurnTime() > 0).
*/
public static boolean isItemFuel(ItemStack par0ItemStack) {
return getFuelTime(par0ItemStack) > 0;
return TileEntityFurnace.getItemBurnTime(par0ItemStack) > 0;
}

/**
Expand Down

0 comments on commit d90298e

Please sign in to comment.