Spirit

Spirit

11M Downloads

Iron Golems not spawning correctly

Sniper2580Sam opened this issue ยท 2 comments

commented

Attempted to use a cage with a maxed out soul shard that was filled with iron golems however the spawn rates differ from other mobs? It seems like they spawn must less frequently and the also commonly only spawn a single golem rather than the 9 that was expected.

Additionally when you use a different mob and place the spawner in the air the mobs will spawn in the air and drop to the ground. If you place one with an iron golem in the air, it just will not spawn a golem.

Just a few weird behaviours when putting golem souls in the cages

commented

@Sniper2580Sam I'm not a dev on this project nor does what I'm saying help you in anyway. but this was bugging me too so I did some digging and it looks like it has to do with this line of code:

if ((!tier.ignoreSpawnConditions() && !mob.checkSpawnRules(level, MobSpawnType.SPAWNER)) || !mob.checkSpawnObstruction(level)) {

I cloned the code and ran it manually (I wish I knew how to spawn things in with properties instead of spawning in 90 iron golems and killing them all with a spirit sword with soul reaper 3 and sharpness 5 lolol).

I then changed the code to have lots more logging so now that same line looks like this

                    if (spawned instanceof Mob mob) {
                        boolean notIgnoreSpawnConditions = !tier.ignoreSpawnConditions();
                        boolean mobCantSpawnFromSpawner = !mob.checkSpawnRules(level, MobSpawnType.SPAWNER);
                        boolean canEvenBeSpawned = notIgnoreSpawnConditions && mobCantSpawnFromSpawner;
                        boolean isNotObstructed = !mob.checkSpawnObstruction(level);
                        logger.debug("we have a mob here:notIgnoreSpawnConditions:{} mobCantSpawnFromSpawner:{} canEvenBeSpawned:{} isNotObstructed:{}", notIgnoreSpawnConditions, mobCantSpawnFromSpawner, canEvenBeSpawned, isNotObstructed);
                        if (canEvenBeSpawned || isNotObstructed) {
                            logger.debug("why did we even spawn a mob anyway??!?");
                            this.delay(tier);
                            return;
                        }

                        logger.debug("finalized Spawn of mob");
                        mob.finalizeSpawn(serverLevel, level.getCurrentDifficultyAt(spawned.blockPosition()), MobSpawnType.SPAWNER, null, null);
                    }

the log file shows this

[18:21:23] [Server thread/DEBUG] (Spirit) -.doServerSideThings(level, blockPos)[ServerLevel[world], 3, -57, 3]. nearbyRange: -1
[18:21:23] [Server thread/DEBUG] (Spirit) checking if spawner is turned off: controlledByRedstone: true hasRedstoneSignal: false
[18:21:23] [Server thread/DEBUG] (Spirit) noCollisionForSuggestedSpawnLocation:true x:6.62245653246317 y:-56.0 z:3.226817428889901
[18:21:23] [Server thread/DEBUG] (Spirit) check canSpawn = ignoreSpawnConditions:true || canSpawn:true
[18:21:23] [Server thread/DEBUG] (Spirit) we have a mob here:notIgnoreSpawnConditions:false mobCantSpawnFromSpawner:false canEvenBeSpawned:false isNotObstructed:true
[18:21:23] [Server thread/DEBUG] (Spirit) why did we even spawn a mob anyway??!?

hopefully I can figure out something... maybe to get iron we should just spawn in zombies? not as effective though

commented

ok so with the spawner on teh ground like you said the isObstructed is opposite and I get all the spawns. I had the spawner 3 levels (currently it's at y -60, before it was y-57).. i'll experiment with a few more heights and if I have a trap door on top or not