aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-11-27 13:57:02 +1000
committerAlkalus <draknyte1@hotmail.com>2017-11-27 13:57:02 +1000
commit5d4f2648ceb147aae7ce00241ebfb34919dbb1bf (patch)
tree40bdc575d777e31d62b66584dcf34baa962a2691 /src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java
parente4bbd99f81d62907d5d19aad220a74718fb05c71 (diff)
downloadGT5-Unofficial-5d4f2648ceb147aae7ce00241ebfb34919dbb1bf.tar.gz
GT5-Unofficial-5d4f2648ceb147aae7ce00241ebfb34919dbb1bf.tar.bz2
GT5-Unofficial-5d4f2648ceb147aae7ce00241ebfb34919dbb1bf.zip
$ Hopefully fixed crash when Thaumcraft wasn't loaded.
$ Hopefully fixed crash when Forestry wasn't loaded.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java')
-rw-r--r--src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java26
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) {
+ }
+ }
}