Changed Creative Tab Handling a bit

This commit is contained in:
Ellpeck 2015-10-25 14:30:59 +01:00
parent 4131198835
commit 713e9b6e1a
4 changed files with 11 additions and 23 deletions

View file

@ -188,19 +188,19 @@ public class InitBlocks{
BlockUtil.register(blockFermentingBarrel); BlockUtil.register(blockFermentingBarrel);
blockRice = new BlockPlant("blockRice", 6, 1, 2); blockRice = new BlockPlant("blockRice", 6, 1, 2);
BlockUtil.register(blockRice, false); BlockUtil.register(blockRice);
CompatUtil.registerMFRPlant(blockRice); CompatUtil.registerMFRPlant(blockRice);
blockCanola = new BlockPlant("blockCanola", 4, 3, 3); blockCanola = new BlockPlant("blockCanola", 4, 3, 3);
BlockUtil.register(blockCanola, false); BlockUtil.register(blockCanola);
CompatUtil.registerMFRPlant(blockCanola); CompatUtil.registerMFRPlant(blockCanola);
blockFlax = new BlockPlant("blockFlax", 6, 2, 4); blockFlax = new BlockPlant("blockFlax", 6, 2, 4);
BlockUtil.register(blockFlax, false); BlockUtil.register(blockFlax);
CompatUtil.registerMFRPlant(blockFlax); CompatUtil.registerMFRPlant(blockFlax);
blockCoffee = new BlockPlant("blockCoffee", 6, 2, 2); blockCoffee = new BlockPlant("blockCoffee", 6, 2, 2);
BlockUtil.register(blockCoffee, false); BlockUtil.register(blockCoffee);
CompatUtil.registerMFRPlant(blockCoffee); CompatUtil.registerMFRPlant(blockCoffee);
blockCompost = new BlockCompost(); blockCompost = new BlockCompost();
@ -267,7 +267,7 @@ public class InitBlocks{
BlockUtil.register(blockPhantomBooster); BlockUtil.register(blockPhantomBooster);
blockWildPlant = new BlockWildPlant(); blockWildPlant = new BlockWildPlant();
BlockUtil.register(blockWildPlant, BlockWildPlant.TheItemBlock.class, false); BlockUtil.register(blockWildPlant, BlockWildPlant.TheItemBlock.class);
registerFluids(); registerFluids();
} }
@ -287,7 +287,7 @@ public class InitBlocks{
//Canola Block //Canola Block
if(fluidCanolaOil.getBlock() == null || ConfigBoolValues.PREVENT_CANOLA_BLOCK_OVERRIDE.isEnabled()){ if(fluidCanolaOil.getBlock() == null || ConfigBoolValues.PREVENT_CANOLA_BLOCK_OVERRIDE.isEnabled()){
blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil"); blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil");
BlockUtil.register(blockCanolaOil, false); BlockUtil.register(blockCanolaOil);
} }
else{ else{
errorAlreadyRegistered("Canola Oil Block"); errorAlreadyRegistered("Canola Oil Block");
@ -308,7 +308,7 @@ public class InitBlocks{
//Oil Block //Oil Block
if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){ if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){
blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil"); blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil");
BlockUtil.register(blockOil, false); BlockUtil.register(blockOil);
} }
else{ else{
errorAlreadyRegistered("Oil Block"); errorAlreadyRegistered("Oil Block");

View file

@ -39,7 +39,7 @@ public class CreativeTab extends CreativeTabs{
@Override @Override
public Item getTabIconItem(){ public Item getTabIconItem(){
return Item.getItemFromBlock(InitBlocks.blockPhantomLiquiface); return InitItems.itemLexicon;
} }
@Override @Override

View file

@ -19,11 +19,7 @@ import net.minecraft.item.ItemBlock;
public class BlockUtil{ public class BlockUtil{
public static void register(Block block, Class<? extends ItemBlock> itemBlock){ public static void register(Block block, Class<? extends ItemBlock> itemBlock){
register(block, itemBlock, true); block.setCreativeTab(CreativeTab.instance);
}
public static void register(Block block, Class<? extends ItemBlock> itemBlock, boolean addTab){
block.setCreativeTab(addTab ? CreativeTab.instance : null);
block.setBlockName(createUnlocalizedName(block)); block.setBlockName(createUnlocalizedName(block));
GameRegistry.registerBlock(block, itemBlock, ((IActAddItemOrBlock)block).getName()); GameRegistry.registerBlock(block, itemBlock, ((IActAddItemOrBlock)block).getName());
} }
@ -33,10 +29,6 @@ public class BlockUtil{
} }
public static void register(Block block){ public static void register(Block block){
register(block, ItemBlockBase.class, true); register(block, ItemBlockBase.class);
}
public static void register(Block block, boolean addTab){
register(block, ItemBlockBase.class, addTab);
} }
} }

View file

@ -36,11 +36,7 @@ public class ItemUtil{
} }
public static void register(Item item){ public static void register(Item item){
register(item, true); item.setCreativeTab(CreativeTab.instance);
}
public static void register(Item item, boolean addTab){
item.setCreativeTab(addTab ? CreativeTab.instance : null);
item.setUnlocalizedName(createUnlocalizedName(item)); item.setUnlocalizedName(createUnlocalizedName(item));
GameRegistry.registerItem(item, ((IActAddItemOrBlock)item).getName()); GameRegistry.registerItem(item, ((IActAddItemOrBlock)item).getName());
} }