mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-14 17:14:46 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
123d9e2989 |
@@ -231,10 +231,14 @@ public abstract class BlockUtil {
|
||||
|
||||
private static Class<? extends Block> BW_MetaGenerated_WerkstoffBlocksClass;
|
||||
private static Block BWBlocks;
|
||||
private static boolean bw = Loader.isModLoaded("bartworks");
|
||||
private static Class<? extends Block> GTBlockMachines_Class;
|
||||
private static Block GTBlockMachines;
|
||||
private static final boolean bw = Loader.isModLoaded("bartworks");
|
||||
private static final boolean gt = Loader.isModLoaded("gregtech");
|
||||
|
||||
static {
|
||||
if (bw) try {
|
||||
// noinspection unchecked
|
||||
BW_MetaGenerated_WerkstoffBlocksClass = (Class<? extends Block>) Class
|
||||
.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_WerkstoffBlocks");
|
||||
BWBlocks = (Block) Class.forName("com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader")
|
||||
@@ -242,6 +246,13 @@ public abstract class BlockUtil {
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (gt) try {
|
||||
// noinspection unchecked
|
||||
GTBlockMachines_Class = (Class<? extends Block>) Class.forName("gregtech.common.blocks.GT_Block_Machines");
|
||||
GTBlockMachines = (Block) Class.forName("gregtech.api.GregTech_API").getField("sBlockMachines").get(null);
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getItemStackFromBlockBelow(World world, int x, int y, int z,
|
||||
@@ -260,6 +271,10 @@ public abstract class BlockUtil {
|
||||
return new ItemStack(BWBlocks, 1, block.getDamageValue(world, x, y - depth, z));
|
||||
}
|
||||
|
||||
if (gt && GTBlockMachines_Class.isInstance(block)) {
|
||||
return new ItemStack(GTBlockMachines, 1, block.getDamageValue(world, x, y - depth, z));
|
||||
}
|
||||
|
||||
return new ItemStack(block, 1, world.getBlockMetadata(x, y - depth, z));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user