RTG compatibility
whichonespink44 opened this issue ยท 11 comments
Hi -
I'm working on a terrain generation mod called RTG, and I'm trying to add support for Vampirism.
The Vampire Forest biome is generating fine, and so are the various mobs, but... the Vampire Castle doesn't seem to like the RTG world type.
Am I right in thinking that the Vampire Castle can only generate in the default world type? If so, is there any way that RTG could generate it manually somehow? Perhaps through the API?
Thanks for your time,
Pink
Hi,
I didn't find a reason why the castle is not generating yet.
Can you provide me with a build in which the Vampire Forest already is working (or does it already work in your current build on curse forge), so I can try out some things?
Thanks,
Maxanier
Sure thing, here's a build of the vampirism-support
branch:
Using that build and Vampirism 0.7.8.4, this seed should spawn you a few meters from a Vampire Forest biome:
-8676017689292570262
Thanks for looking into this - If you need anything else from me, just let me know.
Forgot to mention... depending on the seed, sometimes I would see a message that said something like:
"Vampirism could not find a suitable location for the Vampire Castle... etc."
It doesn't happen with every seed, but even with the seeds that don't have that message, the Vampire Castle still doesn't seem to generate... unless I'm getting extremely unlucky in finding one.
I think there are two separate problems:
First thing is that it seems the vampire forest is generated too rarely. Vampirism checks 128 chunks for the Vampire Forest in a radius of 32 chunks, which probably is a little bit low. But even if I increase that value to 12800 in a range of 9600 chunks it does not find anything.
I also wrote small script/command that checks every second chunk in a given range. I'm not 100% sure it works, but in non realistic world types it seems so. I checked several realistic world types with a radius 100.000 chunks, but even that did not find any biome.
Second thing is that the castle generator needs a large enough area (4x4) to generate.
Here is a build with the latest changes:
Normal Version: https://drive.google.com/file/d/0B-pjZUDQ-WdEZUhYX0Z4YlU3blk/view?usp=sharing
Deobfuscated Version: https://drive.google.com/file/d/0B-pjZUDQ-WdEQXFpVldFV2xpX1E/view?usp=sharing
By the way: If you use Vampirism in a deobfuscated/dev environment, there are a some debug messages.
The command to search is /vampirism checkForVampireBiome
Ok, I think I just found the root issue, unfortunately I have not noticed this earlier:
RTG replaces the Vampirism biome instance by a own version, so the checks like:
ModBiomes.biomeVampireForest.equals(world.getWorldChunkManager().getBiomeGenAt((position.chunkXPos + i << 4)+8, (position.chunkZPos + j << 4)+8))
or instanceof BiomeVampireForest
do not work.
I will think about a solution tomorrow
Ah yes, I see what's happening.
For the equals() check, maybe comparing against biome IDs would work as RTG doesn't change those:
ModBiomes.biomeVampireForest.biomeID.equals(world.getWorldChunkManager().getBiomeGenAt((position.chunkXPos + i << 4)+8, (position.chunkZPos + j << 4)+8).biomeID)
And for the instanceof check... hmm... not sure what to do about that one. I was going to suggest maybe registering a custom biome type to the Vampire Forest, so instead of checking instanceof, Vampirism could check BiomeDictionary#isBiomeOfType(VAMPIRE_FOREST), but... obviously that might not be suitable in all cases.
Ok most things are working now, but Vampirism still cannot find the biome in advance.
I'm using WorldChunkManager#findBiomePosition
for that (here), which needs a biome instance.
One idea might be that Vampirism accepts castle biomes via IMC message. But there might be an easier way, if your world provider overrides that method and either replaces the biomes in the argument list or implements it's own check, it could work.
RTG was already overriding WorldChunkManager#findBiomePosition, but it was hardcoded to always return null for some reason. Probably a legacy stub leftover from before we forked the project.
In any case, it's using the vanilla findBiomePosition() in my dev environment, and I'm now able to use the /vampirism checkForVampireBiome
command successfully, returning accurate coords for the closest Vampire Forest.
Does that mean it should also be working on the startup search as well?
I can also confirm that using the latest 1.7.10 dev build of Vampirism and the latest dev build of RTG, everything seems to be working great. :)
Yes it should.
You can try it out with the new build (with id comparison). Try throwing a "blood eye" after generating a new world, if it flies somewhere there is a castle.
Normal
Dev
As long as it is in a deobfuscated environment it also should something like this on world start:
[Server thread/INFO] [vampirism]: [CastleGenerator]Looking for Positions
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Found position 4 -21
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Found position 5 -21
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Found position 48 -13
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Looking for positions took 25 ms
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Optimizing Position [4, -21][0,0]
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Found fitting area with size 7 at coords 6 -31 (13 -24) after 161 ms
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Optimizing Position [5, -21][0,0]
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Found fitting area with size 7 at coords 6 -31 (13 -24) after 19 ms
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Optimizing Position [48, -13][0,0]
[14:57:14] [Server thread/INFO] [vampirism]: [CastleGenerator]Found fitting area with size 7 at coords 49 -17 (56 -10) after 103 ms
The position coords are displayed in chunks.
Yep, the blood eyes now fly in the direction of the nearest castle. :)
Thanks for all your help with this - is it safe to assume that the new ID comparison will be in Vampirism 0.7.8.5?