Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 by LeeCrafts

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.

  • 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. 👍

  • LeeCrafts changed the title to [1.19.3, SOLVED] Make custom mob spawn high in the air

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.