I know 1.7 is out of date and forbidden on the Forge forums, so I'll ask here.
I've been backporting the Guardian to 1.7.10 for inclusion in my mod. Absolutely everything else works: Ocean Monuments spawn, Prismarine exists and shifts color correctly, Sponges work, and the Guardian and Elder Guardians work correctly as far as AI, attack beam, swimming, thorns effect, mining curse, and loot drops; and three Elder Guardians spawn inside the Monuments as they're supposed to. Even the spawn egg and command work and the Guardian's eye follows you like it's supposed to. Essentially I tried to bring over the 1.8 code as faithfully as possible.
The one thing that I'm stuck on is actually getting the Guardian to spawn naturally in and around the Monument. Guardians are unlike any other mob in 1.7 because they spawn in water but are not EntityWaterMobs like Squids. They also spawn with regard to a specific structure similar to Nether Fortresses and Witch Huts, so I can't just do:
Because that entry already exists in my StructureOceanMonument() class as it should, and doing the above just adds it again. Of course, this doesn't mean anything if StructureOceanMonument's spawn list is never called by Minecraft.
In 1.8 the Monument is referenced directly in ChunkProviderGenerate:
so I don't think I can modify this without somehow replacing ChunkProviderGenerate's functionality, but I don't want to replace vanilla behavior in case other mods need to access it for some reason, if that makes sense.
If I create a Guardian spawner cage, it spawns them correctly both above ground and underwater, as the spawning rules dictate.
I've found threads and tutorials on how to make mobs spawn in already-existing structures such as the Nether Fortress, which I proved to myself by making the Guardian generate in one. But despite looking around, I couldn't find a mod that registered a custom mob for random spawning within in a custom structure.
So: what do I need to do to get Guardians to spawn only in and around the Monument as they should?
Special thanks to Jabelar, whose tutorials and examples helped me over the years. Without your work, I might not have created all the other stuff in my mod that I didn't mention.
I still don't know the answer to this, but the answer doesn't matter.
Guardians need to spawn in water. Vanilla Minecraft has four spawn types: monster, creature, ambient, and waterCreature. Only monster is aggressive, and only waterCreature spawns in water.
I stumbled upon this thread where I learned how to make my own spawn type.
I made an event listener class that initializes this new type:
//creatureClass, maxNumberofCreature, creatureMaterial, isPeacefulCreature, isAnimal
// Here I called the monster max number explicitly (70)
public static final EnumCreatureType waterMonster = EnumHelper.addCreatureType("waterMonster", IMob.class, EnumCreatureType.monster.getMaxNumberOfCreature(), Material.water, false, false);
I have a @SubscribeEvent for WorldEvent.PotentialSpawns to identify when monster or waterMonster types spawn. Guardians are supposed to count as monsters, so I add up how many of both types exist in the world and calculate the spawn cap, canceling any spawns of either type when the cap is reached:
/**
* This method actively cancels creature types "monster" and "waterMonster" from spawning
* if their collective sum is greater than the spawn cap for type "monster."
*
* Called by WorldServer to gather a list of all possible entities that can spawn at the specified location.
* If an entry is added to the list, it needs to be a globally unique instance.
* The event is called in WorldServer#spawnRandomCreature(EnumCreatureType, int, int, int)
* Canceling the event will result in a empty list, meaning no entity will be spawned.
*/
@SubscribeEvent(receiveCanceled=true)
public void guardianSpawnerAndCap(WorldEvent.PotentialSpawns event) {
// Here I'm going to tally up all the MONSTER and WATERMONSTER types
// total monsters in world
int countMonsterType = event.world.countEntities(EnumCreatureType.monster, true);
// total waterMonsters (Guardians) in world
int countWaterMonsterType = event.world.countEntities(waterMonster, true);
// Here I count the number of eligible spawning chunks
if (
(event.type == EnumCreatureType.monster || event.type == waterMonster)
&& this.capMonsterSpawns(event.world, countMonsterType, countWaterMonsterType, true, true)
)
{ // Cap the number of spawns per chunk for monster and waterMonster, collectively
event.setResult(Result.DENY);
event.setCanceled(true);
}
if ( // If the attempted spawn is a waterMonster, check if the spawn is in water and inside the BB of a Monument.
event.world.getWorldInfo().getVanillaDimension() == 0
&& event.world.getWorldInfo().isMapFeaturesEnabled()
&& event.type == waterMonster
&& GeneralConfigHandler.addOceanMonuments
&& isIntersectingWithAnyMonument(event)
)
{
// Populate the waterMonster spawn list with the Monument spawn list (a group of 2-4 Guardians)
this.getPossibleMonumentCreatures(event);
}
}
The isIntersectingWithAnyMonument method goes through the world list of already-generated Monuments and determines whether the attempted spawn point is within the any Monument's bounding box
/**
* Inputs WorldEvent.PotentialSpawns event, and determines whether the x, y, z in that event
* falls within the bounding box of ANY generated Monument structure
*/
public boolean isIntersectingWithAnyMonument(WorldEvent.PotentialSpawns event)
{
MapGenStructureData structureData;
if (event.world.provider.dimensionId==0) { // Player is in the Overworld
try {
structureData = (MapGenStructureData)event.world.perWorldStorage.loadData(MapGenStructureData.class, "Monument");
NBTTagCompound nbttagcompound = structureData.func_143041_a();
Iterator itr = nbttagcompound.func_150296_c().iterator();
//LogHelper.info("Monument list size: " + nbttagcompound.func_150296_c().size());
while (itr.hasNext()) {
Object element = itr.next();
NBTBase nbtbase = nbttagcompound.getTag(element.toString());
if (nbtbase.getId() == 10) {
NBTTagCompound nbttagcompound2 = (NBTTagCompound)nbtbase;
try {
int[] boundingBox = nbttagcompound2.getIntArray("BB");
// Now check to see if the spawn entity is inside the monument
if (
event.x >= boundingBox[0]
&& event.y >= boundingBox[1]
&& event.z >= boundingBox[2]
&& event.x <= boundingBox[3]
&& event.y <= boundingBox[4]
&& event.z <= boundingBox[5]
) {
// Spawn event is inside bounding box.
return true;
}
}
catch (Exception e) {
LogHelper.warn("Failed to evaluate Monument bounding box");
}
}
}
}
catch (Exception e) {
// This fails when the Monument list is empty (i.e. none have been generated).
}
}
return false;
}
while the getPossibleMonumentCreatures method imports the hard-coded Monument spawn list (naturally, only Guardians) and unpacks them into the SpawnListEntry:
Now, a fair amount of Guardians spawn in and around Monuments, and only there. Elders spawn just fine because they're programmed to appear only during Monument construction, and I still need to write code to ensure that Guardians automatically spawn alongside new Monuments, but the groundwork is done.
/**
* Returns a list of creatures of the specified type that can spawn at the given location.
*/
public void getPossibleMonumentCreatures(WorldEvent.PotentialSpawns event)
{
//BiomeGenBase biomegenbase = event.world.getBiomeGenForCoords(event.x, event.z);
List monumentMonsters = StructureOceanMonument.getMonsters();
event.list.clear();
for (int i=0; i < monumentMonsters.size() ; i++ )
{
event.list.add( (BiomeGenBase.SpawnListEntry)monumentMonsters.get(i) );
}
}
Finally, the capMonstersSpawns tallies up the number of Guardians and compares them to the number of "monster" mobs in the world. Guardians are supposed to be a "monster" type, after all. I pretty much copied the code over from net.minecraft.world.SpawnerAnimals:
public boolean capMonsterSpawns(World worldIn, int typeMonsterCount, int typeWaterMonsterCount, boolean spawnHostileMobs, boolean spawnPeacefulMobs)
{
if (!spawnHostileMobs && !spawnPeacefulMobs)
{
return true; // Neither hostile nor peaceful mobs are allowed
}
else
{
this.eligibleChunksForSpawning.clear();
int playerInd;
int playerChunkZ;
for (playerInd = 0; playerInd < worldIn.playerEntities.size(); ++playerInd)
{
EntityPlayer entityplayer = (EntityPlayer)worldIn.playerEntities.get(playerInd);
int playerChunkX = MathHelper.floor_double(entityplayer.posX / 16.0D);
playerChunkZ = MathHelper.floor_double(entityplayer.posZ / 16.0D);
byte chunkRadius = 8;
for (int searchCX = -chunkRadius; searchCX <= chunkRadius; ++searchCX) // l checks the chunks from -8 to +8 around the player in the X direction
{
for (int searchCZ = -chunkRadius; searchCZ <= chunkRadius; ++searchCZ) // i1 checks the chunks from -8 to +8 around the player in the Z direction
{
boolean isOnSearchBoundary = searchCX == -chunkRadius || searchCX == chunkRadius || searchCZ == -chunkRadius || searchCZ == chunkRadius;
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(searchCX + playerChunkX, searchCZ + playerChunkZ);
if (!isOnSearchBoundary)
{
this.eligibleChunksForSpawning.put(chunkcoordintpair, Boolean.valueOf(false));
}
else if (!this.eligibleChunksForSpawning.containsKey(chunkcoordintpair))
{
this.eligibleChunksForSpawning.put(chunkcoordintpair, Boolean.valueOf(true));
}
}
}
}
if (
spawnHostileMobs &&
(typeMonsterCount+typeWaterMonsterCount) > EnumCreatureType.monster.getMaxNumberOfCreature() * this.eligibleChunksForSpawning.size() / 256
)
{
return true; // "Monster" type cap is reached
}
else return false; // Monster cap is not yet reached
}
}
If there's a better way to do the above, or a better way to clean it, please let me know. But preliminary tests seem to indicate that things are working as intended.
The Meaning of Life, the Universe, and Everything.
Location:
Germany
Join Date:
12/12/2015
Posts:
95
Location:
Germany
Minecraft:
DelirusCrux
Member Details
Wait... you managed to backport the Guardianmob? I know it's offtopic, but did you release the mod? I was searching for a very long time for a mod that did this.
Wait... you managed to backport the Guardianmob? I know it's offtopic, but did you release the mod? I was searching for a very long time for a mod that did this.
Yes, I did backport it! It will be going into Version 3 of my mod, Village Names. Monuments are already in that mod as of Version 2 from Oct 2017. As far as I can tell, nobody has backported the Monument properly by copying vanilla generation. The couple attempts I've seen just load the whole structure in from a template, which leaves no room for modular changes.
The V3 update is taking a while because I'm re-writing my legacy code and adding in a bunch of new features. If you go follow the project, you'll know as soon as I release the update.
On a slightly unrelated note, you can browse through my Imgur gallery documenting the steps it took for me to get the thing working.
If you choose to download V2 of Village Names in the meantime, you can generate Monuments (without Guardians of course). But don't worry—I'm making sure that V3 will retro-gen the Elder Guardians.
Oh yeah you're the author of village names I know this mod and I love it. Didn't look at your banner, was to exited for guardians
Thanks, I'm flattered! And no, it's not your fault—I decided to add the banner right after replying to you. That space under my messages needed some attention.
The Guardian has been done for a few weeks now. The reason I have not released the mod yet is that I'm still adding stuff. I'm much more comfortable with Java now, so I've been re-writing the most complex core functionality from scratch so that I can add in the new features.
@AstroTibs, I've been thoroughly enjoying your series 'Galaxy Odyssey'.
Hey thanks MadHat! I haven't uploaded in a long time because I've been working on V3 of Village Names. Once that's finished, I can keep the series forward.
Hey! Did you release the v3 of the mod? I would like to get guardians in 1.7.10
Not released, but it will be soon! Once I finish the 1.12 version, I'll update them all in one go. It should have been finished earlier this week, but 1.12 has thrown me some interesting curve balls which have slowed down progress.
If you're talking about the pink doors with heart icons, those are Eucalyptus doors from Natura, I think. Later doors that I wind up using are carpenters doors textured with whatever I think looks good.
The Meaning of Life, the Universe, and Everything.
Location:
Germany
Join Date:
12/12/2015
Posts:
95
Location:
Germany
Minecraft:
DelirusCrux
Member Details
Sorry to write in this thread with offtopic again, but @MadHatAk am I right with my assumption that you are searching for a mod that adds doors for BoP?
Sorry to write in this thread with offtopic again, but @MadHatAk am I right with my assumption that you are searching for a mod that adds doors for BoP?
Please don't view this post as an advertisement for that mod.
Sweet Jeebus, Yaaaaas! That will work too. I work ALOT in 1.7.10 with mainly just my Mod, and Pam's but, after watching @AstroTibs Galaxy Odyssey Series, I'm sold on BOP, and TC.
I know 1.7 is out of date and forbidden on the Forge forums, so I'll ask here.
I've been backporting the Guardian to 1.7.10 for inclusion in my mod. Absolutely everything else works: Ocean Monuments spawn, Prismarine exists and shifts color correctly, Sponges work, and the Guardian and Elder Guardians work correctly as far as AI, attack beam, swimming, thorns effect, mining curse, and loot drops; and three Elder Guardians spawn inside the Monuments as they're supposed to. Even the spawn egg and command work and the Guardian's eye follows you like it's supposed to. Essentially I tried to bring over the 1.8 code as faithfully as possible.
The one thing that I'm stuck on is actually getting the Guardian to spawn naturally in and around the Monument. Guardians are unlike any other mob in 1.7 because they spawn in water but are not EntityWaterMobs like Squids. They also spawn with regard to a specific structure similar to Nether Fortresses and Witch Huts, so I can't just do:
because it identifies only the biome. Doing this causes it to spawn only out of water and underground anyway.
It also doesn't help to add to spawn lists via:
Because that entry already exists in my StructureOceanMonument() class as it should, and doing the above just adds it again. Of course, this doesn't mean anything if StructureOceanMonument's spawn list is never called by Minecraft.
In 1.8 the Monument is referenced directly in ChunkProviderGenerate:
so I don't think I can modify this without somehow replacing ChunkProviderGenerate's functionality, but I don't want to replace vanilla behavior in case other mods need to access it for some reason, if that makes sense.
If I create a Guardian spawner cage, it spawns them correctly both above ground and underwater, as the spawning rules dictate.
I've found threads and tutorials on how to make mobs spawn in already-existing structures such as the Nether Fortress, which I proved to myself by making the Guardian generate in one. But despite looking around, I couldn't find a mod that registered a custom mob for random spawning within in a custom structure.
So: what do I need to do to get Guardians to spawn only in and around the Monument as they should?
Special thanks to Jabelar, whose tutorials and examples helped me over the years. Without your work, I might not have created all the other stuff in my mod that I didn't mention.
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.
I still don't know the answer to this, but the answer doesn't matter.
Guardians need to spawn in water. Vanilla Minecraft has four spawn types: monster, creature, ambient, and waterCreature. Only monster is aggressive, and only waterCreature spawns in water.
I stumbled upon this thread where I learned how to make my own spawn type.
I made an event listener class that initializes this new type:
I have a @SubscribeEvent for WorldEvent.PotentialSpawns to identify when monster or waterMonster types spawn. Guardians are supposed to count as monsters, so I add up how many of both types exist in the world and calculate the spawn cap, canceling any spawns of either type when the cap is reached:
The isIntersectingWithAnyMonument method goes through the world list of already-generated Monuments and determines whether the attempted spawn point is within the any Monument's bounding box
while the getPossibleMonumentCreatures method imports the hard-coded Monument spawn list (naturally, only Guardians) and unpacks them into the SpawnListEntry:
Now, a fair amount of Guardians spawn in and around Monuments, and only there. Elders spawn just fine because they're programmed to appear only during Monument construction, and I still need to write code to ensure that Guardians automatically spawn alongside new Monuments, but the groundwork is done.
Finally, the capMonstersSpawns tallies up the number of Guardians and compares them to the number of "monster" mobs in the world. Guardians are supposed to be a "monster" type, after all. I pretty much copied the code over from net.minecraft.world.SpawnerAnimals:
If there's a better way to do the above, or a better way to clean it, please let me know. But preliminary tests seem to indicate that things are working as intended.
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.
Wait... you managed to backport the Guardianmob? I know it's offtopic, but did you release the mod? I was searching for a very long time for a mod that did this.
Nether Biomes for 1.7.10: Netherlicious
Yes, I did backport it! It will be going into Version 3 of my mod, Village Names. Monuments are already in that mod as of Version 2 from Oct 2017. As far as I can tell, nobody has backported the Monument properly by copying vanilla generation. The couple attempts I've seen just load the whole structure in from a template, which leaves no room for modular changes.
The V3 update is taking a while because I'm re-writing my legacy code and adding in a bunch of new features. If you go follow the project, you'll know as soon as I release the update.
On a slightly unrelated note, you can browse through my Imgur gallery documenting the steps it took for me to get the thing working.
If you choose to download V2 of Village Names in the meantime, you can generate Monuments (without Guardians of course). But don't worry—I'm making sure that V3 will retro-gen the Elder Guardians.
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.
Oh yeah you're the author of village names I know this mod and I love it. Didn't look at your banner, was to exited for guardians
Nether Biomes for 1.7.10: Netherlicious
Thanks, I'm flattered! And no, it's not your fault—I decided to add the banner right after replying to you. That space under my messages needed some attention.
The Guardian has been done for a few weeks now. The reason I have not released the mod yet is that I'm still adding stuff. I'm much more comfortable with Java now, so I've been re-writing the most complex core functionality from scratch so that I can add in the new features.
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.
Hey! Did you release the v3 of the mod? I would like to get guardians in 1.7.10
@AstroTibs, I've been thoroughly enjoying your series 'Galaxy Odyssey'.
Hey thanks MadHat! I haven't uploaded in a long time because I've been working on V3 of Village Names. Once that's finished, I can keep the series forward.
Not released, but it will be soon! Once I finish the 1.12 version, I'll update them all in one go. It should have been finished earlier this week, but 1.12 has thrown me some interesting curve balls which have slowed down progress.
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.
@AstroTibs by chance what mod were you using for the doors in your video? Am I correct that they're made from the Trees found in Biome's O' Plenty?
If you're talking about the pink doors with heart icons, those are Eucalyptus doors from Natura, I think. Later doors that I wind up using are carpenters doors textured with whatever I think looks good.
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.
Sorry to write in this thread with offtopic again, but @MadHatAk am I right with my assumption that you are searching for a mod that adds doors for BoP?
If yes I found one a few years ago. https://minecraft.curseforge.com/projects/doors-o-plenty
Please don't view this post as an advertisement for that mod.
Nether Biomes for 1.7.10: Netherlicious
I actually might grab that for my own use, thanks!
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.
Sweet Jeebus, Yaaaaas! That will work too. I work ALOT in 1.7.10 with mainly just my Mod, and Pam's but, after watching @AstroTibs Galaxy Odyssey Series, I'm sold on BOP, and TC.
Once my mod is updated, I might actually organize and release my modpack. I put a load of work into balancing things in it.
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.
Village Names 3.0 is done and uploaded! Click the link in my signature to go right to the project page, where you can read about/see the new features.
Happy Easter!
Check out my survival series, Galaxy Odyssey. You can download the modpack on the Technic launcher here!
My series also incorporates my mods: Village Names, ChocoCraft Plus, Not Enough Pets, and ASMC.