use of forestry.api.circuits.ICircuitLayout in project PneumaticCraft by MineMaarten.
the class Forestry method preInit.
@Override
public void preInit() {
plasticElectronTube = new ItemPlasticElectronTube("plasticElectronTube");
Itemss.registerItem(plasticElectronTube);
Collection col = Farmables.farmables.get("farmVegetables");
// if(col != null) {
ICircuitLayout layoutManaged = ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed");
try {
Field field = ReflectionHelper.findField(Class.forName("forestry.farming.gadgets.StructureLogicFarm"), "bricks");
farmStructureBlocks = (HashSet<Block>) field.get(null);
} catch (Throwable e) {
Log.warning("Failed on getting Forestry's farm blocks, using defaults");
farmStructureBlocks = new HashSet<Block>();
farmStructureBlocks.add(Blocks.brick_block);
farmStructureBlocks.add(Blocks.stonebrick);
farmStructureBlocks.add(Blocks.sandstone);
farmStructureBlocks.add(Blocks.nether_brick);
farmStructureBlocks.add(Blocks.quartz_block);
}
try {
Constructor c = Class.forName("forestry.farming.circuits.CircuitFarmLogic").getConstructor(String.class, Class.class);
for (ItemStack stack : ((ItemPlasticElectronTube) plasticElectronTube).getSubItems()) {
int meta = stack.getItemDamage();
if (logics[meta] != null) {
ChipsetManager.solderManager.addRecipe(layoutManaged, new ItemStack(plasticElectronTube, 1, meta), (ICircuit) c.newInstance("plasticPlant" + meta, logics[meta]));
}
}
} catch (Throwable e) {
Log.error("Something happened when trying to register forestry farm logic");
e.printStackTrace();
}
/* } else {
Log.info("Forestry was found, but the 'farmVegetables' farmable wasn't. Is this forestry plugin loaded?");
}*/
}
Aggregations