Switch to using a singleton
The reason for this is that the object needs to stay accessible because adding a block into the world is done by the object that was used to register it in the game registry, not by the type.master
parent
643cef87a7
commit
e52c9b6011
|
@ -46,7 +46,9 @@ public class DeathChests {
|
|||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
Debug.out("Received FMLInitializationEvent");
|
||||
GameRegistry.registerBlock(new BlockDeathChest(), "death_chest");
|
||||
|
||||
GameRegistry.registerBlock(BlockDeathChest.getInstance(), "death_chest");
|
||||
|
||||
// TODO (probably here): Add death event handler
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,15 @@ package lostcave.deathchests.block;
|
|||
|
||||
import net.minecraft.block.BlockChest;
|
||||
|
||||
public class BlockDeathChest extends BlockChest{
|
||||
public class BlockDeathChest extends BlockChest {
|
||||
|
||||
public BlockDeathChest() {
|
||||
private static final BlockDeathChest instance = new BlockDeathChest();
|
||||
|
||||
public static BlockDeathChest getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private BlockDeathChest() {
|
||||
super(0);
|
||||
this.setBlockName("death_chest");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue