Check if entity is near/exist within specific block?

Started by Red-Eyed_Fairace on

Topic category: Help with Minecraft modding (Java Edition)

Active 2 years ago
Joined Nov 2021
Points:
439

User statistics:

  • Modifications: 1
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 25
Check if entity is near/exist within specific block?

I know there's a procedure that checks if an entity is near or exist. 

But is it possible to make it check to block instead of another Entity?

Currently for my titans mod, I've made them have custom spawning condition, it does work, they spawn only on day when not raining but custom spawning conditions like that bypasses mod like "no Hostile around campfire". I know how to check for a block, but is it possible to combine the two in that way they wont spawn near campifre?

Currently I use ItemFrame as an alternative to prevent titans spawning inside my walled City (It's classified as entity on Mcreator somehow, same goes for ArmorStand)
ItemFrame

I dont mind editing the code itself if procedures dont work for it if anyone has any idea.

Active 2 weeks ago
Joined Jul 2019
Points:
634

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 4
maybe somthing like player…
Mon, 08/05/2024 - 20:59

maybe somthing like player tick update
 
if does entity exist at x y z in square cube size with 48 of type camp fire
do set custom number nbt "spawning" to 0 

else set custom number nbt "spawning" to 1

on a new player tick update do.

if get custom number nbt "spawning" = 1 do
then your spawning code