Move block registration out of constructors

This commit is contained in:
Vincent Lee committed 2016-07-29 18:04:17 -05:00
1 parent 32a505a575
commit d622f0cd58
17 files changed
+127 -96

No files matched your search

@@ -49,7 +49,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable {
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable, IRegisterCallback {
private static final int COUNT = 8;
private final boolean second;
@@ -59,8 +59,8 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
this.setHardness(0.0F);
this.setSoundType(SoundType.PLANT);
String name = LibBlockNames.DOUBLE_FLOWER + (second ? 2 : 1);
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
setUnlocalizedName(name);
setHardness(0F);
setTickRandomly(false);
@@ -218,4 +218,10 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
return new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getValue(prop).ordinal() - (second ? 8 : 0));
}
@Override
public final void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
}