Closed notabadminer closed 9 years ago
I cherry picked the changes that I was interested in- you can see you commits in the commit log, thank you for submitting this!
You are correct on not accepting the the change in BlockRift. If a mod overrides block.getExplosionResistance() and tries to do something with the entity, it will cause a null pointer exception. I didn't think that one through. There is an issue with line 352 though. block.blockResistance is not visible as it is protected. Am I missing something? Trying to run the mod as is results in "java.lang.Error: Unresolved compilation problems: The field Block.blockResistance is not visible" We can use reflection to make it visible.
if (block != null) { Field f; Float value = null; try { f = Block.class.getDeclaredField("blockResistance"); f.setAccessible(true); value = f.getFloat(block); } catch (NoSuchFieldException e1) { } catch (SecurityException e1) { } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } if (value != null) { return (value >= MIN_IMMUNE_RESISTANCE || modBlocksImmuneToRift.contains(block) || blocksImmuneToRift .contains(block)); } }
There's an access transformer for this: https://github.com/CannibalVox/DimDoors/blob/master/src/main/resources/META-INF/DimDoors_at.cfg
Should be apparent when you set up the environment in gradle & it builds.
-changed unload() function to tryunload() to quiet shutdown error messages. If using unload() was intentional, don't do this.