Posted April 1, 20232 yr I want my custom mob to spawn high in the sky (like at y-level 192), as it's supposed to be a flying mob. I've noticed that my mob is able to spawn in the air, but only nearby solid blocks at the y-level where I want it to spawn. Here is my code below that listens to the SpawnPlacementRegisterEvent: @SubscribeEvent public static void onSpawnPlacementRegisterEvent(SpawnPlacementRegisterEvent event) { event.register(ModEntityTypes.CUSTOM_MOB.get(), SpawnPlacements.Type.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, CustomMob::checkCustomMobSpawnRules, SpawnPlacementRegisterEvent.Operation.OR); } // (CustomMob::checkCustomMobSpawnRules checks if the BlockPos is in the air) Edited April 1, 20232 yr by LeeCrafts
April 1, 20232 yr First you are telling it to spawn on top of blocks that are not leaves "Heightmap.Types.MOTION_BLOCKING_NO_LEAVES". But I don't think spawning in the air is possible for natural spawns. Even if you wrote your own HeightMap.Types, the code is hardwired to ignore BlockState.isAir(). e.g. see NaturalSpawner.getTopNonCollidingPos() which determines the y location of spawns. In vanilla. flying mobs naturally spawn on the ground. e.g. "slabbing your nether" stops ghast spawns. It's only mob spawners or hardwired things like the dragon fight that can spawn in the air. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
April 1, 20232 yr Author In that case, I guess I would have to manually implement the spawning mechanics (e.g. by subscribing to LivingTickEvent). Thank you for your help. 👍
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.