Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3]

Author Topic: My Minecraft Mods  (Read 5143 times)

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: My Minecraft Mods
« Reply #30 on: January 08, 2014, 12:44:52 am »

Hmm, didn't know that... looking at the code.

The server side seems easier than I expected based on a quick skim. Doesn't need to even know about this block at all, unless it tries to do something unusual it shouldn't run into problems with the same player opening one inventory before closing the previous one.

Rendering anything derived from GuiContainer should be just a question of getting what class corresponds to what block iD or tile entity, making the GUI object, and then call all the drawGuiContainerForegroundLayer as part of your own drawGuiContainerForegroundLayer and all drawGuiContainerBackgroundLayer as part of your own drawGuiContainerBackgroundLayer or something like that (applying trial and error for stuff like order). Offsets would be trickier, but should be doable by messing with OpenGLs screen origin and size one way or another hopefully. Catching user input before being snatched up by all the open GUIs and then passing it to only the right one i'm not sure, but as for figuring which should have it should be trivial. So main problem here is "probably you can make open GL do this dirty hack right?" and a myriad of unforeseen conflicts and exceptions only discover-able through testing. And, well, actually writing anything.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Draco18s

  • Bay Watcher
    • View Profile
Re: My Minecraft Mods
« Reply #31 on: January 08, 2014, 08:20:37 am »

Might be doable, yes.

Will probably be a bitch and a half.

Good luck!
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: My Minecraft Mods
« Reply #32 on: January 08, 2014, 09:37:33 am »

Yea that was what I figured. Really it's the same scale of project as the Metaworlds, or NEI, or 3d chunks. Still people HAVE managed to do all of those.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Draco18s

  • Bay Watcher
    • View Profile
Re: My Minecraft Mods
« Reply #33 on: January 08, 2014, 10:03:15 am »

Yea that was what I figured. Really it's the same scale of project as the Metaworlds, or NEI, or 3d chunks. Still people HAVE managed to do all of those.

Metaworlds I have an idea of how it works, and it's just storing block data as part of a Entity.  The hard part was probably the rendering and making redstone work (based on the TinyBlocks mod: getting redstone and pistons to work was difficult, but eventually done).  Requires a fair bit of memory and CPU overhead, but the data required is all freely accessible.  Various blocks in various mods offer ways to store "blueprints" of structures and then rebuild them else where.  Same principle, except that the data is only stored, not also rendered and modifiable.

NEI just has to look at the Recipe Registry, which already has a standardized format.  Any mod can actually go in and request recipes with a specific output and even remove them or do other things.

3D chunks / cubic chunks is a bit more complex, but it involves restructuring some vanilla base code, I believe.  I'm only vaguely aware of how chunks operate down below the Chunk class, but I do know that Mojang made a mistake when assigning block x/y/z coordinates to the byte array, as Mystcraft actually went in and swapped them with its own Chunk Provider for its worldgen.  X and Z range from 0 to 15, or 4 bits.  Mojang stored them thusly (IIRC):

x<<12 | y<<4 | z

Allowing Y 8 bits.  Rather than

y<<8 | x<<4 | z

Which would give Y an unlimited* value, rather than X (which doesn't need it).

*Or at least, the larger selection of a 32 bit integer than the limited 8 bits granted by Mojang's code (which is why vanilla has a world height of 128).  Now that I've typed this, I think that's specifically worldgen and that the chunk data class stores Y as a separate bytearray, but the worldgen code was never updated to account for it, which is why mountains range up to 128 but you can build to 255 (max value of a byte).

Heck, vanilla worldgen classes still don't support block values above 255!  Forge has had to supply additional support for modblock worldgen.
« Last Edit: January 08, 2014, 10:07:12 am by Draco18s »
Logged

DogsRNice

  • Bay Watcher
  • Urist Maclunky
    • View Profile
    • Steam profile
Re: My Minecraft Mods
« Reply #34 on: January 09, 2014, 10:29:17 pm »

great now i want to build my new computer even more (my graphics card broke and minecraft crashes)
Logged
I had an FB named Ned once.  I kept imagining a giant Ned Flanders...

Want an underground tree with green wood? Check out this tiny mod I made to add one

Draco18s

  • Bay Watcher
    • View Profile
Re: My Minecraft Mods
« Reply #35 on: January 09, 2014, 10:43:17 pm »

great now i want to build my new computer even more (my graphics card broke and minecraft crashes)

Hehe. :D
Logged

DreamThorn

  • Bay Watcher
  • Seer of Void
    • View Profile
    • My game dev hobby blog (updates almost never)
Re: My Minecraft Mods
« Reply #36 on: January 10, 2014, 10:01:02 am »

I also tried modding MC once.  I made kelp that you could swim through and it interacts correctly with surrounding water.
Logged
This is what happens when we randomly murder people.

You get attacked by a Yandere triangle monster.

Draco18s

  • Bay Watcher
    • View Profile
Re: My Minecraft Mods
« Reply #37 on: January 10, 2014, 10:48:29 am »

I also tried modding MC once.  I made kelp that you could swim through and it interacts correctly with surrounding water.

Cool!
Logged
Pages: 1 2 [3]