Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use mc fuel calculation to fix issue with some fuels not being picked up #28

Merged
merged 2 commits into from
Jan 12, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading