2014-12-15 00:11:48 +00:00
|
|
|
package com.cricketcraft.chisel.init;
|
2014-10-28 21:10:08 -04:00
|
|
|
|
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
|
import net.minecraft.item.Item;
|
2015-01-08 15:27:15 -05:00
|
|
|
import net.minecraft.item.ItemStack;
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 05:46:10 -05:00
|
|
|
public class ChiselTabs {
|
2014-10-28 21:10:08 -04:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
private static class CustomCreativeTab extends CreativeTabs {
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
private ItemStack stack;
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
public CustomCreativeTab(String label) {
|
|
|
|
|
super(label);
|
2015-01-07 19:50:18 -05:00
|
|
|
}
|
|
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
@Override
|
|
|
|
|
public Item getTabIconItem() {
|
|
|
|
|
return stack.getItem();
|
2015-01-07 19:50:18 -05:00
|
|
|
}
|
|
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
public void setTabIconItemStack(ItemStack stack) {
|
|
|
|
|
this.stack = stack;
|
|
|
|
|
}
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
@Override
|
|
|
|
|
public ItemStack getIconItemStack() {
|
|
|
|
|
return stack;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
private static boolean atLeastOneModIsLoaded = false;
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
public static final CustomCreativeTab tabChisel = new CustomCreativeTab("tabChisel");
|
|
|
|
|
public static final CustomCreativeTab tabStoneChiselBlocks = new CustomCreativeTab("tabStoneChiselBlocks");
|
|
|
|
|
public static final CustomCreativeTab tabWoodChiselBlocks = new CustomCreativeTab("tabWoodChiselBlocks");
|
|
|
|
|
public static final CustomCreativeTab tabMetalChiselBlocks = new CustomCreativeTab("tabMetalChiselBlocks");
|
|
|
|
|
public static final CustomCreativeTab tabOtherChiselBlocks = new CustomCreativeTab("tabOtherChiselBlocks");
|
|
|
|
|
public static final CustomCreativeTab tabModdedChiselBlocks = new CustomCreativeTab("tabModdedChiselBlocks");
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
// this serves mostly just to load the static initializers
|
|
|
|
|
public static void preInit() {
|
|
|
|
|
atLeastOneModIsLoaded = Features.oneModdedFeatureLoaded();
|
|
|
|
|
}
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
public static void postInit() {
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
tabChisel.setTabIconItemStack(new ItemStack(ChiselItems.chisel));
|
|
|
|
|
tabStoneChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.holystone));
|
2015-01-10 20:37:38 +00:00
|
|
|
tabWoodChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.planks[0], 1, 1));
|
2015-01-08 15:27:15 -05:00
|
|
|
tabMetalChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.technical));
|
|
|
|
|
tabOtherChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.jackolantern[0]));
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-08 15:27:15 -05:00
|
|
|
if (atLeastOneModIsLoaded) {
|
|
|
|
|
if (Features.ARCANE.enabled()) {
|
|
|
|
|
tabModdedChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.arcane));
|
|
|
|
|
} else if (Features.BLOOD_RUNE.enabled()) {
|
|
|
|
|
tabModdedChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.bloodRune));
|
|
|
|
|
} else {
|
|
|
|
|
tabModdedChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.voidstone));
|
2015-01-07 19:50:18 -05:00
|
|
|
}
|
2015-01-08 15:27:15 -05:00
|
|
|
}
|
2015-01-07 19:50:18 -05:00
|
|
|
}
|
2014-10-28 21:10:08 -04:00
|
|
|
}
|