Maybe if you summon an invisible mob with no AI, Invulnerable and you leash what you want with it, then you leash the invisible mob with you and tp it between you and what you leash, do you want me to write a function for it ?
Guys, I have a problem with the function I try to make.
Here is my code
I use this to spawn a mob attached to me and a bat with the tag "leashed"
summon chicken ~ ~ ~ {DeathTime:19,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:2147483647,ShowParticles:0b}],DeathLootTable:"minecraft:empty",Tags:["armorLeash"],NoAI:1b,Invulnerable:1b,Leash:{UUIDMost:2L,UUIDLeast:1L}}
data modify entity @e[tag=leashed,limit=1] Leash.UUIDLeast set from entity @e[tag=armorLeash,limit=1] UUIDLeast
data modify entity @e[tag=leashed,limit=1] Leash.UUIDMost set from entity @e[tag=armorLeash,limit=1] UUIDMost
data modify entity @e[tag=armorLeash,limit=1] Leash.UUIDLeast set from entity @s UUIDLeast
data modify entity @e[tag=armorLeash,limit=1] Leash.UUIDMost set from entity @s UUIDMost
and then, this code summon an armorstand between me and the bat, and tp the mob on the armor_stand. But apparently, when I call this function in my every tick function, my invisible mob is killed, and I don't know why :'o
scoreboard objectives add x_leash dummy
scoreboard objectives add y_leash dummy
scoreboard objectives add z_leash dummy
scoreboard players set #deux x_leash 2
execute store result score @s x_leash run data get entity @s Pos[0]
execute store result score @s y_leash run data get entity @s Pos[1]
execute store result score @s z_leash run data get entity @s Pos[2]
execute store result score @e[tag=leashed,limit=1] x_leash run data get entity @e[tag=leashed,limit=1] Pos[0]
execute store result score @e[tag=leashed,limit=1] y_leash run data get entity @e[tag=leashed,limit=1] Pos[1]
execute store result score @e[tag=leashed,limit=1] z_leash run data get entity @e[tag=leashed,limit=1] Pos[2]
scoreboard players operation @e[tag=leashed,limit=1] x_leash -= @s x_leash
scoreboard players operation @e[tag=leashed,limit=1] x_leash /= #deux x_leash
scoreboard players operation @s x_leash += @e[tag=leashed,limit=1] x_leash
scoreboard players operation @e[tag=leashed,limit=1] y_leash -= @s y_leash
scoreboard players operation @e[tag=leashed,limit=1] y_leash /= #deux x_leash
scoreboard players operation @s y_leash += @e[tag=leashed,limit=1] y_leash
scoreboard players operation @e[tag=leashed,limit=1] z_leash -= @s z_leash
scoreboard players operation @e[tag=leashed,limit=1] z_leash /= #deux x_leash
scoreboard players operation @s z_leash += @e[tag=leashed,limit=1] z_leash
summon armor_stand ~ ~ ~ {Invulnerable:1b,Invisible:1b,NoGravity:1b,Tags:["leash_tmp"]}
execute store result entity @e[tag=leash_tmp,limit=1] Pos[0] double 1 run scoreboard players get @s x_leash
execute store result entity @e[tag=leash_tmp,limit=1] Pos[1] double 1 run scoreboard players get @s y_leash
execute store result entity @e[tag=leash_tmp,limit=1] Pos[2] double 1 run scoreboard players get @s z_leash
tp @e[tag=armorLeash,limit=1] @e[limit=1,tag=leash_tmp] kill @e[tag=leash_tmp]
Basically if you want to have an unbreakable lead, leashed bats don't break them, no matter how far they go.
You would just have to teleport the bat to the "fake-leashed" entity, and leash the bat to the player.
However, if you wanted to actually set another lead limit, the greatest challenge would be the collision system : you will have to build that system so the "fake-leashed" mob don't squish into blocks.
And so, I would suggest using Motion tag modifiers instead of teleportation..
Would it be for unlimited leash length, or really "longer but still limited leash limit"?
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
You will have to teleport the "real" leashed entity to the invisible one, which might cause the real one to suffocate and die... I think...
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I'm trying to figure out how to change the maximum length of a lead, suggestions are welcome!
Maybe if you summon an invisible mob with no AI, Invulnerable and you leash what you want with it, then you leash the invisible mob with you and tp it between you and what you leash, do you want me to write a function for it ?
I like trains... OF CHAIN COMMAND BLOCKS !
Guys, I have a problem with the function I try to make.
Here is my code
I use this to spawn a mob attached to me and a bat with the tag "leashed"
and then, this code summon an armorstand between me and the bat, and tp the mob on the armor_stand. But apparently, when I call this function in my every tick function, my invisible mob is killed, and I don't know why :'o
I like trains... OF CHAIN COMMAND BLOCKS !
It's probably because the function isn't executing as or at the player, so @s isn't you and ~ ~ ~ isn't where you are.
Oh yeah sorry, I was tired ^^
I had an execute with condition in my every_tick function but I remove it and forgot to write an "execute as" ^^
So my functions are working ! It's not very beautiful but it do the job !
I like trains... OF CHAIN COMMAND BLOCKS !
Basically if you want to have an unbreakable lead, leashed bats don't break them, no matter how far they go.
You would just have to teleport the bat to the "fake-leashed" entity, and leash the bat to the player.
However, if you wanted to actually set another lead limit, the greatest challenge would be the collision system : you will have to build that system so the "fake-leashed" mob don't squish into blocks.
And so, I would suggest using Motion tag modifiers instead of teleportation..
Would it be for unlimited leash length, or really "longer but still limited leash limit"?
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I don't see the problem.
The fake leashed mob is invulnerable, so even if he tp into block, what problem there will be?
I like trains... OF CHAIN COMMAND BLOCKS !
You will have to teleport the "real" leashed entity to the invisible one, which might cause the real one to suffocate and die... I think...
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
You don't teleport the real one, never
I like trains... OF CHAIN COMMAND BLOCKS !