#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.
Dieser Commit ist enthalten in:
blablubbabc 2020-07-09 08:49:55 +10:00 committet von md_5
Ursprung f222b5bd4e
Commit 69fddc725b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: E8E901AC7C617C11
5 geänderte Dateien mit 7 neuen und 8 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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