Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
Elapsed ticks is the worst way to do that. Furnace now can smelt items.
Browse files Browse the repository at this point in the history
  • Loading branch information
TonimatasDEV committed Aug 2, 2024
1 parent 2cbe06b commit 4c00eba
Showing 1 changed file with 16 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
return 64;
}

@@ -166,12 +199,31 @@
@@ -166,9 +199,12 @@

public void func_73660_a()
{
Expand All @@ -97,32 +97,12 @@
boolean flag1 = false;

+ // CraftBukkit start - Use wall time instead of ticks for cooking
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
+ this.lastTick = MinecraftServer.currentTick;
+
+ // CraftBukkit - moved from below - edited for wall time
+ if (this.func_145950_i() && this.func_145948_k()) {
+ this.field_174906_k += elapsedTicks;
+ if (this.field_174906_k >= this.field_174905_l) {
+ this.field_174906_k -= this.field_174905_l; // Paper
+ this.field_174905_l = this.func_174904_a((ItemStack) this.field_145957_n.get(0));
+ this.func_145949_j();
+ flag1 = true;
+ }
+ } else {
+ this.field_174906_k = 0;
+ }
+ // CraftBukkit end
+
if (this.func_145950_i())
{
- --this.field_145956_a;
+ // --this.furnaceBurnTime;
+ this.field_145956_a -= elapsedTicks; // CraftBukkit - use elapsedTicks in place of constant
}

if (!this.field_145850_b.field_72995_K)
@@ -180,13 +232,21 @@
--this.field_145956_a;
@@ -180,13 +216,21 @@

if (this.func_145950_i() || !itemstack.func_190926_b() && !((ItemStack)this.field_145957_n.get(0)).func_190926_b())
{
Expand Down Expand Up @@ -150,56 +130,32 @@
flag1 = true;

if (!itemstack.func_190926_b())
@@ -196,29 +256,31 @@

if (itemstack.func_190926_b())
{
- Item item1 = item.func_77668_q();
- this.field_145957_n.set(1, item1 == null ? ItemStack.field_190927_a : new ItemStack(item1));
+ ItemStack item1 = item.getContainerItem(itemstack);
+ this.field_145957_n.set(1, item1);
}
@@ -202,7 +246,7 @@
}
}
}

- if (this.func_145950_i() && this.func_145948_k())
+ /* CraftBukkit start - Moved up
+ if (this.isBurning() && this.canSmelt())
-
+
if (this.func_145950_i() && this.func_145948_k())
{
- ++this.field_174906_k;
+ ++this.cookTime;

- if (this.field_174906_k == this.field_174905_l)
+ if (this.cookTime == this.totalCookTime)
{
- this.field_174906_k = 0;
- this.field_174905_l = this.func_174904_a(this.field_145957_n.get(0));
- this.func_145949_j();
+ this.cookTime = 0;
+ this.totalCookTime = this.getCookTime(this.furnaceItemStacks.get(0));
+ this.smeltItem();
flag1 = true;
}
}
else
++this.field_174906_k;
@@ -219,6 +263,7 @@
{
- this.field_174906_k = 0;
+ this.cookTime = 0;
this.field_174906_k = 0;
}
+ */
+
}
else if (!this.func_145950_i() && this.field_174906_k > 0)
{
@@ -229,6 +291,7 @@
@@ -229,6 +274,7 @@
{
flag1 = true;
BlockFurnace.func_176446_a(this.func_145950_i(), this.field_145850_b, this.field_174879_c);
+ this.func_145836_u(); // CraftBukkit - Invalidate tile entity's cached block type
}
}

@@ -269,13 +332,13 @@
@@ -269,13 +315,13 @@
{
return false;
}
Expand All @@ -215,7 +171,7 @@
}
}
}
@@ -289,14 +352,39 @@
@@ -289,14 +335,39 @@
ItemStack itemstack1 = FurnaceRecipes.func_77602_a().func_151395_a(itemstack);
ItemStack itemstack2 = this.field_145957_n.get(2);

Expand Down Expand Up @@ -259,7 +215,7 @@

if (itemstack.func_77973_b() == Item.func_150898_a(Blocks.field_150360_v) && itemstack.func_77960_j() == 1 && !((ItemStack)this.field_145957_n.get(1)).func_190926_b() && ((ItemStack)this.field_145957_n.get(1)).func_77973_b() == Items.field_151133_ar)
{
@@ -315,6 +403,8 @@
@@ -315,6 +386,8 @@
}
else
{
Expand All @@ -268,7 +224,7 @@
Item item = p_145952_0_.func_77973_b();

if (item == Item.func_150898_a(Blocks.field_150376_bx))
@@ -530,4 +620,23 @@
@@ -530,4 +603,23 @@
{
this.field_145957_n.clear();
}
Expand Down

0 comments on commit 4c00eba

Please sign in to comment.