Mod identifies biomes incorrectly
Closed this issue · 7 comments
When I'm standing in a Plains biome, planting Wheat, I start seeing this in the console:
[biomecrops]: growth tick or fertilize event for recognized block minecraft:wheat in biome Coral Reef. Valid biome: false
I had a hunch as to what was going on, so I did some further testing, and deleted the region file I was standing in at my Plains biome farm, and allowed it to regenerate, and it became a Coral Reef biome.
This is because the Plains biome existed in my world as a Plains biome, before I added the Biomes O Plenty mod. So, it makes sense to me that when the terrain is regenerated, it would generate differently… than what was there previously.
That said, is it possible that the BiomesCrops mod is determining the biome for the crop that's being growth-ticked, by the World Seed… as opposed to what biome is actually present in the region file's data?
If true, this would be fatally problematic for all users who wish to use this on an existing world and have added mods that add biomes… and all users who wish to add such mods later on too.
It uses default Minecraft code for that.
val biome = world.getWorldChunkManager.getBiomeGenAt(x, z)
It said Plains when you had the F3 screen open?
Yeah... The F3 info doesn't match the Mod's console output.
Interesting. I'll check what the F3 screen uses.
F3 screen uses:
Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(x, z);
chunk.getBiomeGenForWorldCoords(x & 15, z & 15, mc.theWorld.getWorldChunkManager()).biomeName
Looks like Chunk.getBiomeGenForWorldCoords calls WorldChunkManager.getBiomeGenAt
but has some special post-processing:
public BiomeGenBase getBiomeGenForWorldCoords(int p_76591_1_, int p_76591_2_, WorldChunkManager p_76591_3_)
{
int k = this.blockBiomeArray[p_76591_2_ << 4 | p_76591_1_] & 255;
if (k == 255)
{
BiomeGenBase biomegenbase = p_76591_3_.getBiomeGenAt((this.xPosition << 4) + p_76591_1_, (this.zPosition << 4) + p_76591_2_);
k = biomegenbase.biomeID;
this.blockBiomeArray[p_76591_2_ << 4 | p_76591_1_] = (byte)(k & 255);
}
return BiomeGenBase.getBiome(k) == null ? BiomeGenBase.plains : BiomeGenBase.getBiome(k);
}
So I guess using the Chunk method is preferred. I should probably update Hunger Overhaul with this change as well.
I did a bit more digging, and found that this is what should be used:
world.getBiomeGenForCoords(x, z);
It calls WorldProvider.getBiomeGenForCoords, which calls World.getBiomeGenForCoordsBody, which has the same chunk logic that the F3 screen uses and then calls Chunk.getBiomeGenForWorldCoords.
Thanks a lot for the help!
This one seems to still be happening. http://imgur.com/SpkP0MN
Edit: Disregard. I needed to update my Forge to v1448