mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-21 12:52:31 +00:00
Change package name for realsies now :P
This commit is contained in:
1 parent
4d8df815cc
commit
dae454dc17
138 files changed
+491
-438
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package com.cricketcraft.chisel.compat;
|
||||
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
|
||||
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 void init(FMLPostInitializationEvent event)
|
||||
{
|
||||
new MarbleCompatibility().postInit(event);
|
||||
|
||||
addSupport("ProjRed|Exploration", "projectred.exploration.stone", "marble", 0, 99);
|
||||
addSupport("bluepower", "marble", "marble", 0, 99);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public static void addSupport(String modname, String blockname, String name, int metadata, int order)
|
||||
{
|
||||
if(Loader.isModLoaded(modname) && GameRegistry.findBlock(modname, blockname) != null)
|
||||
{
|
||||
Carving.chisel.addVariation(name, GameRegistry.findBlock(modname, blockname), metadata, order);
|
||||
GameRegistry.findBlock(modname, blockname).setHarvestLevel("chisel", 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.cricketcraft.chisel.compat;
|
||||
|
||||
import com.cricketcraft.chisel.compat.ModIntegration.IModIntegration;
|
||||
import com.cricketcraft.chisel.init.ModBlocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class FMPIntegration implements IModIntegration{
|
||||
@Override
|
||||
public String getModId(){
|
||||
return "ForgeMicroblock";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInit(){
|
||||
registerMaterial(ModBlocks.marble);
|
||||
registerMaterial(ModBlocks.limestone);
|
||||
registerMaterial(ModBlocks.cobblestone, 1, 15);
|
||||
registerMaterial(ModBlocks.glass, 1, 15);
|
||||
registerMaterial(ModBlocks.sandstone, 3, 15);
|
||||
registerMaterial(ModBlocks.sandSnakestone, 1, 1);
|
||||
registerMaterial(ModBlocks.sandSnakestone, 13, 13);
|
||||
registerMaterial(ModBlocks.sandstoneScribbles);
|
||||
registerMaterial(ModBlocks.concrete, 0, 10);
|
||||
registerMaterial(ModBlocks.iron, 1, 15);
|
||||
registerMaterial(ModBlocks.gold, 1, 14);
|
||||
registerMaterial(ModBlocks.diamond, 1, 12);
|
||||
registerMaterial(ModBlocks.lightstone, 1, 15); //This is glowstone
|
||||
registerMaterial(ModBlocks.lapis, 1, 8);
|
||||
registerMaterial(ModBlocks.emerald, 1, 11);
|
||||
registerMaterial(ModBlocks.netherBrick, 1, 5);
|
||||
registerMaterial(ModBlocks.netherrack, 1, 14);
|
||||
registerMaterial(ModBlocks.cobblestoneMossy, 1, 15);
|
||||
registerMaterial(ModBlocks.stoneBrick, 4, 15);
|
||||
registerMaterial(ModBlocks.snakestone, 1, 1);
|
||||
registerMaterial(ModBlocks.snakestone, 13, 13);
|
||||
registerMaterial(ModBlocks.dirt, 0, 3);
|
||||
registerMaterial(ModBlocks.dirt, 6, 7);
|
||||
registerMaterial(ModBlocks.dirt, 11, 11);
|
||||
registerMaterial(ModBlocks.ice, 1, 15);
|
||||
registerMaterial(ModBlocks.icePillar);
|
||||
for(int x = 0; x < 4; x++){
|
||||
registerMaterial(ModBlocks.planks[x], 1, 15); // Oak, Spruce, Birch and Jungle
|
||||
}
|
||||
//Accacia
|
||||
registerMaterial(ModBlocks.planks[4], 1, 1);
|
||||
registerMaterial(ModBlocks.planks[4], 2, 2);
|
||||
registerMaterial(ModBlocks.planks[4], 6, 6);
|
||||
registerMaterial(ModBlocks.planks[4], 8, 11);
|
||||
registerMaterial(ModBlocks.planks[4], 13, 13);
|
||||
|
||||
//Dark Oak
|
||||
registerMaterial(ModBlocks.planks[5], 1, 1);
|
||||
registerMaterial(ModBlocks.planks[5], 2, 2);
|
||||
registerMaterial(ModBlocks.planks[5], 6, 6);
|
||||
registerMaterial(ModBlocks.planks[5], 8, 11);
|
||||
registerMaterial(ModBlocks.planks[5], 13, 13);
|
||||
|
||||
registerMaterial(ModBlocks.obsidian, 1, 15);
|
||||
registerMaterial(ModBlocks.obsidianSnakestone, 1, 1);
|
||||
registerMaterial(ModBlocks.obsidianSnakestone, 13, 13);
|
||||
registerMaterial(ModBlocks.redstone, 1, 15);
|
||||
registerMaterial(ModBlocks.holystone, 0, 13);
|
||||
registerMaterial(ModBlocks.carpet);
|
||||
registerMaterial(ModBlocks.lavastone, 0, 6);
|
||||
registerMaterial(ModBlocks.fantasy, 0, 1);
|
||||
registerMaterial(ModBlocks.fantasy, 3, 14);
|
||||
registerMaterial(ModBlocks.tyrian);
|
||||
registerMaterial(ModBlocks.temple, 1, 2);
|
||||
registerMaterial(ModBlocks.temple, 4, 15);
|
||||
registerMaterial(ModBlocks.templeMossy, 1, 2);
|
||||
registerMaterial(ModBlocks.templeMossy, 4, 15);
|
||||
registerMaterial(ModBlocks.factory, 0, 12);
|
||||
registerMaterial(ModBlocks.factory, 14, 14);
|
||||
registerMaterial(ModBlocks.stainedGlass[0]); //White
|
||||
registerMaterial(ModBlocks.stainedGlass[4]); //Yellow
|
||||
registerMaterial(ModBlocks.stainedGlass[8]); //Light Gray
|
||||
registerMaterial(ModBlocks.stainedGlass[12]); //Brown
|
||||
registerMaterial(ModBlocks.woolenClay);
|
||||
registerMaterial(ModBlocks.laboratory, 2, 3);
|
||||
registerMaterial(ModBlocks.laboratory, 5, 12);
|
||||
registerMaterial(ModBlocks.voidstone, 0, 3);
|
||||
registerMaterial(ModBlocks.voidstone, 12, 15);
|
||||
registerMaterial(ModBlocks.waterstone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostInit(){
|
||||
|
||||
}
|
||||
|
||||
private void registerMaterial(Block block){
|
||||
registerMaterial(block, 0, 15);
|
||||
}
|
||||
|
||||
private void registerMaterial(Block block, int minMeta, int maxMeta){
|
||||
for(int c = minMeta; c <= maxMeta; c++){
|
||||
FMLInterModComms.sendMessage(getModId(), "microMaterial", new ItemStack(block, 1, c));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.cricketcraft.chisel.compat;
|
||||
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
|
||||
public class MarbleCompatibility
|
||||
{
|
||||
|
||||
|
||||
abstract class ClassCompat
|
||||
{
|
||||
Class<?> cl;
|
||||
|
||||
public ClassCompat(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
if((cl = Class.forName(name)) != null)
|
||||
action();
|
||||
} catch(ClassNotFoundException e)
|
||||
{
|
||||
//e.printStackTrace();
|
||||
} catch(IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch(IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch(NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch(SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
abstract void action() throws Exception;
|
||||
|
||||
abstract class BlockCompat
|
||||
{
|
||||
Block block;
|
||||
|
||||
public BlockCompat(String variableName) throws Exception
|
||||
{
|
||||
block = (Block) ClassCompat.this.cl.getField(variableName).get(null);
|
||||
|
||||
if(block != null)
|
||||
action();
|
||||
}
|
||||
|
||||
abstract void action() throws Exception;
|
||||
}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
abstract class ClassBlockCompat
|
||||
{
|
||||
Block block;
|
||||
|
||||
ClassBlockCompat(final String className, final String blockName)
|
||||
{
|
||||
new ClassCompat(className)
|
||||
{
|
||||
@Override
|
||||
void action() throws Exception
|
||||
{
|
||||
new BlockCompat(blockName)
|
||||
{
|
||||
@Override
|
||||
void action() throws Exception
|
||||
{
|
||||
ClassBlockCompat.this.doAction(block);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void doAction(Block b)
|
||||
{
|
||||
block = b;
|
||||
|
||||
action();
|
||||
}
|
||||
|
||||
abstract void action();
|
||||
}
|
||||
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
new ClassBlockCompat("shukaro.artifice.ArtificeBlocks", "marble")
|
||||
{
|
||||
@Override
|
||||
void action()
|
||||
{
|
||||
Carving.chisel.addVariation("marble", block, 0, 99);
|
||||
block.setHarvestLevel("chisel", 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
new ClassBlockCompat("com.bluepowermod.init.BPBlocks", "marble")
|
||||
{
|
||||
@Override
|
||||
void action()
|
||||
{
|
||||
Carving.chisel.addVariation("marble", block, 0, 99);
|
||||
block.setHarvestLevel("chisel", 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
new ClassBlockCompat("num.numirp.block.ModBlocks", "blockDecor")
|
||||
{
|
||||
@Override
|
||||
void action()
|
||||
{
|
||||
Carving.chisel.addVariation("marble", block, 0, 99);
|
||||
block.setHarvestLevel("chisel", 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
new ClassBlockCompat("mariculture.core.Core", "limestone")
|
||||
{
|
||||
@Override
|
||||
void action()
|
||||
{
|
||||
Carving.chisel.addVariation("limestone", block, 0, 99);
|
||||
block.setHarvestLevel("chisel", 0, 0);
|
||||
}
|
||||
};
|
||||
new ClassBlockCompat("emasher.core.EmasherCore", "limestone")
|
||||
{
|
||||
@Override
|
||||
void action()
|
||||
{
|
||||
Carving.chisel.addVariation("limestone", block, 0, 99);
|
||||
block.setHarvestLevel("chisel", 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
new ClassCompat("Reika.GeoStrata.GeoStrata")
|
||||
{
|
||||
@Override
|
||||
void action() throws Exception
|
||||
{
|
||||
Block[] blocks = (Block[]) cl.getField("blocks").get(null);
|
||||
|
||||
Carving.chisel.addVariation("marble", blocks[0], 2, 99);
|
||||
blocks[0].setHarvestLevel("chisel", 0, 2);
|
||||
|
||||
Carving.chisel.addVariation("limestone", blocks[0], 3, 99);
|
||||
blocks[0].setHarvestLevel("chisel", 0, 3);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.cricketcraft.chisel.compat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class ModIntegration {
|
||||
|
||||
private static List<IModIntegration> integratedMods = new ArrayList<IModIntegration>();
|
||||
|
||||
public static void addMod(Class<? extends IModIntegration> cls){
|
||||
try{
|
||||
IModIntegration obj = cls.newInstance();
|
||||
|
||||
if(Loader.isModLoaded(obj.getModId())){
|
||||
integratedMods.add(obj);
|
||||
}
|
||||
} catch(Throwable throwable){
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void init(){
|
||||
try{
|
||||
for(IModIntegration integration : integratedMods){
|
||||
integration.onInit();
|
||||
}
|
||||
} catch (Throwable throwable){
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void postInit(){
|
||||
try {
|
||||
for (IModIntegration integration : integratedMods){
|
||||
integration.onPostInit();
|
||||
}
|
||||
} catch (Throwable throwable){
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static interface IModIntegration{
|
||||
String getModId();
|
||||
void onInit();
|
||||
void onPostInit();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user