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;
|
2015-02-07 15:29:26 +00:00
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
|
import net.minecraft.init.Items;
|
2014-10-28 21:10:08 -04:00
|
|
|
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-13 01:45:52 -05:00
|
|
|
import com.cricketcraft.chisel.Features;
|
|
|
|
|
|
2015-02-25 04:24:11 -05:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
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-02-28 10:33:55 -05:00
|
|
|
|
2015-02-24 20:20:31 -05:00
|
|
|
private boolean search;
|
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-02-24 20:20:31 -05:00
|
|
|
public CustomCreativeTab(String label, boolean searchbar) {
|
2015-01-08 15:27:15 -05:00
|
|
|
super(label);
|
2015-02-24 20:20:31 -05:00
|
|
|
this.search = searchbar;
|
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-02-28 10:33:55 -05:00
|
|
|
|
2015-02-24 20:03:04 -05:00
|
|
|
@Override
|
2015-02-28 10:33:55 -05:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public String getBackgroundImageName() {
|
|
|
|
|
|
|
|
|
|
return search ? "item_search.png" : super.getBackgroundImageName();
|
|
|
|
|
}
|
2015-02-24 20:03:04 -05:00
|
|
|
|
2015-02-28 10:33:55 -05:00
|
|
|
@Override
|
|
|
|
|
public int getSearchbarWidth() {
|
2015-02-24 20:03:04 -05:00
|
|
|
|
2015-02-28 10:33:55 -05:00
|
|
|
return 89;
|
|
|
|
|
}
|
2015-02-24 20:03:04 -05:00
|
|
|
|
2015-02-28 10:33:55 -05:00
|
|
|
@Override
|
|
|
|
|
public boolean hasSearchBar() {
|
2015-02-24 20:03:04 -05:00
|
|
|
|
2015-02-28 10:33:55 -05:00
|
|
|
return search;
|
|
|
|
|
}
|
2015-01-08 15:27:15 -05:00
|
|
|
}
|
2015-01-07 19:50:18 -05:00
|
|
|
|
|
|
|
|
|
2015-02-24 20:20:31 -05:00
|
|
|
public static final CustomCreativeTab tabChisel = new CustomCreativeTab("tabChisel", false);
|
|
|
|
|
public static final CustomCreativeTab tabStoneChiselBlocks = new CustomCreativeTab("tabStoneChiselBlocks", true);
|
|
|
|
|
public static final CustomCreativeTab tabWoodChiselBlocks = new CustomCreativeTab("tabWoodChiselBlocks", true);
|
|
|
|
|
public static final CustomCreativeTab tabMetalChiselBlocks = new CustomCreativeTab("tabMetalChiselBlocks", true);
|
|
|
|
|
public static final CustomCreativeTab tabOtherChiselBlocks = new CustomCreativeTab("tabOtherChiselBlocks", true);
|
2015-06-27 21:31:39 -04:00
|
|
|
public static final CustomCreativeTab tabStairChiselBlocks = new CustomCreativeTab("tabStairChiselBlocks", true);
|
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-02-28 10:33:55 -05:00
|
|
|
if (Features.CHISEL.enabled())
|
|
|
|
|
tabChisel.setTabIconItemStack(new ItemStack(ChiselItems.chisel));
|
|
|
|
|
else
|
|
|
|
|
tabChisel.setTabIconItemStack(new ItemStack(Items.stick));
|
|
|
|
|
if (Features.HOLYSTONE.enabled())
|
|
|
|
|
tabStoneChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.holystone));
|
|
|
|
|
else
|
|
|
|
|
tabStoneChiselBlocks.setTabIconItemStack(new ItemStack(Blocks.stonebrick));
|
|
|
|
|
if (Features.WOOD.enabled())
|
|
|
|
|
tabWoodChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.planks[0], 1, 1));
|
|
|
|
|
else
|
|
|
|
|
tabWoodChiselBlocks.setTabIconItemStack(new ItemStack(Blocks.planks));
|
|
|
|
|
if (Features.TECHNICAL.enabled())
|
|
|
|
|
tabMetalChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.technical));
|
|
|
|
|
else
|
|
|
|
|
tabMetalChiselBlocks.setTabIconItemStack(new ItemStack(Blocks.iron_block));
|
|
|
|
|
if (Features.JACKOLANTERN.enabled())
|
|
|
|
|
tabOtherChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.jackolantern[0]));
|
|
|
|
|
else
|
|
|
|
|
tabOtherChiselBlocks.setTabIconItemStack(new ItemStack(Blocks.lit_pumpkin));
|
2015-06-27 21:31:39 -04:00
|
|
|
if (Features.ICE_STAIRS.enabled())
|
|
|
|
|
tabStairChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.iceStairs[0]));
|
|
|
|
|
else
|
|
|
|
|
tabStairChiselBlocks.setTabIconItemStack(new ItemStack(Blocks.nether_brick_stairs));
|
2015-01-07 19:50:18 -05:00
|
|
|
|
|
|
|
|
}
|
2014-10-28 21:10:08 -04:00
|
|
|
}
|