From 24c5e68c5fe1c24ab7919a3c99e1a5af764f8c4b Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 22 Dec 2018 11:04:31 +1100 Subject: [PATCH] SPIGOT-4493: Allow burnt out furnaces to remain lit like Vanilla whilst retaining SPIGOT-844 API --- nms-patches/TileEntityFurnace.patch | 21 ++----------------- .../craftbukkit/block/CraftFurnace.java | 3 +++ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/nms-patches/TileEntityFurnace.patch b/nms-patches/TileEntityFurnace.patch index a775a28163..5382eac164 100644 --- a/nms-patches/TileEntityFurnace.patch +++ b/nms-patches/TileEntityFurnace.patch @@ -48,15 +48,6 @@ public TileEntityFurnace() { super(TileEntityTypes.FURNACE); this.items = NonNullList.a(3, ItemStack.a); -@@ -219,7 +253,7 @@ - } - - public void tick() { -- boolean flag = this.isBurning(); -+ boolean flag = this.getBlock().get(BlockFurnace.LIT); // CraftBukkit - SPIGOT-844 - Check if furnace block is lit using the block instead of burn time - boolean flag1 = false; - - if (this.isBurning()) { @@ -237,9 +271,20 @@ IRecipe irecipe = this.world.getCraftingManager().b(this, this.world); @@ -80,15 +71,7 @@ flag1 = true; if (!itemstack.isEmpty()) { Item item = itemstack.getItem(); -@@ -270,6 +315,7 @@ - if (flag != this.isBurning()) { - flag1 = true; - this.world.setTypeAndData(this.position, (IBlockData) this.world.getType(this.position).set(BlockFurnace.LIT, this.isBurning()), 3); -+ this.invalidateBlockCache(); // CraftBukkit - Invalidate tile entity's cached block type - } - } - -@@ -280,7 +326,7 @@ +@@ -280,7 +325,7 @@ } private int s() { @@ -97,7 +80,7 @@ return furnacerecipe != null ? furnacerecipe.h() : 200; } -@@ -307,11 +353,38 @@ +@@ -307,11 +352,38 @@ ItemStack itemstack1 = irecipe.d(); ItemStack itemstack2 = (ItemStack) this.items.get(2); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java index 469dc4ff2b..6ca6a6bf24 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.block; +import net.minecraft.server.BlockFurnace; import net.minecraft.server.TileEntityFurnace; import org.bukkit.Material; import org.bukkit.block.Block; @@ -40,6 +41,8 @@ public class CraftFurnace extends CraftContainer implements F @Override public void setBurnTime(short burnTime) { this.getSnapshot().setProperty(0, burnTime); + // SPIGOT-844: Allow lighting and relighting using this API + this.data = this.data.set(BlockFurnace.LIT, burnTime > 0); } @Override