mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-17 11:15:07 +00:00
Fix creative tabs to work with new system
This commit is contained in:
1 parent
014c2c77ce
commit
0e413b3c54
4 files changed
+74
-75
No files matched your search
@@ -142,9 +142,9 @@ public class Chisel {
|
||||
Configurations.config.load();
|
||||
Configurations.refreshConfig();
|
||||
|
||||
ChiselTabs.preInit();
|
||||
Features.preInit();
|
||||
PacketHandler.init();
|
||||
ChiselTabs.load();
|
||||
proxy.preInit();
|
||||
}
|
||||
|
||||
@@ -210,6 +210,7 @@ public class Chisel {
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
ChiselTabs.postInit();
|
||||
ModIntegration.postInit();
|
||||
Compatibility.init(event);
|
||||
}
|
||||
|
||||
@@ -20,15 +20,7 @@ public class Crafting {
|
||||
|
||||
@Deprecated
|
||||
private static void init() {
|
||||
Block concreteRecipeBlock = Block.getBlockFromName(Configurations.config.get("tweaks", "concrete recipe block", "gravel",
|
||||
"Unlocalized name of the block that, when burned, will produce concrete (examples: lightgem, stone)").getString());
|
||||
if (concreteRecipeBlock == null)
|
||||
concreteRecipeBlock = Blocks.gravel;
|
||||
|
||||
if (Configurations.featureEnabled("concrete"))
|
||||
FurnaceRecipes.smelting().func_151393_a(concreteRecipeBlock, new ItemStack(ChiselBlocks.concrete), 0.1F);
|
||||
if (Configurations.featureEnabled("sandstoneScribbles"))
|
||||
GameRegistry.addRecipe(new ItemStack(ChiselBlocks.sandstone_scribbles, 1), new Object[] { "X", 'X', new ItemStack(ChiselBlocks.sandstone, 1, 8), });
|
||||
for (int meta = 0; meta < 16; meta++) {
|
||||
if (Configurations.featureEnabled("marble"))
|
||||
GameRegistry.addRecipe(new ItemStack(ChiselBlocks.marble_slab, 6, 0), new Object[] { "***", '*', new ItemStack(ChiselBlocks.marble, 1, meta) });
|
||||
|
||||
@@ -1,83 +1,64 @@
|
||||
package com.cricketcraft.chisel.init;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ChiselTabs {
|
||||
|
||||
private static class CustomCreativeTab extends CreativeTabs {
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public CustomCreativeTab(String label) {
|
||||
super(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return stack.getItem();
|
||||
}
|
||||
|
||||
public void setTabIconItemStack(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean atLeastOneModIsLoaded = false;
|
||||
|
||||
public static CreativeTabs tabChisel;
|
||||
public static CreativeTabs tabStoneChiselBlocks, tabWoodChiselBlocks, tabMetalChiselBlocks, tabOtherChiselBlocks, tabModdedChiselBlocks;
|
||||
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");
|
||||
|
||||
public static void load() {
|
||||
// this serves mostly just to load the static initializers
|
||||
public static void preInit() {
|
||||
atLeastOneModIsLoaded = Features.oneModdedFeatureLoaded();
|
||||
}
|
||||
|
||||
tabChisel = new CreativeTabs("tabChisel") {
|
||||
public static void postInit() {
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return ChiselItems.chisel;
|
||||
}
|
||||
};
|
||||
|
||||
for (String s : Chisel.modsSupported) {
|
||||
if (Loader.isModLoaded(s)) {
|
||||
atLeastOneModIsLoaded = true;
|
||||
}
|
||||
}
|
||||
tabChisel.setTabIconItemStack(new ItemStack(ChiselItems.chisel));
|
||||
tabStoneChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.holystone));
|
||||
tabWoodChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.bookshelf));
|
||||
tabMetalChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.technical));
|
||||
tabOtherChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.jackolantern[0]));
|
||||
|
||||
if (atLeastOneModIsLoaded) {
|
||||
tabModdedChiselBlocks = new CreativeTabs("tabModdedChiselBlocks") {
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
|
||||
if (Loader.isModLoaded("Thaumcraft")) {
|
||||
return Item.getItemFromBlock(ChiselBlocks.arcane);
|
||||
} else if (Loader.isModLoaded("AWWayOfTime")) {
|
||||
return Item.getItemFromBlock(ChiselBlocks.bloodRune);
|
||||
} else {
|
||||
return Item.getItemFromBlock(ChiselBlocks.voidstone);
|
||||
}
|
||||
}
|
||||
};
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
tabStoneChiselBlocks = new CreativeTabs("tabStoneChiselBlocks") {
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(ChiselBlocks.holystone);
|
||||
}
|
||||
};
|
||||
|
||||
tabWoodChiselBlocks = new CreativeTabs("tabWoodChiselBlocks") {
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(Blocks.bookshelf);
|
||||
}
|
||||
};
|
||||
|
||||
tabMetalChiselBlocks = new CreativeTabs("tabMetalChiselBlocks") {
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(ChiselBlocks.technical);
|
||||
}
|
||||
};
|
||||
|
||||
tabOtherChiselBlocks = new CreativeTabs("tabOtherChiselBlocks") {
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(ChiselBlocks.jackolantern[0]);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -394,6 +395,16 @@ public enum Features {
|
||||
OreDictionary.registerOre("concrete", concrete);
|
||||
Carving.chisel.registerOre("concrete", "concrete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes() {
|
||||
Block concreteRecipeBlock = Block.getBlockFromName(Configurations.config.get("tweaks", "concrete recipe block", "gravel",
|
||||
"Unlocalized name of the block that, when burned, will produce concrete (examples: lightgem, stone)").getString());
|
||||
if (concreteRecipeBlock == null)
|
||||
concreteRecipeBlock = Blocks.gravel;
|
||||
|
||||
FurnaceRecipes.smelting().func_151393_a(concreteRecipeBlock, new ItemStack(ChiselBlocks.concrete), 0.1F);
|
||||
}
|
||||
},
|
||||
|
||||
DIAMOND_BLOCK {
|
||||
@@ -1724,6 +1735,11 @@ public enum Features {
|
||||
sandstone_scribbles.carverHelper.register(sandstone_scribbles, "sandstone_scribbles");
|
||||
Carving.chisel.registerOre("sandstone_scribbles", "sandstone_scribbles");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipes() {
|
||||
GameRegistry.addRecipe(new ItemStack(ChiselBlocks.sandstone_scribbles, 1), new Object[] { "X", 'X', new ItemStack(ChiselBlocks.sandstone, 1, 8), });
|
||||
}
|
||||
},
|
||||
|
||||
SMASHING_ROCK {
|
||||
@@ -2178,4 +2194,13 @@ public enum Features {
|
||||
private boolean shouldLoad(boolean init) {
|
||||
return requiredMod == null ? !init : init && Loader.isModLoaded(requiredMod);
|
||||
}
|
||||
|
||||
public static boolean oneModdedFeatureLoaded() {
|
||||
for (Features f : values()) {
|
||||
if (f.getRequiredMod() != null && Loader.isModLoaded(f.getRequiredMod())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user