How to prevent mobs from spawning on custom block

Started by mobcrafter731 on

Topic category: Help with modding (Java Edition)

Last seen on 17:02, 3. Dec 2022
Joined Jul 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to prevent mobs from spawning on custom block
Mon, 03/01/2021 - 12:34 (edited)

In a custom dimension, the roof and floor of the world is a custom block. I want this block to act like bedrock, where mobs cannot spawn on the block. I don't want there to be tons of mobs on the world's ceiling. How do I make the block do this?

Edited by mobcrafter731 on Mon, 03/01/2021 - 12:34
Last seen on 00:36, 13. Feb 2024
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello @mobcreafter731 I was…
Mon, 01/31/2022 - 00:14

Hello @mobcreafter731

I was trying to do something similar for my own mod, and the solution that ended up working for me is to just make the block's hitbox ever so slightly shorter then a normal block.

So like if a normal block hitbox is 16 pixels tall make your block's hitbox 15.9955 pixels tall instead, this works because mobs can only naturally spawn on full/normal blocks so by making your block slightly less then a full block you can prevent natural spawning entirely!

Hope this helps!!! :D

Last seen on 00:36, 13. Feb 2024
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Edit: I meant bounding box…
Mon, 01/31/2022 - 00:18

Edit: I meant bounding box instead of hitbox, sorry for the confusion! :P