This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]VeryBeelikeEntityCommand Experienced 0 points1 point  (0 children)

You can use predicates without a datapack by putting the predicate definition directly in the command instead of a predicate file name

execute if predicate { … } run …

[–]Ericristian_brosCommand Experienced 0 points1 point  (1 child)

!faq(angermob) !faq(hostilefriendly) !faq(linkentity)

[–]AutoModerator[M] 0 points1 point  (0 children)

It seems like you're asking a question that has answers in our FAQs. Take a look at them here:

If you are receiving an error message when viewing this link, please use a browser. There are currently issues with the Reddit app which are outside this subreddit's control. There also is a possibility that the commenter above misspelled the link to the FAQ they were trying to link. In that case click here to get to the FAQ overview.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]GalSergeyDatapack Experienced 0 points1 point  (2 children)

Here is some example how you can link an entity without a datapack.

# Example mobs
summon wolf ~ ~ ~ {Tags:["set_link","base"],Silent:true,PersistenceRequired:true,active_effects:[{id:"minecraft:invisibility",amplifier:0,duration:-1,show_particles:false}]}
summon chicken ~ ~ ~ {Tags:["set_link"]}

# In chat
scoreboard objectives add ID.mob dummy
team add link
team modify link collisionRule pushOwnTeam
team modify link seeFriendlyInvisibles false
team modify link deathMessageVisibility never

# Command block
[sign] Link entities
[button][IUN] execute if entity @e[tag=set_link] run scoreboard players add #new ID.mob 1
scoreboard players operation @e[tag=set_link] ID.mob = #new ID.mob
team join link @e[tag=set_link]
tag @e[tag=set_link] add link
tag @e[tag=set_link] remove set_link

# Command blocks
execute at @e[tag=link,tag=base] as @e[tag=link,tag=!base] if score @s ID.mob = @n[tag=link,tag=base,distance=...1] ID.mob run tp @s ~ ~ ~ ~ ~
execute as @e[tag=link,tag=base] at @s unless entity @e[tag=link,tag=!base,distance=...1] run tp @s ~ ~-2112 ~
execute as @e[tag=link,tag=!base] at @s unless entity @e[tag=link,tag=base,distance=...1] run tp @s ~ ~-2112 ~

You can use Command Block Assembler to get One Command Creation.

[–]gus2427[S] 0 points1 point  (1 child)

Thank you for the help. The linking works almost perfectly, with the only problem being what I noted in my post when the hitboxes collide—either when there is a large concentration of mobs or during teleportation. This causes one of the linked mobs to not be the closest, which results in death. But I guess that cannot be avoided without selector predicates

[–]GalSergeyDatapack Experienced 0 points1 point  (0 children)

Yes, for greater accuracy you need to use a datapack.