#Right Click With Item
1 messages · Page 1 of 1 (latest)
Not necessarily an easy way, but it's not super hard either. You can implement right click detection on any item easily, and have the function that gets run by it so a raycast to find the block that's being looked at
We have guides on both ^
Which one would work if I tried to use a wind charge? But not throw it but just right click an item with
Is there a specific reason you want to use a wind charge?
Cuz its like wind, like oxygen for oxidizing copper
Well that's very different from what you asked, because that's a projectile you throw
what would u recommend u think?
or is it possible to detect the blocks to be detected by being hit by it?
Sort of. If you want to use wind charges then you need to make a marker or something ride the wind charge when it gets thrown, and then run a ticking function as and at that marker that checks if it doesn't have a vehicle, then if it doesn't, check the block in front of it to see if it's copper
A little more complex
Do u have any recommendations on how to learn how to do this?
You can change an item's texture btw
Right but I assumed they wanted to use the actual properties of wind charges
By trying to do it and asking for specific help in here on part of the task when you get stuck
ok ty
ok sorry for the stupidity and ignorance but how do i summon 1 marker on the wind charge, cuz i m just thinking putting a summon marker if wind charge is present but i know that would just add hundreds of markers
Well ideally you're only running the function once via an advancement when the wind charge is consumed/used, and that would run a function as and at all nearby wind charges that don't already have a marker passenger. That function would then summon a marker and use the ride command to make it mount the wind charge
ok tysm
"criteria": {
"thrown_wind": {
"trigger": "minecraft:consume_item",
"conditions": {
"player": [],
"item": {
"items": "minecraft:wind_charge"
}
}
}
},
"requirements": [
[
"thrown_wind"
]
],
"rewards": {
"function": "marker_wind"
}
}
would this work?
Give it a try
ok i am super stumped
execute if entity @e[type=wind_charge,nbt=!{Passengers:[{id:"minecraft:iron_golem"}]}] at @e[type=wind_charge,nbt=!{Passengers:[{id:"minecraft:iron_golem"}]}] run summon minecraft:pig ~ ~2 ~ {CustomName:"marker"}
i got this running first
and then this execute if entity @e[type=wind_charge,nbt=!{Passengers:[{id:"minecraft:marker"}]}] at @e[type=wind_charge,nbt=!{Passengers:[{id:"minecraft:marker"}]}] run summon minecraft:marker ~ ~2 ~ {CustomName:"oxidize_marker"}` i have this function going
- Don't check NBT, use a predicate
- What's the relationship between the first and second command? The first one has an iron Golem passenger, but the second looks for a marker passenger?
- You don't need to do
if entity ...and then anat @e...with the exact same target selectors. Just go straight into theat @e - What exactly isn't working?
Oh woops, i was using an iron golem to test it out
and it just kept summoning iron golems
Well that's not the command responsible for summoning iron golems, seems like its spawning either a pig or a totally different marker.
idk why i messed it up so poorly
i just edited and sent it
lemme send the actual thing
/execute if entity @e[type=wind_charge,nbt=!{Passengers:[{id:"minecraft:marker"}]}] at @e[type=wind_charge,nbt=!{Passengers:[{id:"minecraft:iron_golem"}]}] run summon minecraft:marker ~ ~2 ~
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"passenger": {
"type": "minecraft:wind_charge"
}
}
}```
and how is this for the predicate?
Well that is checking if the entity has a wind charge for a passenger, not a marker, and you also aren't actually using the predicate. predicate=!<this predicate id> should replace your nbt=!...
You also didn't do any of the other things I said
sorry for the command i was showing what i was actually using before u said anything
so would
/execute at @e[type=wind_charge,predicate=!wind_check_ride] run summon marker work?
That will summon a marker at the position of every wind charge that doesn't meet the predicate, yes
But you need to instead run a new function as and at it, then summons a marker and then makes that marker ride the wind charge (so it no longer meets the predicate, if you fixed it)
so a function that has an execute for summon, and then after a ride?
No execute necessary for the summon, but yes
Should I add any tags? to either the marker or wind charge?
And what do you mean by run a new function as and at it? sorry for my ignorance
Presumably you'd want them, yes
execute as @e[...] at @s
And would that be for summoning the marker?
That would be how you run the function that summons the marker and makes it ride the wind charge.
oh i thought that this did that
That runs the reward function as the player.
Advancement runs function as and at player -> Function includes command that executes as and at the nearest wind charge without a passenger -> Function summons a marker and makes it ride the wind charge
I cannot be any more plain than that
im so sorry for my ignorance
idk why this sometimes takes so long for me to understand, im sorry
I think i messed up somehow, i did it so it runs a function that says test when i throw a windcharge and nothing comes out
{
"criteria": {
"thrown_wind": {
"trigger": "minecraft:consume_item",
"conditions": {
"item": {
"items": "minecraft:wind_charge"
}
}
}
},
"requirements": [
[
"thrown_wind"
]
],
"rewards": {
"function": "oxidize:marker_wind"
}
}```
then oxidize:marker_wind function just has say test, but nothing
ty for the help btw
Are you able to grant the advancement in chat?
if there is no detection for checking a wind charge being used, would it be easier for it to be any wind charge?
Technically, but do you want it to apply to every wind charge?
it can be, regardless i figured it out u cant detect wind charge consumed via advancements only statistics- so i used that with a scoreboard function
my problem is now trying to figure out how to make it so when it "explodes", it detects that it does and changes the copper blocks to an age later (copper>exposed>weathered>oxidized)
would it be an execute command checking if a marker has no "ride" that it will run a function?
Correct
how could i do that radius splatter of changing blocks tho?
I'd recommend placing a configured feature with the /place command
Probably a disk, maybe a random patch
sorry never used the place command, sorry again about ignorance, would this be a structure i make on my own?
Im looking at the configured feature generator and i am def confused sorry
idk how to achieve this to this
sorry
Just have the marker check nearby blocks to see if they're each of the various copper block states, and if they are, have a chance to change them to the next oxidation level
execute if blocks a bunch of times
so it would be simpler to do a box then like a cricular radius?
so when u mean a bunch of times do u mean for every variant of copper?
Yep
how would i do the chance, sorry again
A random_chance predicate
how would i do the have a change to change them, this is what i have but i feel like this is incorrect and too much /execute if predicate oxidize:random75 run execute if blocks ~2 ~2 ~2 ~-2 ~-2 ~-2 ~ ~ ~ masked at @e[type=marker,tag=throwncharge] run fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:exposed_copper replace minecraft:copper_block
The use of the predicate looks fine
But you never ever need to write run execute. The command runs exactly the same without it, but including it is worse for performance
You probably also need the at @e[...] before the if blocks ...
/execute if predicate oxidize:random75 if blocks ~2 ~2 ~2 ~-2 ~-2 ~-2 ~ ~ ~ masked at @e[type=marker,tag=throwncharge] run fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:exposed_copper replace minecraft:copper_block This didnt seem to work
^^^
Also what is the armor stand for?
oh sorry i changed it so i could see it
there
/execute at @e[type=marker,tag=throwncharge] if predicate oxidize:random75 if blocks ~2 ~2 ~2 ~-2 ~-2 ~-2 106 -58 20 masked at @e[type=marker,tag=throwncharge] run fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:exposed_copper replace minecraft:copper_block
i changed it to this and it kinda works execute at @e[type=marker,tag=throwncharge] if predicate oxidize:random75 at @e[type=marker,tag=throwncharge] run fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:exposed_copper replace minecraft:copper_block
great
But idk if it’s the chance or not but sometimes it just doesn’t do it, after I threw it like 10 times
You're sure you're testing on exposed_copper blocks and not waxed_exposed_copper blocks, or some other exposed copper block variant?
Then you have some logic error somewhere
im guessing tho there is no way to have each individual block go thru the random chance predicate
There is, just means more commands that just replace a single block position
just a lot of setblock?
They would still be fill commands so you can use replace I believe
How would I do that then for 75% for every block?
By having a command for every block that also includes the predicate
like this? /execute at @e[type=marker,tag=throwncharge] if predicate oxidize:random75 run fill ~ ~ ~ ~ ~ ~ minecraft:exposed_copper replace minecraft:copper_block
Yep
this is correct for 75% chance btw right?
{
"condition": "minecraft:random_chance",
"chance": 0.75
}
Yep
for some reason this command only really works if i throw the windcharge below me while i stand on the copper
execute at @e[type=marker,tag=throwncharge] if predicate oxidize:random75 run fill ~-2 ~-2 ~-2 ~2 ~2 ~2 exposed_copper replace copper_block
bump