Posted June 20, 201213 yr Hello again, peeps. I need to change a variable within ChunkProviderGenerator at line 143 else if (var12 * 8 + var31 < var6) { par3ArrayOfByte[var43 += var44] = (byte)FiniteLiquidBase.blockOcean.blockID; } But I'd like to do so without actually modifying that file, in the interest of compatibility. How would I do that? :?
June 20, 201213 yr Create your own ChunkProvider and use that. Or, replace Block.water with your own, or do the plethora of other base clean ways of modifying world generation. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 20, 201213 yr Author Good answer, thanks for the quick reply, Lex. Also Block.waterStill can't be set, it's final.
June 20, 201213 yr Yes it can, just not easily. That's all you're gunna get. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 20, 201213 yr Author I thought it was Block.blocksList[block.waterStill.blockID] = FiniteLiquidBase.blockWaterStill; Block.blocksList[block.waterMoving.blockID] = FiniteLiquidBase.blockWater; But it wasn't. You've got me, I have no idea. Something with block metadata?
June 22, 201213 yr Author Just to provide resolution for future people have this issue. The way to replace fields in Minecraft code without editing core classes is to use java.lang.reflect. public static void replaceBlock(String blockName, Block replacement) { try { Field f = Block.class.getDeclaredField(blockName); f.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL); f.set(null, replacement); } catch (Throwable e) { System.err.println(e); } }
June 22, 201213 yr /* snip */ Thanks much for posting the results, great for searching by others later.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.