diff --git a/src/main/java/com/cricketcraft/chisel/compat/Compatibility.java b/src/main/java/com/cricketcraft/chisel/compat/Compatibility.java index 1dec0ef4..0ae08177 100644 --- a/src/main/java/com/cricketcraft/chisel/compat/Compatibility.java +++ b/src/main/java/com/cricketcraft/chisel/compat/Compatibility.java @@ -1,7 +1,14 @@ package com.cricketcraft.chisel.compat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.Map; +import com.cricketcraft.chisel.api.carving.ICarvingGroup; +import com.cricketcraft.chisel.api.carving.ICarvingVariation; +import com.cricketcraft.chisel.utils.RecipeUtil; +import com.pahimar.ee3.api.exchange.RecipeRegistryProxy; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -76,6 +83,7 @@ public class Compatibility { addSupport("TConstruct", "decoration.multibrick", tconMap.get(i), i, 99); addSupport("TConstruct", "decoration.multibrickfancy", tconMap.get(i), i, 99); } + TinkersChiselCompat.addTConstructDetailingSupport(); addSupport("TConstruct", "decoration.multibrickfancy", "stonebricksmooth", 14, 99); addSupport("TConstruct", "decoration.multibrickfancy", "stonebricksmooth", 15, 99); @@ -88,6 +96,7 @@ public class Compatibility { } } + public static void addSupport(String modname, String blockname, String name, int metadata, int order) { if (Loader.isModLoaded(modname) && GameRegistry.findBlock(modname, blockname) != null) { addSupport(name, GameRegistry.findBlock(modname, blockname), metadata, order); @@ -104,149 +113,177 @@ public class Compatibility { } private static void loadEE3Values() { - FMLLog.log(Chisel.MOD_ID, Level.INFO, "[Chisel 2] Oooh is that Equivalent Exchange I see?"); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselItems.ballomoss, 1), 16); - - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.sand_snakestone, 1, 1), 8); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.sand_snakestone, 1, 13), 8); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 0), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 1), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 2), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 3), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 4), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 1), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 2), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 3), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 4), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 12), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 13), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 14), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 15), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.present, 1, 4), 80); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.road_line, 1, 0), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.road_line, 1, 1), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.road_line, 1, 2), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.road_line, 1, 3), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 0), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 1), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 2), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 3), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass2, 1), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 0), 32); - - for (int x = 0; x < ChiselBlocks.pumpkin.length; x++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.pumpkin[x], 1), 144); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.jackolantern[x], 1), 153); - } - - for (int x = 0; x < ChiselBlocks.torches.length; x++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.torches[x], 1), 9); - } - - for (int x = 0; x < 10; x++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.valentines, 1, x), 3); - } - - for (int x = 0; x < 16; x++) { - if (x <= 10) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.concrete, 1, x), 8); - if (x <= 14) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.grimstone, 1, x), 5); - if (x < 14) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.grimstone, 1, x), 7); - if (x < 12) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.dirt, 1, x), 1); - if (x < 5) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.rebel, 1, x), 39); - } - - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.fantasyblock, 1, x), 29444); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.fantasyblock, 1, x), 31444); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.limestone, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.marble, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.marble_pillar, 1, x), 8); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.marble_pillar_slab, 1, x), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.sandstone_scribbles, 1, x), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.stonebricksmooth, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.templeblock, 1, x), 108); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.mossy_templeblock, 1, x), 108); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glowstone, 1, x), 1536); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.ice, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.woolen_clay, 1, x), 153); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.factoryblock, 1, x), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.hexPlating, 1, x), 37); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.gold_block, 1, x), 18432); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_block, 1, x), 2304); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.laboratoryblock, 1, x), 33); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical, 1, x), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.tyrian, 1, x), 33); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.hexLargePlating, 1, x), 37); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.circuits, 1, x), 37); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.factoryblock2, 1, x), 32); - - if (x < 15) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.warningSign, 1, x), 6); - - if (x < 4) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.factoryblock2, 1, x), 32); - - for (int c = 0; c < ChiselBlocks.stainedGlass.length; c++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.stainedGlass[c], 1, x), 1); - } - - for (int c = 0; c < ChiselBlocks.stainedGlassPane.length; c++) { - if (x <= 13) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.stainedGlassPane[c], 1, x), 1); - } - - if (x > 0) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cobblestone, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.mossy_cobblestone, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.netherrack, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.obsidian, 1, x), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.sandstone, 1, x), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstonerunic, 1, x), 160); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.redstone_block, 1, x), 288); - if (x <= 8) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.bookshelf, 1, x), 528); - if (x <= 12) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.diamond_block, 1, x), 73728); - if (x != 12) - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.emerald_block, 1, x), 73728); + for (String groupName : Carving.chisel.getSortedGroupNames()){ + ICarvingGroup group = Carving.chisel.getGroup(groupName); + List baseStacks = new ArrayList(); + for (ICarvingVariation variation : group.getVariations()){ + if (RecipeUtil.isCreatable(new ItemStack(variation.getBlock(), 1, variation.getBlockMeta()))){ + baseStacks.add(new ItemStack(variation.getBlock(), 1, variation.getBlockMeta())); } - - for (int c = 0; c < ChiselBlocks.planks.length; c++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.planks[c], 1, x), 8); + } + for (ICarvingVariation variation : group.getVariations()){ + ItemStack stack = new ItemStack(variation.getBlock(), 1, variation.getBlockMeta()); + for (ItemStack baseStack : baseStacks) { +// if (baseStack==null){ +// Chisel.logger.error("Base Stack is null"); +// if (stack!=null){ +// Chisel.logger.info("Non base for base stack is "+stack); +// } +// continue; +// } +// if (stack==null){ +// Chisel.logger.error("Non Base stack is null"); +// Chisel.logger.info("Base stack for null stack is "+baseStack); +// continue; +// } + //Chisel.logger.info("Adding emc recipe for "+baseStack+" to "+stack); + RecipeRegistryProxy.addRecipe(stack, Arrays.asList(baseStack)); } } } - - for (int x = 0; x <= 6; x++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.andesite, 1, x), 129); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.diorite, 1, x), 257); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.granite, 1, x), 513); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.lavastone, 1, x), 9); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.lavastone, 1, 7), 9); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstone, 1, x), 160); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstone, 1, 7), 160); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstone2, 1, x), 256); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstone2, 1, 7), 256); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.waterstone, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.ice_pillar, 1, x), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_bars, 1, x), 96); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_bars, 1, 7), 96); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_bars, 1, 8), 96); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_bars, 1, 9), 96); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall, 1, x), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall, 1, 7), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall, 1, 8), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall_block, 1, x), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall_block, 1, 7), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall_block, 1, 8), 32); - if (x > 0) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.brickCustom, 1, x), 256); - } - } +// FMLLog.log(Chisel.MOD_ID, Level.INFO, "[Chisel 2] Oooh is that Equivalent Exchange I see?"); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselItems.ballomoss, 1), 16); +// +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.sand_snakestone, 1, 1), 8); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.sand_snakestone, 1, 13), 8); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 0), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 1), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 2), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 3), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cloud, 1, 4), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 1), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 2), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 3), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 4), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 12), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 13), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 14), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass_pane, 1, 15), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.present, 1, 4), 80); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.road_line, 1, 0), 24); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.road_line, 1, 1), 24); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.road_line, 1, 2), 24); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.road_line, 1, 3), 24); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 0), 24); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 1), 24); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 2), 24); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 3), 24); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass2, 1), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical2, 1, 0), 32); +// +// for (int x = 0; x < ChiselBlocks.pumpkin.length; x++) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.pumpkin[x], 1), 144); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.jackolantern[x], 1), 153); +// } +// +// for (int x = 0; x < ChiselBlocks.torches.length; x++) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.torches[x], 1), 9); +// } +// +// for (int x = 0; x < 10; x++) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.valentines, 1, x), 3); +// } +// +// for (int x = 0; x < 16; x++) { +// if (x <= 10) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.concrete, 1, x), 8); +// if (x <= 14) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.grimstone, 1, x), 5); +// if (x < 14) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.grimstone, 1, x), 7); +// if (x < 12) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.dirt, 1, x), 1); +// if (x < 5) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.rebel, 1, x), 39); +// } +// +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.fantasyblock, 1, x), 29444); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.fantasyblock, 1, x), 31444); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.limestone, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.marble, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.marble_pillar, 1, x), 8); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.marble_pillar_slab, 1, x), 4); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.sandstone_scribbles, 1, x), 4); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.stonebricksmooth, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.templeblock, 1, x), 108); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.mossy_templeblock, 1, x), 108); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glowstone, 1, x), 1536); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.ice, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.woolen_clay, 1, x), 153); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.factoryblock, 1, x), 32); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.hexPlating, 1, x), 37); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.gold_block, 1, x), 18432); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_block, 1, x), 2304); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.laboratoryblock, 1, x), 33); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.technical, 1, x), 32); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.tyrian, 1, x), 33); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.hexLargePlating, 1, x), 37); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.circuits, 1, x), 37); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.factoryblock2, 1, x), 32); +// +// if (x < 15) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.warningSign, 1, x), 6); +// +// if (x < 4) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.factoryblock2, 1, x), 32); +// +// for (int c = 0; c < ChiselBlocks.stainedGlass.length; c++) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.stainedGlass[c], 1, x), 1); +// } +// +// for (int c = 0; c < ChiselBlocks.stainedGlassPane.length; c++) { +// if (x <= 13) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.stainedGlassPane[c], 1, x), 1); +// } +// +// if (x > 0) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.cobblestone, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.mossy_cobblestone, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.netherrack, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.obsidian, 1, x), 64); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.sandstone, 1, x), 4); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstonerunic, 1, x), 160); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.glass, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.redstone_block, 1, x), 288); +// if (x <= 8) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.bookshelf, 1, x), 528); +// if (x <= 12) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.diamond_block, 1, x), 73728); +// if (x != 12) +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.emerald_block, 1, x), 73728); +// } +// +// for (int c = 0; c < ChiselBlocks.planks.length; c++) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.planks[c], 1, x), 8); +// } +// } +// } +// +// for (int x = 0; x <= 6; x++) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.andesite, 1, x), 129); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.diorite, 1, x), 257); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.granite, 1, x), 513); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.lavastone, 1, x), 9); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.lavastone, 1, 7), 9); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstone, 1, x), 160); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstone, 1, 7), 160); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstone2, 1, x), 256); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.voidstone2, 1, 7), 256); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.waterstone, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.ice_pillar, 1, x), 1); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_bars, 1, x), 96); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_bars, 1, 7), 96); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_bars, 1, 8), 96); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.iron_bars, 1, 9), 96); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall, 1, x), 32); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall, 1, 7), 32); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall, 1, 8), 32); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall_block, 1, x), 32); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall_block, 1, 7), 32); +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.paperwall_block, 1, 8), 32); +// if (x > 0) { +// EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ChiselBlocks.brickCustom, 1, x), 256); +// } +// } } } diff --git a/src/main/java/com/cricketcraft/chisel/compat/TinkersChiselCompat.java b/src/main/java/com/cricketcraft/chisel/compat/TinkersChiselCompat.java new file mode 100644 index 00000000..cc1ff08b --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/compat/TinkersChiselCompat.java @@ -0,0 +1,103 @@ +package com.cricketcraft.chisel.compat; + +import com.cricketcraft.chisel.Chisel; +import com.cricketcraft.chisel.carving.Carving; +import cpw.mods.fml.common.Loader; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +/** + * Combat for the tinkers chisel, in its own class as to not cause clutter + * + * @author minecreatr + */ +public class TinkersChiselCompat { + + + public static final String TINKERS_ID = "TConstruct"; + + private static Class TINKERS_MOD_CLASS; + private static Class DETAILING_CLASS; + private static Class DETAIL_INPUT_CLASS; + + private static Method GET_DETAILING; + + private static Field DETAIL_FIELD; + + private static Field INPUT_STACK; + private static Field INPUT_META; + private static Field OUTPUT_STACK; + private static Field OUTPUT_META; + + public static void addTConstructDetailingSupport(){ + if (Loader.isModLoaded(TINKERS_ID)){ + loadReflection(); + List stacks = getAllChiseling(); + for (ItemStack stack : stacks) { + if (Block.getBlockFromItem(stack.getItem()) != null) { + Chisel.logger.info("Added variation for stack "+stack.toString()); + Carving.chisel.addVariation("tinkers", Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 0); + } else { + Chisel.logger.info("Item "+stack.getItem()+" has no block form"); + } + } + } + } + + + private static void loadReflection(){ + if (TINKERS_MOD_CLASS == null || DETAILING_CLASS == null || DETAIL_INPUT_CLASS == null || GET_DETAILING == null || DETAIL_FIELD == null) { + try { + TINKERS_MOD_CLASS = Class.forName("tconstruct.TConstruct"); + DETAILING_CLASS = Class.forName("tconstruct.library.crafting.Detailing"); + DETAIL_INPUT_CLASS = Class.forName("tconstruct.library.crafting.Detailing$DetailInput"); + + GET_DETAILING = TINKERS_MOD_CLASS.getDeclaredMethod("getChiselDetailing"); + + DETAIL_FIELD = DETAILING_CLASS.getDeclaredField("detailing"); + + INPUT_STACK = DETAIL_INPUT_CLASS.getDeclaredField("input"); + INPUT_META = DETAIL_INPUT_CLASS.getDeclaredField("inputMeta"); + OUTPUT_STACK = DETAIL_INPUT_CLASS.getDeclaredField("output"); + OUTPUT_META = DETAIL_INPUT_CLASS.getDeclaredField("outputMeta"); + + } catch (Exception exception) { + exception.printStackTrace(); + Chisel.logger.error("Error adding tinkers detailing support"); + } + } + } + + private static List getAllChiseling(){ + try { + List toReturn = new ArrayList(); + Object detailingObj = GET_DETAILING.invoke(null); + Object detailList = DETAIL_FIELD.get(detailingObj); + if (detailList instanceof List){ + List list = (List) detailList; + for (Object detail : list){ + ItemStack stackInput = (ItemStack) INPUT_STACK.get(detail); + int inMeta = (Integer) INPUT_META.get(detail); + + ItemStack stackOutput = (ItemStack) OUTPUT_STACK.get(detail); + int outMeta = (Integer) OUTPUT_META.get(detail); + + stackInput.setItemDamage(inMeta); + stackOutput.setItemDamage(outMeta); + toReturn.add(stackInput); + toReturn.add(stackOutput); + } + } + return toReturn; + } catch (Exception exception){ + exception.printStackTrace(); + Chisel.logger.error("Error adding tinkers detailing support"); + return null; + } + } +} diff --git a/src/main/java/com/cricketcraft/chisel/utils/RecipeUtil.java b/src/main/java/com/cricketcraft/chisel/utils/RecipeUtil.java new file mode 100644 index 00000000..20187c61 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/utils/RecipeUtil.java @@ -0,0 +1,36 @@ +package com.cricketcraft.chisel.utils; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.item.crafting.IRecipe; + +import java.util.List; + +/** + * Utility for crafting/recipe things + */ +public class RecipeUtil { + + public static boolean isCraftable(ItemStack stack){ + for (IRecipe recipe : (List)CraftingManager.getInstance().getRecipeList()){ + if (recipe.getRecipeOutput()==null){ + continue; + } + if (stack.isItemEqual(recipe.getRecipeOutput())){ + return true; + } + } + return false; + } + + public static boolean isSmeltable(ItemStack stack){ + return FurnaceRecipes.smelting().getSmeltingList().containsKey(stack); + } + + public static boolean isCreatable(ItemStack stack){ + return isCraftable(stack) || isSmeltable(stack); + } + +}