CannibalVox / DimDoors

Other
44 stars 28 forks source link

Fix crash on exiting personal pocket dimension #33

Closed notabadminer closed 9 years ago

notabadminer commented 9 years ago

-changed unload() function to tryunload() to quiet shutdown error messages. If using unload() was intentional, don't do this.

CannibalVox commented 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!

notabadminer commented 9 years ago

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)); } }

CannibalVox commented 9 years ago

There's an access transformer for this: https://github.com/CannibalVox/DimDoors/blob/master/src/main/resources/META-INF/DimDoors_at.cfg

CannibalVox commented 9 years ago

Should be apparent when you set up the environment in gradle & it builds.