Jump to content

Altering Core Minecraft classes


Bruxinth

Recommended Posts

So I recently just started getting familiar with modding minecraft so that I could start work on of my own ideas for mod projects.  One of the things I want to do is add the force of gravity to all blocks so that all blocks will fall by default (the exceptions will be construction blocks like wood planks, etc) and another will be to make liquids be more realistic by causing them to spread and pool rather than have a block infinitely generate streams of liquid out of it.  The one question I have before I begin this project is will this require me to alter core minecraft classes, and if so, will that be a bad thing, i.e. cause my mod to be incompatible with other mods?

Link to comment
Share on other sites

If forge can't cover what you want to do, then yes. Yes it will break compatibility with other mods.

Though you can use alternate methods to do it. I haven't touched source since 1.2.5 but you could possibly overwrite all the block definitions with new ones derived from the original but with the gravel/sand falling code added in. Or maybe an event listener for block updates and test/react accordingly.

Link to comment
Share on other sites

  • 3 weeks later...

Doing the sense of gravity could likely be done with just a regular mod.  I'm fairly certain there's a hook to catch when any block is broken, at which point you can just scan upwards for blocks to the height of that specific X/Z column, and shift all of those blocks downwards, maybe with a visual effect entity like the falling sand/gravel uses.  I can imagine that there might be performance implications though.  I believe TerraFirmaCraft does something like this, if you want to check that out.

Changing the fluid mechanics would more likely require you to change the vanilla code.  But you don't replace entire classes like in the old days; FML allows you to use ASM to modify the base classes at startup, to patch just the spots you need to change.  It's complicated and requires knowledge of Java opcodes but this makes it more compatible with other mods (and with Forge itself) than just replacing the whole thing.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...