diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/forestry')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java b/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java index 09268e49d5..a4af51f4e5 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java +++ b/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java @@ -1,9 +1,9 @@ package gtPlusPlus.xmod.forestry; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + import cpw.mods.fml.common.Optional; -import forestry.core.blocks.BlockRegistry; -import forestry.core.proxy.Proxies; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.forestry.bees.items.FR_ItemRegistry; @@ -11,9 +11,7 @@ import gtPlusPlus.xmod.forestry.bees.recipe.FR_Gregtech_Recipes; import net.minecraft.block.Block; import net.minecraft.world.World; -public class HANDLER_FR extends BlockRegistry { - - //public static BlockDenseBeeHouse apiculture; +public class HANDLER_FR { public static void preInit(){ if (LoadedMods.Forestry){ @@ -43,12 +41,18 @@ public class HANDLER_FR extends BlockRegistry { @Optional.Method(modid = "Forestry") private static void createBlockBreakParticles_INTERNAL(final World world, final int x, final int y, final int z, final Block block){ if (LoadedMods.Forestry){ - forestry.core.proxy.ProxyCommon mCommonProxy = ReflectionUtils.getField("forestry.core.proxy.ProxyCommon", "common"); - if (mCommonProxy != null){ - mCommonProxy.addBlockDestroyEffects(world, x, y, z, block, 0); + Class oClass; + try { + oClass = Class.forName("forestry.core.proxy.ProxyCommon"); + Object oProxy = ReflectionUtils.getField(oClass, "common"); + if (oProxy != null && oClass.isInstance(oProxy)){ + Method mParticles = oClass.getDeclaredMethod("addBlockDestroyEffects", World.class, int.class, int.class, int.class, Block.class, int.class); + mParticles.invoke(oProxy, world, x, y, z, block, 0); + } } - } - + catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } + } } |