#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.
This commit is contained in:
blablubbabc 2020-07-09 08:49:55 +10:00 committed by md_5
parent f222b5bd4e
commit 69fddc725b
No known key found for this signature in database
GPG key ID: E8E901AC7C617C11
5 changed files with 7 additions and 8 deletions

View file

@ -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<TileEntityBlastFurnace> implements BlastFurnace {
public CraftBlastFurnace(Block block) {
super(block, TileEntityBlastFurnace.class);

View file

@ -8,7 +8,7 @@ import org.bukkit.block.Furnace;
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
import org.bukkit.inventory.FurnaceInventory;
public class CraftFurnace<T extends TileEntityFurnace> extends CraftContainer<T> implements Furnace {
public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftContainer<T> implements Furnace {
public CraftFurnace(Block block, Class<T> tileEntityClass) {
super(block, tileEntityClass);

View file

@ -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<TileEntityFurnaceFurnace> {
public CraftFurnaceFurnace(Block block) {
super(block, TileEntityFurnaceFurnace.class);

View file

@ -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<TileEntitySmoker> implements Smoker {
public CraftSmoker(Block block) {
super(block, TileEntitySmoker.class);

View file

@ -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;