#Delay loyalty + delete armor stand if enchanted trident is no longer there
1 messages · Page 1 of 1 (latest)
The main enchantment summons an armor stand upon hitting a block by running this function below
runes:enchantment/summon_armor_stand:
execute at @s run summon minecraft:armor_stand ~ ~ ~ {Invisible:true,Marker:true,equipment:{chest:{id:"minecraft:chainmail_chestplate",components:{"minecraft:enchantments":{"runes:internal/absorption":1},"minecraft:equippable":{slot:"chest",asset_id:"runes:does_not_exist"}}}}}
runes:internal/absorption
"effects": {
"minecraft:tick": [
{
"effect": {
"type": "minecraft:all_of",
"effects": [
{
"type": "minecraft:explode",
"block_interaction": "none",
"knockback_multiplier": -0.25,
"large_particle": {
"type": "minecraft:block",
"block_state": "minecraft:air"
},
"radius": 5,
"small_particle": {
"type": "minecraft:block",
"block_state": "minecraft:air"
},
"sound": "minecraft:intentionally_empty"
},
{
"type": "minecraft:run_function",
"function": "runes:enchantment/absorption/score_add"
}
]
}
},
{
"requirements": {
"condition": "minecraft:entity_scores",
"entity": "this",
"scores": {
"runes.absorption_explosion": 0
}
},
"effect": {
"type": "minecraft:all_of",
"effects": [
{
"type": "minecraft:run_function",
"function": "runes:enchantment/absorption/after_pulling"
},
{
"type": "minecraft:run_function",
"function": "runes:enchantment/absorption/kill_armor_stand"
}
]
}
}
]
}```
`score_add.mcfunction`
```hs
execute if entity @s[tag=runes.armor_stand] run return fail
tag @s add runes.armor_stand
scoreboard players add @s runes.absorption_explosion 100
after_pulling has some tests, this is not relevant at all because its just what happens after pulling the entities
oh and i forgot to mention, a tick function removes 1 from the explosion score so it works like a cooldown to the after_pulling
the only way to delay loyalty would be to somehow modify the trident entity that is returning. Loyalty is a hardcoded enchantment.
As for the armor stand, you could simply test if there exists any trident within a distance of it and if not run kill.
execute as @e[tag=something,type=armor_stand] unless entity @e[distance=..1,type=trident] run kill @s for example
i know how deleting loyalty would work but not how to implement
i need to store its level, remove it, and after/in the after_pulling return it
but idk when to implement the first two things
ah okay so you want to remove the enchantment somehow so it never starts pulling back at all?
I would instead modify the enchantment itself
hmmm i dont get wdym
but what i want is to delay the loyalty
to delay it i must remove and return it after
(delay loyalty when there is absorption in the trident)
you can make loyalty never return the trident if your enchantment is active on it.
i dont want it to never return
I am not 100% if you could even add a periodic tick to "delay" it
i want it to return after the stand is killed
ah I see
You can easily modify loyalty to have an on-off switch using a score or storage
as for the trident not being there i guess that the most accurate way would be execute as @e[tag=example,predicate=enchantment_check,type=armor_stand] unless entity @e[distance=..1,predicate=enchantment_check,type=trident] run kill
score would be easier to tie to your player
yea but idk how the implementation works
of what?
of the delay
Add requirements?
that would change the return acceleration, so it'd be slower but still return automatically
maybe i could do execute store result score @s test run data get entity @s weapon.components."minecraft:enchantments"."minecraft:loyalty" 1 to store its level
and right after remove the enchantment, but idk what would I do to return it and also that command does not work
you can disable the normal trident return
when your enchantment exists on the trident
how would i return it tho
i want to delay it not disable
delay = storing its level, removing it, wait til the explosion occours, apply loyalty back
i just dont know how to implement this
how would I even store the level?
execute store result <some_where> run data get entity @s item.components."minecraft:enchantments"."minecraft:loyalty"
this is the trident entity btw
for the player it is SelectedItem instead of item
or execute store result <some_where> run data get entity @s SelectedItem.components."minecraft:enchantments"."minecraft:loyalty"
hit block runs as the player iirc
so idk how to find the trident
prob just execute as @n[tag=example,type=trident] run execute store result <some_where> run data get entity @s item.components."minecraft:enchantments"."minecraft:loyalty"
origin = location of hit
so no
it will be the closest trident
as in, the trident at distance 0 (or close to 0)
actually no
@s should be your trident
for hit_block
but you can test that
oh, this makes sense cuz summoning the armor stand at @s summons it at the trident
execute store result score @s runes.store_loyalty run data get entity @s item.components."minecraft:enchantments"."minecraft:loyalty"
item modify entity @s contents runes:enchantment/remove_loyalty
now to return it
i cant think of a way that it wont lose context
oh and I should also store it in a storage since i need to use a macro
just tested this and i got bad news it wont delay the return
it just removes the enchantment for now ig
it is removed, but the return isn't affected, same with requirements that I was hoping might work
also the armor stand kill thing does not work
i mean, it does but kills even when its there
You can remove loyalty using the data command and it won't return, likewise you can add it using data and it will return
are you executing at the armor
it will return
No, it will not
I've tested this myself and is how I made my own trident vaccum enchant which is where void got the idea in the first place
ugh item modifier shenanigans
the modifier did remove it but doesnt disable it
so data remove is the method
how do i remove it?
i managed to write data modify entity @s item.components."minecraft:enchantments"."minecraft:loyalty"
remove not modify
store it somewhere first
i did in a storage
would make sense to store it on the trident itself though
Store it under the trident's data nbt and then just run data modify entity ... item.components."minecraft:enchantments"."minecraft:loyalty" set from entity ... data.<path_to_loyalty_level>
oh?
No need for macros either
ok stored it
is there a way to return it where the trident still being the context entity?
or i should use @n
if you want to delay it, you need to regain context after the delay is done.
^
Easy way to do this is have the enchanted armor stand ride the Trident entity and then execute on the vehicle
Using schedule will lose all execution context, so position, executing entity, etc.
you mean the same armor stand that will pull entities?
Yes
wont it pull entities while flying
Summon the armor stand when the Trident hits a block
Yes
the entity that goes after ride is the one riding the one after mount right?
yes
i tried to return it in the same function that i kill the armor stabd
but didnt work
show your work
execute store result entity @s data.stored_loyalty_level int 1 run data get entity @s item.components."minecraft:enchantments"."minecraft:loyalty"
data remove entity @s item.components."minecraft:enchantments"."minecraft:loyalty"
<summons armor stand>
ride @n[tag=runes.armor_stand_perm,type=minecraft:armor_stand] mount @s
execute on vehicle run data modify entity @s item.components."minecraft:enchantments"."minecraft:loyalty" set from entity @s data.stored_loyalty_level
By didnt work i mean it didnt return
So the enchsntment wasnt there
That's strange, it's not the behavior I'm getting when testing these commands
What happens when you test it?
It returns as expected
🤔
oh it works
i prob forgot to reload or something
to remove the armor stand if theres no trident i can check if the armor stand no longer has a vehicle right?
Yes or just kill it when the Trident returns
oh and also if i get the trident back it does not have loyalty
Odd
well it returns before the armor stand is killed so if i do not wait it wont return what isnt what im lf
i want to return the enchantment if the player picks the trident up again
Atp just make the enchants exclusive then
Why bother with loyalty if it won't work with your enchantment
Unless I'm confusing something here
(I probably am)
what have you understand
Oh yeah no idk what I was thinkinh
Anyways it should just have loyalty on it when it begins to return, if you're getting the return behavior without actually having loyalty on the Trident then idk what would be going on for that to happen
no no i didnt mean that
if i get very close to the trident it returns to me
when this happens the enchantment just vanishes
Ah
You need to change the trident's pickup nbt and revert it when you want it to return
You can do the same thing you did with the enchantment restoration
i set it to a very high value?
oh actually its 1 2 or 0
i assume 1 is true and 0 false? what is 2
I don't remember exactly but they do different things
Pretty sure 2 disables pickup entirely, 1 enables it only for creative mode, and 0 enables it for all modes
Though it's worth checking the wiki for this
im trying but the data page is confusing asf
i think it should be here but idk
looked up in https://minecraft.wiki/w/Entity_format#Entity_format too but i cant find
NVM I was wrong it's the other way around
oh so it must be 0 when it hits a block and 1 when the enchantment returns
i should also add a loyalty check but idk how exaclty
so it does not modify when theres no loyalty
execute if data ...
execute if items ... should also work I think
i grouped some of the lines into a function but i dont think the ride needs to be grouped since it does not matter riding it or no (when there's no loyalty)
grouped these:```hs
execute store result entity @s data.stored_loyalty_level int 1 run data get entity @s item.components."minecraft:enchantments"."minecraft:loyalty"
data modify entity @s pickup set value 0
data remove entity @s item.components."minecraft:enchantments"."minecraft:loyalty"
and changed this:
```hs
execute on vehicle if data entity @s item.components."minecraft:enchantments"."minecraft:loyalty" run data modify entity @s item.components."minecraft:enchantments"."minecraft:loyalty" set from entity @s data.stored_loyalty_level
i guess these are enough, im unsure but yea it might be
it stopped working
when it has loyalty
oh lmao
ok everything's (hopefully) fixed now im just wondering how to kill the armor stand if the trident is not its vehicle anymore
maybe execute as @e[tag=runes.armor_stand,predicate=example,type=armor_stand] run kill and in the predicate ```json
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"vehicle": {
"type": "minecraft:trident"
}
}
}
}