mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-19 20:09:46 +00:00
Almost done with Auto Chisel
This commit is contained in:
1 parent
91cf0cf498
commit
5575d2dfcc
8 files changed
+87
-34
No files matched your search
@@ -3,7 +3,6 @@ package info.jbcs.minecraft.chisel.compat;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import info.jbcs.minecraft.chisel.ChiselModCompatibility;
|
||||
import info.jbcs.minecraft.chisel.carving.Carving;
|
||||
|
||||
public class Compatibility
|
||||
@@ -11,7 +10,7 @@ public class Compatibility
|
||||
|
||||
public static void init(FMLPostInitializationEvent event)
|
||||
{
|
||||
new ChiselModCompatibility().postInit(event);
|
||||
new MarbleCompatibility().postInit(event);
|
||||
|
||||
addSupport("ProjRed|Exploration", "projectred.exploration.stone", "marble", 0, 99);
|
||||
addSupport("bluepower", "marble", "marble", 0, 99);
|
||||
|
||||
@@ -9,19 +9,14 @@ import net.minecraft.item.ItemStack;
|
||||
public class FMPIntegration implements IModIntegration{
|
||||
@Override
|
||||
public String getModId(){
|
||||
return "ForgeMultipart";
|
||||
return "ForgeMicroblock";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInit(){
|
||||
registerMaterial(ModBlocks.marble);
|
||||
registerMaterial(ModBlocks.marbleSlab);
|
||||
registerMaterial(ModBlocks.marblePillar);
|
||||
registerMaterial(ModBlocks.marblePillarSlab);
|
||||
registerMaterial(ModBlocks.marbleStairs);
|
||||
registerMaterial(ModBlocks.limestone);
|
||||
registerMaterial(ModBlocks.limestoneSlab);
|
||||
registerMaterial(ModBlocks.limestoneStairs);
|
||||
registerMaterial(ModBlocks.cobblestone);
|
||||
registerMaterial(ModBlocks.glass);
|
||||
registerMaterial(ModBlocks.sandstone, 3, 15);
|
||||
@@ -40,22 +35,17 @@ public class FMPIntegration implements IModIntegration{
|
||||
registerMaterial(ModBlocks.dirt, 0, 12);
|
||||
registerMaterial(ModBlocks.ice, 1, 15);
|
||||
registerMaterial(ModBlocks.icePillar);
|
||||
registerMaterial(ModBlocks.iceStairs);
|
||||
registerMaterial(ModBlocks.obsidian, 1, 15);
|
||||
registerMaterial(ModBlocks.paneIron, 1, 9);
|
||||
registerMaterial(ModBlocks.redstone, 1, 15);
|
||||
registerMaterial(ModBlocks.holystone, 0, 13);
|
||||
registerMaterial(ModBlocks.lavastone, 0, 6);
|
||||
registerMaterial(ModBlocks.fantasy);
|
||||
registerMaterial(ModBlocks.carpet);
|
||||
registerMaterial(ModBlocks.carpetFloor);
|
||||
registerMaterial(ModBlocks.bookshelf, 0, 8);
|
||||
registerMaterial(ModBlocks.tyrian);
|
||||
registerMaterial(ModBlocks.temple);
|
||||
registerMaterial(ModBlocks.templeMossy);
|
||||
registerMaterial(ModBlocks.cloud, 0, 0);
|
||||
registerMaterial(ModBlocks.factory);
|
||||
registerMaterial(ModBlocks.paperWall, 0, 8);
|
||||
registerMaterial(ModBlocks.laboratory);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package info.jbcs.minecraft.chisel.compat;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import info.jbcs.minecraft.chisel.carving.Carving;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
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("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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user