mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-17 11:15:07 +00:00
Repackage to team.chisel (excepting API)
This commit is contained in:
1 parent
7555e21144
commit
9574e05c29
132 files changed
+526
-596
No files matched your search
@@ -0,0 +1,290 @@
|
||||
package team.chisel.compat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.pahimar.ee3.api.exchange.RecipeRegistryProxy;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.carving.Carving;
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import team.chisel.init.ChiselItems;
|
||||
import team.chisel.utils.RecipeUtil;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class Compatibility {
|
||||
|
||||
public static String[] rockColorNames = { "gray", "lightgray", "brown", "tan", "reddish", "bluish", "greenish" };
|
||||
|
||||
public static Map<Integer, String> tconMap = Maps.newHashMap();
|
||||
|
||||
static {
|
||||
tconMap.put(0, "obsidian");
|
||||
tconMap.put(1, "sandstone");
|
||||
tconMap.put(2, "netherrack");
|
||||
tconMap.put(3, "stonebricksmooth");
|
||||
tconMap.put(12, "end_stone");
|
||||
}
|
||||
|
||||
public static void init(FMLPostInitializationEvent event) {
|
||||
|
||||
/* Proj Red */
|
||||
addSupport("ProjRed|Exploration", "projectred.exploration.stone", "marble", 0, 99);
|
||||
addSupport("ProjRed|Exploration", "projectred.exploration.stone", "marble", 1, 99);
|
||||
|
||||
/* Bluepower */
|
||||
addSupport("bluepower", "marble", "marble", 0, 99);
|
||||
|
||||
/* Artifice */
|
||||
addSupport("Artifice", "artifice.marble", "marble", 0, 99);
|
||||
addSupport("Artifice", "artifice.marble.slab", "marble_slab", 0, 99);
|
||||
for (String s : rockColorNames) {
|
||||
addSupport("Artifice", "artifice.limestone." + s, "limestone", 0, 99);
|
||||
}
|
||||
|
||||
/* Mariculture */
|
||||
Block block = GameRegistry.findBlock("mariculture", "limestone");
|
||||
if (block != null) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
addSupport("limestone", block, i, 99);
|
||||
}
|
||||
}
|
||||
|
||||
/* Geologica */
|
||||
addSupport("PFAAGeologica", "strongStone", "marble", 5, 99);
|
||||
addSupport("PFAAGeologica", "strongStoneSlab", "marbleSlab", 5, 99);
|
||||
addSupport("PFAAGeologica", "strongStoneBrickStairs.marble", "marbleStairs", 0, 99);
|
||||
addSupport("PFAAGeologica", "mediumStone", "limestone", 0, 99);
|
||||
addSupport("PFAAGeologica", "mediumStoneSlab", "limestoneSlab", 0, 99);
|
||||
addSupport("PFAAGeologica", "mediumStoneBrickStairs.limestone", "limestoneStairs", 0, 99);
|
||||
addSupport("PFAAGeologica", "strongStoneBrick", "stoneBrick", 3, 99);
|
||||
addSupport("PFAAGeologica", "strongCobble", "cobblestone", 3, 99);
|
||||
|
||||
/* Thaumcraft TODO There is probably a cleaner way of doing this */
|
||||
if (Loader.isModLoaded("Thaumcraft")) {
|
||||
loadThaumcraftAspects();
|
||||
}
|
||||
|
||||
for (Integer i : tconMap.keySet()) {
|
||||
addSupport("TConstruct", "decoration.multibrick", tconMap.get(i), i, 99);
|
||||
addSupport("TConstruct", "decoration.multibrickfancy", tconMap.get(i), i, 99);
|
||||
}
|
||||
|
||||
addSupport("TConstruct", "decoration.multibrickfancy", "stonebricksmooth", 14, 99);
|
||||
addSupport("TConstruct", "decoration.multibrickfancy", "stonebricksmooth", 15, 99);
|
||||
|
||||
addSupport("Botania", "endStoneBrick", "end_stone", 0, 0);
|
||||
addSupport("Botania", "endStoneBrick", "end_stone", 1, 0);
|
||||
|
||||
if (Loader.isModLoaded("EE3")) {
|
||||
loadEE3Values();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addSupport(String name, Block block, int metadata, int order) {
|
||||
Carving.chisel.addVariation(name, block, metadata, order);
|
||||
}
|
||||
|
||||
private static void loadThaumcraftAspects() {
|
||||
// ThaumcraftApi.registerObjectTag(new ItemStack(ChiselBlocks.cobblestone, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));
|
||||
// ThaumcraftApi.registerObjectTag(new ItemStack(ChiselBlocks.cobblestoneWall, 1, OreDictionary.WILDCARD_VALUE), (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));
|
||||
}
|
||||
|
||||
private static void loadEE3Values() {
|
||||
for (String groupName : Carving.chisel.getSortedGroupNames()){
|
||||
ICarvingGroup group = Carving.chisel.getGroup(groupName);
|
||||
List<ItemStack> baseStacks = new ArrayList<ItemStack>();
|
||||
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 (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));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package team.chisel.compat;
|
||||
|
||||
import com.cricketcraft.chisel.api.IMC;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingRegistry;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.carving.Carving;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
public class IMCHandler {
|
||||
|
||||
public static final IMCHandler INSTANCE = new IMCHandler();
|
||||
|
||||
private int order = 1000;
|
||||
|
||||
private IMCHandler() {
|
||||
}
|
||||
|
||||
public void handleMessage(IMCMessage message) {
|
||||
for (IMC imc : IMC.values()) {
|
||||
if (imc.key.equals(message.key)) {
|
||||
handle(message, imc, message.getStringValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handle(IMCMessage message, IMC type, String value) {
|
||||
ICarvingRegistry reg = Carving.chisel;
|
||||
String[] data = value.split("\\|");
|
||||
try {
|
||||
switch (type) {
|
||||
case ADD_VARIATION:
|
||||
case REMOVE_VARIATION:
|
||||
Block block = (Block) Block.blockRegistry.getObject(data[1]);
|
||||
int meta = Short.parseShort(data[2]);
|
||||
if (type == IMC.ADD_VARIATION) {
|
||||
reg.addVariation(data[0], block, meta, order++);
|
||||
} else {
|
||||
reg.removeVariation(block, meta, data[0]);
|
||||
}
|
||||
break;
|
||||
case REGISTER_GROUP_ORE:
|
||||
reg.registerOre(data[0], data[1]);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid IMC constant! How...what...?");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Chisel.logger.error("Could not handle data {} for IMC type {}. This was sent from mod {}.\n" + "!! This is a bug in that mod !!\nSwallowing error and continuing...", value, type.name(),
|
||||
message.getSender());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package team.chisel.compat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class WailaCompat implements IWailaDataProvider {
|
||||
|
||||
private WailaCompat() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler configHandler) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack stack, List<String> strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) {
|
||||
return strings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack stack, List<String> strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) {
|
||||
if (accessor.getBlock() instanceof ICarvable) {
|
||||
ICarvable block = (ICarvable) accessor.getBlock();
|
||||
MovingObjectPosition pos = accessor.getPosition();
|
||||
strings.add(block.getManager(accessor.getWorld(), pos.blockX, pos.blockY, pos.blockZ, accessor.getMetadata()).getDescription());
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack stack, List<String> strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) {
|
||||
return strings;
|
||||
}
|
||||
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static void register(IWailaRegistrar registrar) {
|
||||
registrar.registerBodyProvider(new WailaCompat(), ICarvable.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package team.chisel.compat.fmp;
|
||||
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartConverter;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class FMPCompat implements IPartFactory, IPartConverter {
|
||||
|
||||
public void init() {
|
||||
MultiPartRegistry.registerConverter(this);
|
||||
MultiPartRegistry.registerParts(this, new String[] { "chisel_torch" });
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Block> blockTypes() {
|
||||
return Lists.newArrayList(ChiselBlocks.torches);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart convert(World world, BlockCoord bc) {
|
||||
Block block = world.getBlock(bc.x, bc.y, bc.z);
|
||||
for (int i = 0; i < ChiselBlocks.torches.length; i++) {
|
||||
if (block == ChiselBlocks.torches[i]) {
|
||||
return new PartChiselTorch(i, world.getBlockMetadata(bc.x, bc.y, bc.z));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String type, boolean client) {
|
||||
if (type.equals("chisel_torch")) {
|
||||
return new PartChiselTorch();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package team.chisel.compat.fmp;
|
||||
|
||||
import team.chisel.block.BlockCarvableTorch;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import codechicken.multipart.minecraft.TorchPart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockChiselTorchPart extends ItemBlock {
|
||||
|
||||
private BlockCarvableTorch torch;
|
||||
|
||||
// Blame FML for the duped params, these references will always be the same
|
||||
public ItemBlockChiselTorchPart(Block block, BlockCarvableTorch torch) {
|
||||
super(block);
|
||||
this.torch = torch;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) {
|
||||
return (placePart(world, new BlockCoord(x, y, z).offset(side), stack, side, false)) || (super.func_150936_a(world, x, y, z, side, player, stack));
|
||||
}
|
||||
|
||||
public TMultiPart createMultiPart(World world, BlockCoord pos, ItemStack item, int side) {
|
||||
return new PartChiselTorch(torch.idx, TorchPart.sideMetaMap[side ^ 1]);
|
||||
}
|
||||
|
||||
public boolean placePart(World world, BlockCoord pos, ItemStack item, int side, boolean doPlace) {
|
||||
TileMultipart tile = TileMultipart.getOrConvertTile(world, pos);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
TMultiPart part = createMultiPart(world, pos, item, side);
|
||||
if (part == null) {
|
||||
return false;
|
||||
}
|
||||
if (tile.canAddPart(part)) {
|
||||
if (doPlace) {
|
||||
TileMultipart.addPart(world, pos, part);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
BlockCoord pos = new BlockCoord(x, y, z);
|
||||
if (!block.isReplaceable(world, x, y, z)) {
|
||||
pos = new BlockCoord(x, y, z).offset(side);
|
||||
}
|
||||
if (placePart(world, pos, stack, side, !world.isRemote)) {
|
||||
world.playSoundEffect(pos.x + 0.5F, pos.y + 0.5F, pos.z + 0.5F, field_150939_a.stepSound.func_150496_b(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
stack.stackSize -= 1;
|
||||
return true;
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package team.chisel.compat.fmp;
|
||||
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.multipart.minecraft.TorchPart;
|
||||
|
||||
public class PartChiselTorch extends TorchPart {
|
||||
|
||||
private int idx;
|
||||
|
||||
public PartChiselTorch() {
|
||||
}
|
||||
|
||||
public PartChiselTorch(int idx, int meta) {
|
||||
super(meta);
|
||||
this.idx = idx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDesc(MCDataOutput packet) {
|
||||
super.writeDesc(packet);
|
||||
packet.writeInt(idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readDesc(MCDataInput packet) {
|
||||
super.readDesc(packet);
|
||||
this.idx = packet.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(NBTTagCompound tag) {
|
||||
super.save(tag);
|
||||
tag.setInteger("idx", idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound tag) {
|
||||
super.load(tag);
|
||||
this.idx = tag.getInteger("idx");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return ChiselBlocks.torches[idx];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "chisel_torch";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package team.chisel.compat.nei;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.client.gui.GuiChisel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class NEIChiselConfig implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Chisel.MOD_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return Chisel.VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "limestone_slab_top")));
|
||||
API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "marble_slab_top")));
|
||||
API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "marble_pillar_slab_top")));
|
||||
|
||||
RecipeHandlerChisel handler = new RecipeHandlerChisel();
|
||||
API.registerRecipeHandler(handler);
|
||||
API.registerUsageHandler(handler);
|
||||
API.setGuiOffset(GuiChisel.class, -50, 40);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package team.chisel.compat.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
import team.chisel.carving.Carving;
|
||||
import team.chisel.client.gui.GuiChisel;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class RecipeHandlerChisel extends TemplateRecipeHandler {
|
||||
|
||||
private static final int SLOTS_PER_PAGE = 45;
|
||||
|
||||
public class CachedChiselRecipe extends CachedRecipe {
|
||||
|
||||
private List<PositionedStack> input = new ArrayList<PositionedStack>();
|
||||
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
|
||||
public Point focus;
|
||||
|
||||
public CachedChiselRecipe(List<ItemStack> variations, ItemStack base, ItemStack focus) {
|
||||
PositionedStack pStack = new PositionedStack(base != null ? base : variations, 74, 4);
|
||||
pStack.setMaxSize(1);
|
||||
this.input.add(pStack);
|
||||
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
for (ItemStack v : variations) {
|
||||
this.outputs.add(new PositionedStack(v, 3 + 18 * col, 37 + 18 * row));
|
||||
|
||||
if (focus != null && NEIServerUtils.areStacksSameTypeCrafting(focus, v)) {
|
||||
this.focus = new Point(2 + 18 * col, 36 + 18 * row);
|
||||
}
|
||||
|
||||
col++;
|
||||
if (col > 8) {
|
||||
col = 0;
|
||||
row++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CachedChiselRecipe(List<ItemStack> variations) {
|
||||
this(variations, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return this.getCycledIngredients(cycleticks / 20, this.input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return this.outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return "Chisel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "Chisel:textures/chiselNEI.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiChisel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 130);
|
||||
|
||||
Point focus = ((CachedChiselRecipe) this.arecipes.get(recipeIndex)).focus;
|
||||
if (focus != null) {
|
||||
GuiDraw.drawTexturedModalRect(focus.x, focus.y, 166, 0, 18, 18);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(75, 22, 15, 13), "chisel2.chisel", new Object[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("chisel2.chisel")) {
|
||||
for (String name : Carving.chisel.getSortedGroupNames()) {
|
||||
ICarvingGroup g = Carving.chisel.getGroup(name);
|
||||
if (!g.getVariations().isEmpty()) {
|
||||
addCached(getVariationStacks(g));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (String name : Carving.chisel.getSortedGroupNames()) {
|
||||
ICarvingGroup g = Carving.chisel.getGroup(name);
|
||||
List<ItemStack> variations = getVariationStacks(g);
|
||||
for (ItemStack stack : variations) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(stack, result)) {
|
||||
addCached(variations, null, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (String name : Carving.chisel.getSortedGroupNames()) {
|
||||
ICarvingGroup g = Carving.chisel.getGroup(name);
|
||||
List<ItemStack> variations = getVariationStacks(g);
|
||||
for (ItemStack stack : variations) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
|
||||
addCached(variations, ingredient, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addCached(List<ItemStack> variations, ItemStack base, ItemStack focus) {
|
||||
if (variations.size() > SLOTS_PER_PAGE) {
|
||||
List<List<ItemStack>> parts = new ArrayList<List<ItemStack>>();
|
||||
int size = variations.size();
|
||||
for (int i = 0; i < size; i += SLOTS_PER_PAGE) {
|
||||
parts.add(new ArrayList<ItemStack>(variations.subList(i, Math.min(size, i + SLOTS_PER_PAGE))));
|
||||
}
|
||||
for (List<ItemStack> part : parts) {
|
||||
this.arecipes.add(new CachedChiselRecipe(part, base, focus));
|
||||
}
|
||||
} else {
|
||||
this.arecipes.add(new CachedChiselRecipe(variations, base, focus));
|
||||
}
|
||||
}
|
||||
|
||||
private void addCached(List<ItemStack> variations) {
|
||||
addCached(variations, null, null);
|
||||
}
|
||||
|
||||
private static List<ItemStack> getVariationStacks(ICarvingGroup g) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
for (ICarvingVariation v : g.getVariations()) {
|
||||
stacks.add(CarvingUtils.getStack(v));
|
||||
}
|
||||
String oreName = g.getOreName();
|
||||
if (oreName != null) {
|
||||
check: for (ItemStack ore : OreDictionary.getOres(oreName)) {
|
||||
for (ItemStack stack : stacks) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(stack, ore)) {
|
||||
continue check;
|
||||
}
|
||||
}
|
||||
stacks.add(ore.copy());
|
||||
}
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user