Allow BOPBlock instances to specify their own item class

This commit is contained in:
Cheeserolls 2015-03-26 14:08:55 +00:00
parent ed8cc961bd
commit e34ff058be
2 changed files with 8 additions and 5 deletions

View File

@ -13,6 +13,7 @@ import java.util.Set;
import com.google.common.collect.ImmutableSet;
import biomesoplenty.common.item.ItemBlockWithVariants;
import biomesoplenty.common.util.block.BlockStateUtils;
import biomesoplenty.common.util.inventory.CreativeTabBOP;
import net.minecraft.block.Block;
@ -22,6 +23,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -36,6 +38,11 @@ public abstract class BOPBlock extends Block
this.setCreativeTab(CreativeTabBOP.instance);
}
// get the item class to use when registering this block
public Class<? extends ItemBlock> getItemClass() {
return ItemBlockWithVariants.class;
}
@Override
@SideOnly(Side.CLIENT)

View File

@ -10,11 +10,8 @@ package biomesoplenty.common.init;
import static biomesoplenty.api.block.BOPBlocks.*;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;
import biomesoplenty.api.block.BOPBlock;
@ -39,7 +36,6 @@ import biomesoplenty.common.block.BlockMud;
import biomesoplenty.common.block.BlockTurnip;
import biomesoplenty.common.block.BlockFlesh;
import biomesoplenty.common.handler.GuiEventHandler;
import biomesoplenty.common.item.ItemBlockWithVariants;
import biomesoplenty.common.util.block.BlockStateUtils;
import biomesoplenty.core.BiomesOPlenty;
@ -78,7 +74,7 @@ public class ModBlocks
if (block.hasPresetProperties())
{
GameRegistry.registerBlock(block, ItemBlockWithVariants.class, name);
GameRegistry.registerBlock(block, block.getItemClass(), name);
for (IBlockState state : block.presetStates)
{