u/Healthy_Assistance60

Is there a way to execute a function as an end_crystal in the tick it has been shot?

Hi, I am looking to execute command as (or at the position) of an end_crystal that has been shot
I could use proximity to detect if an arrow is close to an end_crystal, and kill them both after running my function. But one of my custom enchants makes arrows from crossbow travels much faster, so it is very unreliable
If there is another, more reliable and multiplayer safe solution, that would help me a ton ^^'

reddit.com
u/Healthy_Assistance60 — 17 hours ago

Need help with making a system to pick values out of a pool

My problem might seem weird but I'll try to explain it as best as I can
To sum it up, I want a function that will roll 3 values between 1 and 8, but I absolutely need them to be mutually exclusive, meaning I don't want any repeating numbers.
This system should also be scalable (meaning that I can roll 7 numbers from my pool of 8 possible values and it should still work with no duplicates)

I have managed to make it work for 2 values with a not very clean solution, however it is not scalable at all and is causing me issues to make it work with 3 values picked.

If anyone have an idea or could explain me how to make this cleanly (and if possible, without any recursions), I would be very grateful!

Here is my current code so far:

# Random rolls (for effect count and type)
execute store result score #hoshi.exodeath.spider_effect_count hoshi.random run random value 2..3


execute store result score #hoshi.exodeath.spider_effect_1 hoshi.random run random value 1..8
execute store result score #hoshi.exodeath.spider_effect_2 hoshi.random run random value 1..7
execute if score #hoshi.exodeath.spider_effect_count hoshi.random matches 3.. store result score #hoshi.exodeath.spider_effect_3 hoshi.random run random value 1..6


execute if score #hoshi.exodeath.spider_effect_2 hoshi.random >= #hoshi.exodeath.spider_effect_1 hoshi.random run scoreboard players add #hoshi.exodeath.spider_effect_2 hoshi.random 1
reddit.com
u/Healthy_Assistance60 — 2 days ago

Issues with Motion NBT data of arrows not working properly

Hi! I'm trying to modify the Motion nbt of an arrow in order to give it more velocity.
Depending on the scale I use, it does eventually work, but most of the time, the arrow will go in a seemingly random direction often towards the ground very rapidly

Here is my current code, if anyone knows what could be the mistake I've made here, I would be very grateful!

# Add tag to arrow depending on enchant level
execute if score  hoshi.enchant.crossbow_fired matches 1.. if items entity  weapon.* *[enchantments~[{enchantments:"hoshi_enchant:velocity",levels:1}]] at  run tag [type=minecraft:arrow,distance=0..2,sort=nearest,limit=1] add VelocityI
execute if score  hoshi.enchant.crossbow_fired matches 1.. if items entity  weapon.* *[enchantments~[{enchantments:"hoshi_enchant:velocity",levels:2}]] at  run tag [type=minecraft:arrow,distance=0..2,sort=nearest,limit=1] add VelocityII
execute if score  hoshi.enchant.crossbow_fired matches 1.. if items entity  weapon.* *[enchantments~[{enchantments:"hoshi_enchant:velocity",levels:3}]] at  run tag [type=minecraft:arrow,distance=0..2,sort=nearest,limit=1] add VelocityIII


# Apply speed changes to tagged arrow
execute as [type=arrow,tag=VelocityI] store result entity  Motion[0] double 0.0007 run data get entity  Motion[0] 2000
execute as [type=arrow,tag=VelocityI] store result entity  Motion[1] double 0.0007 run data get entity  Motion[1] 2000
execute as [type=arrow,tag=VelocityI] store result entity  Motion[2] double 0.0007 run data get entity  Motion[2] 2000


execute as [type=arrow,tag=VelocityII] store result entity  Motion[0] double 0.0009 run data get entity  Motion[0] 2000
execute as [type=arrow,tag=VelocityII] store result entity  Motion[1] double 0.0009 run data get entity  Motion[1] 2000
execute as [type=arrow,tag=VelocityII] store result entity  Motion[2] double 0.0009 run data get entity  Motion[2] 2000


execute as [type=arrow,tag=VelocityIII] store result entity  Motion[0] double 0.001 run data get entity  Motion[0] 2000
execute as [type=arrow,tag=VelocityIII] store result entity  Motion[1] double 0.001 run data get entity  Motion[1] 2000
execute as [type=arrow,tag=VelocityIII] store result entity  Motion[2] double 0.001 run data get entity  Motion[2] 2000


# Delete arrow tag
execute as [type=arrow,tag=VelocityI] run tag  remove VelocityI
execute as [type=arrow,tag=VelocityII] run tag  remove VelocityII
execute as [type=arrow,tag=VelocityIII] run tag  remove VelocityIII


# Reset scoreboard
execute if score  hoshi.enchant.crossbow_fired matches 1.. run scoreboard players set hoshi.enchant.crossbow_fired 0
reddit.com
u/Healthy_Assistance60 — 4 days ago

Is there a way to check if a player is holding up a shield using a predicate?

I'm trying to create a custom enchantment on a shield that would deal back a third of the damage received to the attacker, but I want it to only work when the shield is actively being held up (and not just sitting in the offhand)
I've looked into the entity properties predicates, but I can't find anything that would work as I would like
If anyone knows a solution I'm all ears, thank you!

reddit.com
u/Healthy_Assistance60 — 4 days ago

Making a custom enchantment that replace block drops

Hi, I would like to make a custom enchantment that replaces some block drops when mined by a player.
I have already created the enchant.json file, but I don't know what condition I should choose to run my function. Hit block triggers when the player starts mining, which isn't what I'd like
I am also clueless as to how I can properly replace the block drops to make it multiplayer friendly. If anyone could help I would highly appreciate it : )

reddit.com
u/Healthy_Assistance60 — 5 days ago