Sunconure11 / dungeon-mobs

Dungeon Mobs
Other
7 stars 1 forks source link

Possible fix regarding dungeon mobs in vanilla dungeons #9

Closed Sunconure11 closed 6 years ago

Sunconure11 commented 6 years ago

https://github.com/Lycanite/LycanitesMobs

Lycanites appears to be doing this just fine. Might want to ask the dev.

Sunconure11 commented 6 years ago

Alternatively, you could toy around with these a bit:

return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(rand); DungeonMobs.addDungeonMob(Entity class, float rarity) addDungeonMob(new ResourceLocation("skeleton"), 100); addDungeonMob(new ResourceLocation("zombie"), 200); addDungeonMob(new ResourceLocation("spider"), 100);

BlackJar72 commented 6 years ago

I'm not sure what the questions is. Is it about the problem with spawning from spawners? The problem is that spawners will not spawn mobs if getCanSpawnHere() returns false (for example, slime spawners would only work in spawn chunks below 30y, or in swamps with the right moon phase). I tried fixing this, but the only function that I could get the mob from doesn't exist on dedicated servers (maybe its only used to draw the little mob?) -- so I took it out. Basically, the function I used is still there, but it always returns false for now. That and the options to put them in spawns has been taken out and its variable is just set to false.

Lycanite did find a way to make them work, but I'm not sure how -- I guess we could ask him, or I could look at his code and try to find it. But, I'm not sure when I'd get to that -- I really need to take a step back for a lot of reasons.

BlackJar72 commented 6 years ago

Note that GnomeWorks took out the ability to have the mobs in vanilla spawners, but I put it back in -- before taking it out again.

Again, this is a bit of a guess.

Sunconure11 commented 6 years ago

This is how Lycanite's does it:

https://github.com/Lycanite/LycanitesMobs/blob/master/src/main/java/com/lycanitesmobs/core/worldgen/WorldGeneratorDungeon.java

@lycanite

Lycanite commented 6 years ago

I managed to find a way around this but it's not pretty, I ended up extracting the NBT data from the spawner and then using that like so: https://gitlab.com/Lycanite/LycanitesMobs/blob/master/src/main/java/com/lycanitesmobs/core/entity/EntityCreatureBase.java#L916 You're welcome to copy over that function into your entity class, it essentially just checks for a TileEntityMobSpawner and then if found gets the NBT data and checks for a matching entity ID. Not sure why so much of this class is private as it does make it very awkward. Performance wise there's no issue from what I've found either.

BlackJar72 commented 6 years ago

I was considering getting a stack-trace and trying to see if the function that called it was in the the correct class (MobSpawnerBaseLogic -- or some derivative) -- but I think I'll take a look at that.

Thank you very much for the suggesting. BBL, rush while at lunch now.

BlackJar72 commented 6 years ago

@Lycanite OK, I"ve seen the code -- yes, this definitely the way to do it. Its not far from what I had in mind at first, but I didn't think of getting the NBT for some reason, and so looked for ways to check the mod from the spawner logic (which work in single player....)

Thanks again.

BlackJar72 commented 6 years ago

This should be fixed now.