nbt compound from player's tool has tag "petleash"
set {_n} to string tag "petleash" of nbt compound of player's tool
if {_n} is "null":
target entity is set
owner of target entity is player
cancel event
if name of target entity is not set:
set lore of player's tool to "&eCaptured: %target entity's type% (%target entity's type%)"
else:
set lore of player's tool to "&eCaptured: %name of target entity% (%target entity's type%)"
set {_nbt} to nbt compound of target entity
set string tag "petleash" of nbt compound of player's tool to "%{_nbt}%"
set string tag "captured" of nbt compound of player's tool to "%target entity's type%"
delete target entity
else:
cancel event
set {_e} to string tag "captured" of nbt compound of player's tool
set {_t} to nbt compound from string tag "petleash" of nbt compound of player's tool
spawn {_e} parsed as entity type at player with nbt {_t}
set string tag "petleash" of nbt compound of player's tool to "null"
delete string tag "captured" of nbt compound of player's tool```
The entity is captured as intended and spawns with its nbt, but it spawns at the location you right click it from.
Ping on reply please : )
#Entity spawns at last location
1 messages · Page 1 of 1 (latest)
No like when you right click it to pick it up and then you right click again to place it it spawns at the first right click position
Does that make sense lmao
yeah it does, you want to spawn an entity at the location of the block you clicked
okay :)
ok here
so that's what happens. but you WANT it to spawn at where you click with your leash?
or where do you want it to spawn?
maybe you can make it invisible and silent. that way you preserve its NBT data
it might be that the dog auto teleports because of some AI feature
oooh
wait
that's the problem! when you load in the NBT, it will load the previous location with the NBT. so you need to exclude the location from NBT
uggg
exclude the 'Pos' datatag
any idea on how to do that?
that's a good problem to solve yourself 😊 you should be on the way now