Realistic Terrain Generation

Realistic Terrain Generation

3M Downloads

OceanCraft not fully decorating beaches

LemADEC opened this issue ยท 18 comments

commented

When Realistic world type is selected, OceanCraft won't decorate the beach biomes with seashell and huts.
When Vanilla world type is selected, and RTG is in, it'll work just fine.
This decoration only happens specifically in Beach biomes, you won't see it in rivers notably.

Reproduced with:
Oceancraft-1.7.10-1.4.1
RTG-1.7.10-0.6.2

commented

Thanks for reporting this - we'll take a look and see if we can figure out what's going on.

commented

Confirmed broken. All Oceancraft world decoration is working except the decoration that takes place on beaches. Huts (Including the custom villagers), seashells, and Oceancraft quicksand do not generate. It will be impossible to trackdown where/when Oceancraft does it's decorating and why it's not working because the source isn't available.

Since the source isn't available, the best solution might be to contact the Oceancraft dev and inquire as to how the decoration is done. We could do the decoration ourselves for the shells and quicksand, but there will be a problem spawning the structures, no?

For reference, here's what it's supposed to look like:

The dark coloured sand is Oceancraft quicksand:

commented

Hmm, I have a sneaky feeling that OC will be doing 'instanceof' biome checks or biome 'equality' checks before allowing those decorations to generate, both of which will fail with RTG's biomes.

Those kinds of checks have been the cause of a few mod compatibility issues recently, so rather than keep going back to all of the other mod authors and saying "can you please change the way you check for biomes so RTG can gen your stuff", I'm wondering if there's something that RTG can do to prevent these issues on this end.

In the meantime, I'll see if I can figure out if that's actually what's going on.

commented

As for RTG generating the stuff manually, without the source code or an API, I don't think we could do it.

commented

Can we have RTG biome being child classes of the vanilla ones to work around that kind of checks?

commented

Not easily. They need to be children of the RTG base classes. We'd have to completely refactor the biome setup. Making children of the biome mod classes would also add a lot of dependencies (if they refactor their code, ours becomes bad).

commented

So either they change their code or we ASM their code for them.

Here's an extract from OceanCraft code:

public class WorldGeneratorOceancraft
  implements IWorldGenerator
{
  public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
  {
    switch (world.provider.dimensionId)
    {
    case -1: 
      generateNether(world, random, chunkX * 16, chunkZ * 16);
    case 0: 
      generateSurface(world, random, chunkX * 16, chunkZ * 16);
    }
  }

  private void generateSurface(World world, Random rand, int chunkX, int chunkZ)
  {
...
...
    BiomeGenBase biomegenbase = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
    if (biomegenbase == BiomeGenBase.beach) {
      if (biomegenbase == BiomeGenBase.beach) {
        for (int x = 0; x < Oceancraft.ShellsC; x++)
        {
          int i = chunkX + rand.nextInt(16);
          int k = chunkZ + rand.nextInt(16);
          int j = world.getHeightValue(i, k);
          shell.generate(world, rand, i, j, k);
        }
      }
    }
    if (biomegenbase == BiomeGenBase.beach) {
      for (int x = 0; x < Oceancraft.ShellsC; x++)
      {
        int i = chunkX + rand.nextInt(16);
        int k = chunkZ + rand.nextInt(16);
        int j = world.getHeightValue(i, k);
        shell2.generate(world, rand, i, j, k);
      }
    }
...

Could we just fake the returned value from getBiomeGenAt(), ideally depending on which mods asking it?

commented

Thanks for the code snippet.

I think we should avoid ASM unless absolutely necessary, and I'm not too keen on the idea of mod-specific hacks either (again, unless absolutely necessary).

In this particular case, I think we should first approach the OC devs to see if they'd be willing to consider changing to biome ID comparisons, so from this...

if (biomegenbase == BiomeGenBase.beach) {

to this...

if (biomegenbase.biomeID == BiomeGenBase.beach.biomeID) {

If that's not something they want to do, then maybe we can look at faking the return value from getBiomeGenAt(), but I'm not sure how we'd do it, or if it's even possible.

commented

Thanks for the quick answer!
I've posted on his forum asking for a quick fix.

commented

I've made an appearance on that thread as well, so we'll see what he says.

If he sticks to his word about not updating the 1.7.10 version (and it sounds like he's pretty busy with school, so it's quite likely), then we'll need to explore some of those other options.

commented

There is a risky hack I just thought of: Modify the BiomeGenBase "beach" variable to be our beach. It's risky because some other mod might actually need the real beach there. We actually use it ourselves to get the top and filler blocks although we could obviously deal with it. CC would be OK; I just checked, and it looks like BoP would as well.

commented

Cool, well let's see what thomassu comes back with - hopefully he'll be cool with changing the way he's checking the biomes. If not, then... yeah, it's worth a shot. We can always wrap it in a config option, so if it does cause anyone any problems, they can just disable it and it will use the original BiomeGenBase variable.

commented

Well, it's been almost a month... I don't think thomassu is going to change the way OC is checking biomes. Is it worth doing some ASM voodoo for this, or maybe that static beach variable hack? No one else has mentioned this issue, so it's probably not a priority, but... it really bugs me that RTG isn't fully compatible with OceanCraft.

I might play around with the static beach variable approach and see what kind of effect it has unless there are any other ideas?

commented

Do the static beach hack and if nothing outrageous goes wrong immediately get some megamod guy to test it. Most problems would be specific to particular mods. Definitely use a config option, at least for now, defaulted to off.

commented

Well, I just tried the static beach hack, but it looks like it's not going to be possible because:

The final field BiomeGenBase.beach cannot be assigned

I'm going to try posting in the OC thread one last time before resorting to ASM voodoo.

commented

Just sent a message to thomassu to see if he'll consider changing the way WorldGeneratorOceancraft compares biomes, so... let's see what happens.

commented

Update:

thomassu has replied to my message and said that he will change the way OceanCraft is comparing biomes to ensure full RTG compatibility. So this should be resolved when the next version of OceanCraft is released. ๐Ÿ’ƒ

commented

Fixed in 1f1d7f2