Started by
willk55
on
Topic category: Help with MCreator software
Exactly what the title says. I want to run some code when a custom entity is colliding with another entity of the same type. The "Does entity exist in square cube of type" block looks promising, but I'm not sure if this will also target the source entity, and I can't get it to do anything anyways.
You can use Event/Target Entity as the one colliding, and the Source Entity as the one being collided with. Or it may be the other way around I could be wrong.
Either way, just have a procedure that checks if both Event/Target Entity, and the Source Entity are of a specific entity.
Im not sure if you can have it check just to see if they are both the same. But you can have it check if both are zombies specifically, for example.
I'm not sure what you're talking about. Is there an event trigger for when custom entities collide with others? I found a "Player collides with this entity" but it only applies to collisions with the player and it doesn't seem very accurate anyways.
Ah, my bad. Yeah.
In that case, I think the best way would indeed be to use On entity tick update, and then get nearest entity in square cube of _.
Just make sure you use Event/Target Entity for the source entity, as its provided by On entity tick update. And the get nearest entity part for the other entity.
Oh yeah, my bad.
Instead, you should be able to use that get nearest entity of type __ block.
Under the On entity tick update trigger, Event/Target Entity represents the source entity, and the get nearest entity would represent the other entity. So just have it so when it detects a nearby entity, close enough to where they will have to be touching, it does the effects using Event/Target as the source, and Get nearest as the other.
That should work.
Sorry for double post, something glitched and I thought it didnt post the first, so I thought I had to rewrite it.
That's fine, you ended up giving more information :). I tried this:
https://drive.google.com/file/d/11MCOexiGY8tURZldHit9cGWOzNbgczQF/view?usp=sharing
but it doesn't seem to do anything at all; it doesn't even trigger because the entity it finds is itself.
I found a solution:
https://drive.google.com/file/d/193KjtEZXKH7UYcvU_CkZcJsUMmDfWACl/view?usp=sharing
I made a procedure that runs an execute store command that checks if the entity is colliding with another entity of the same type (really just one specific type) and then stores that into a NBT value. It then just returns that value in that tag (I now realize that the if statement was unesacary). To make sure it doesn't get the entity it's checking for, I check that it's id is not the same. My entities were already given a unique id for another thing, so this wasn't hard to add. Here is the text that needs to go into each of the blocks (get everything inside the " "):
"execute store success entity @s ForgeData.colliding byte 1 if entity @e[type=mod_name:mob_name,distance=..0.2,nbt=!{ForgeData:{id:"
"}}]"
To get this to work for your mod/mob, change mod_name:mob_name to their correct values. If your not sure what this is, launch Minecraft and type:
/tp @e[type=
and it should bring up a list of all the possible entity types. Just go down the list and you should eventually find your mob.
Doesn't work
^^^^^^ :(
Bump?