From 69fddc725b0c997370c4270838274f50697c0a0a Mon Sep 17 00:00:00 2001 From: blablubbabc Date: Thu, 9 Jul 2020 08:49:55 +1000 Subject: [PATCH] #705: Improve implementation of furnace related block states CraftFurnace is the base class for all concrete types of furnaces (this mimics Minecraft's underlying type hierarchy). It is marked as abstract now to avoid accidental instantiation. Also, the various furnace sub types were missing type parameters. --- .../org/bukkit/craftbukkit/block/CraftBlastFurnace.java | 2 +- .../java/org/bukkit/craftbukkit/block/CraftFurnace.java | 2 +- .../org/bukkit/craftbukkit/block/CraftFurnaceFurnace.java | 2 +- .../java/org/bukkit/craftbukkit/block/CraftSmoker.java | 2 +- .../bukkit/craftbukkit/inventory/CraftMetaBlockState.java | 7 +++---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlastFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlastFurnace.java index 6a6a898482..9f1dd82b25 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlastFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlastFurnace.java @@ -5,7 +5,7 @@ import org.bukkit.Material; import org.bukkit.block.BlastFurnace; import org.bukkit.block.Block; -public class CraftBlastFurnace extends CraftFurnace implements BlastFurnace { +public class CraftBlastFurnace extends CraftFurnace implements BlastFurnace { public CraftBlastFurnace(Block block) { super(block, TileEntityBlastFurnace.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java index 9cc67915ca..27c8cc130e 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java @@ -8,7 +8,7 @@ import org.bukkit.block.Furnace; import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace; import org.bukkit.inventory.FurnaceInventory; -public class CraftFurnace extends CraftContainer implements Furnace { +public abstract class CraftFurnace extends CraftContainer implements Furnace { public CraftFurnace(Block block, Class tileEntityClass) { super(block, tileEntityClass); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnaceFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnaceFurnace.java index fd8b91c1b4..680ad68261 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnaceFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnaceFurnace.java @@ -4,7 +4,7 @@ import net.minecraft.server.TileEntityFurnaceFurnace; import org.bukkit.Material; import org.bukkit.block.Block; -public class CraftFurnaceFurnace extends CraftFurnace { +public class CraftFurnaceFurnace extends CraftFurnace { public CraftFurnaceFurnace(Block block) { super(block, TileEntityFurnaceFurnace.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSmoker.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSmoker.java index 40bfcad469..7b17b6c699 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSmoker.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSmoker.java @@ -5,7 +5,7 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.Smoker; -public class CraftSmoker extends CraftFurnace implements Smoker { +public class CraftSmoker extends CraftFurnace implements Smoker { public CraftSmoker(Block block) { super(block, TileEntitySmoker.class); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java index 844dcc0ff7..852e793c0c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java @@ -23,7 +23,6 @@ import net.minecraft.server.TileEntityDropper; import net.minecraft.server.TileEntityEnchantTable; import net.minecraft.server.TileEntityEndGateway; import net.minecraft.server.TileEntityEnderChest; -import net.minecraft.server.TileEntityFurnace; import net.minecraft.server.TileEntityFurnaceFurnace; import net.minecraft.server.TileEntityHopper; import net.minecraft.server.TileEntityJigsaw; @@ -59,7 +58,7 @@ import org.bukkit.craftbukkit.block.CraftDropper; import org.bukkit.craftbukkit.block.CraftEnchantingTable; import org.bukkit.craftbukkit.block.CraftEndGateway; import org.bukkit.craftbukkit.block.CraftEnderChest; -import org.bukkit.craftbukkit.block.CraftFurnace; +import org.bukkit.craftbukkit.block.CraftFurnaceFurnace; import org.bukkit.craftbukkit.block.CraftHopper; import org.bukkit.craftbukkit.block.CraftJigsaw; import org.bukkit.craftbukkit.block.CraftJukebox; @@ -333,7 +332,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta if (te == null) { te = new TileEntityFurnaceFurnace(); } - return new CraftFurnace(material, (TileEntityFurnace) te); + return new CraftFurnaceFurnace(material, (TileEntityFurnaceFurnace) te); case DISPENSER: if (te == null) { te = new TileEntityDispenser(); @@ -560,7 +559,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta valid = blockState instanceof CraftChest; break; case FURNACE: - valid = blockState instanceof CraftFurnace; + valid = blockState instanceof CraftFurnaceFurnace; break; case DISPENSER: valid = blockState instanceof CraftDispenser;