Hi.
I am trying to make a mod that will have a completely empty world. I would then like to be able to "recreate" chunks at will so that they look like they would if Minecraft had just done its thing as it normally would.
So far I have tried creating a custom WorldType in order to inject my own WorldChunkProvider and override the provideCunk method. The idea was to just return an instance of EmptyChunk if the chunk was not in my list of "living" chunks, but when I run that it just spews out this error:
java.lang.NoClassDefFoundError: net/minecraft/world/World$2
So I am guessing Minecraft still needs to do some work on the chunks that it expects to be full of blocks, but its just guesswork.
I have also made my own EmptyChunk class that only has an override for the getBlock method so that it always return a Blocks.air, but that only provided me with more of the same error.
If I change it to return Blocks.bedrock all the time, it gives me this error instead:
java.lang.ClassCastException: net.minecraft.block.Block cannot be cast to net.minecraft.block.BlockRailBase
That is ofcourse only when there is a mineshaft below. If that is not the case, the game starts, but instead of the affected chunks being bedrock, they instead appear to be air. Until one tries to walk over the edge that is. There is an invisible wall so it looks like the chunks really are 100% bedrock but they are not being rendered as such. Fluids will not flow over the edge and arrows get stuck on the invisible wall so clearly some blocks are there but not being shown. If the world is shut down and reloaded, the chunks are now really just air, but any new chunks created will have the invisible bedrock in them.
I am thinking I am trying to do this in the wrong place in the code. A lot of other things seem to depend on the (now invalid) information that this chunk should hold something like a landscape inside it. Where else can I make this change so that it is reversible. Ideally it should just be a single "if" statement to check if the chunk is in my small list of "living" chunks and if not, then just fill it with air.
I have tried looking at how the end is created, but with no luck. The only other place I could think of to look for inspiration is Mystcraft, but that does not seem to be opensource.
Any help would be greatly appreciated.