#(Yamie) How to find the block state of the block the player breaks
134 messages · Page 1 of 1 (latest)
(Yamie) How to find the block state of the block the player breaks
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>
there are several tags for note blocks depending on what specifically you want
You dont have to make a thread for any question to the same problem.
how is this the same problem
The last 5ish threads are about making custom blocks with note blocks
You can have one thread for that :D
if i have 1 thread for it after about a day it will never be seen again
that's not true
and threads with active discussion aren't even hidden for us to begin with
And if you resolve a thread to early, it's technically gone for us.
we do lose it when you mark it as resolved
which you seem to do before your actual issue is solved
because alot of the time you guys reference me to tags and stuff that i usually put together myself and figure out how to do it
that's fine, i just wanted to be clear
ig after this thread next time i have a question ill just make 1 thread called "Custom Blocks With Note Block Blockstates" and leave it open
after you mark a thread as resolved, it's highly unlikely that anybody will see it again
is there any way to mark a thread as like currently unused
and then un mark it when i need it again?
You can reopen closed threads at any time yes
use /helpthread to do so
so just have 1 thread and do resolved and then reopen it when i need it
for one specific project, yes, totally fine
(project would be your note block thing)
im probs gonna be working on this 1 project for a long time
anyway i will do that
how am i able to replace the note block drop when i break it in survival depending on what blockstate the note block has?
!e breaks block
Player
player breaks block player breaks <material>
with:<item> to only process the event when the player is breaking the block with a specified item.
when a player breaks a block.
Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.location> returns the LocationTag the block was broken at.
<context.material> returns the MaterialTag of the block that was broken.
<context.xp> returns how much XP will be dropped.
<context.should_drop_items> returns whether the event will drop items.
"NOTHING" to make the block drop no items.
ListTag(ItemTag) to make the block drop a specified list of items.
ElementTag(Number) to set the amount of xp to drop.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
so far i have tried to detect what the block state is and use - drop
determinations ^
check the block and depending on what it is determine a different drop
!guide first world script
View the guide page 'Your First World Script' at: https://guide.denizenscript.com/guides/first-steps/world-script.html
checking through now
im confused on how i use a <> statement to set a variable
- determine <context.should_drop_items> false?
The guide explains how it works
context.tags are just additional tags you can pull information with, from an event
determinations set the outcome of an event, each determination is described in meta
if you - determine nothing the block will drop no items
if you provide a list of items, or a item tag the block will drop that
if you provide a number, the block will drop xp
in an item am i able to define a blockstate?
in one of these
block_drop:
type: item
material: note_block
display name: <&r>Block
cause i know how to define custom model data but cant figure out how to define the note and instrument
Thread is now a Help/Support thread. A helper will check your thread when available.
how would i make a sound play based on what block the player is holding
e.g. they are holding stone and i want the sound to be stone place
or e.g. they are holding a door and i want it to play wood.place
!c playsound
world
playsound (<location>|...) (<player>|...) [sound:<name>] (volume:<#.#>) (pitch:<#.#>) (custom) (sound_category:<category_name>)
Plays a sound at the location or to a list of players.
Plays a sound to a player or nearby players at a location.
The sound is played through the player's client just like any other sounds in Minecraft.
For a list of all sounds, check https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
Sounds are by default played under their normal sound type (eg zombie sounds are under the type Mobs/Animals).
You can optionally instead specify an alternate sound category to use.
For a list of all valid sound categories, check <@link url ht...
Player
player scrolls their hotbar player holds item
item:<item> to only process the event when the player is going to hold a specified item.
when a player scrolls through their hotbar.
Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.new_slot> returns the number of the new inventory slot.
<context.previous_slot> returns the number of the old inventory slot.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
okie dokie ill try it now
im looking to cancel the sound of a note block breaking not play a sound
!m stop_sound
Stops all sounds of the specified type for the player.
Valid types are AMBIENT, BLOCKS, HOSTILE, MASTER, MUSIC, NEUTRAL, PLAYERS, RECORDS, VOICE, and WEATHER
Instead of a type, you can specify a full sound key, which usually has the 'minecraft:' prefix.
If no sound type is specified, all types will be stopped.
PlayerTag
ElementTag
i have this but how do i format it correctly
- adjust <player> stop_sound minecraft:block_wood_break
its underlined but ill try
stop_sound:minecraft:block_wood_break
"stop_sound:minecraft:block_wood_break"
One of these should work fine
it does not work :p

!g quotes
View the guide page 'Common Mistakes - "Quotes Go Around The Whole Argument"' at: https://guide.denizenscript.com/guides/troubleshooting/common-mistakes.html#quotes-go-around-the-whole-argument
You don't need quotes there
what im trying to do is when the player breaks a note block it cancells the original sound and plays a new one, i would just remove the note block break sound as a work around but it just uses the wood break sound
Content of Denizen Script Paste #108556: stuff... pasted 2023/04/07 03:27:57 UTC-07:00, Paste length: 143 characters across 4 lines, Content: control_block_drops: type: world
on runs before the block break happens, so the sound hasn't played yet
!l on vs after
Did you mean to search for script event after vs on?
Modern ScriptEvents let you choose between "on" and "after".
An "on" event looks like "on player breaks block:" while an "after" event looks like "after player breaks block:".
An "on" event fires *before* the event actually happens in the world. This means some relevant data won't be updated
(for example, "<context.location.material>" would still show the block type that is going to be broken)
and the result of the event can be changed (eg the event can be cancelled to stop it from actually going through).
An "after" event, as the name implies, fires *after* the event actually happens. This means data will be already updated to the new state
(so "<context.location.material>" would now show air) but could potentially contain an arbitrary new state from unrelated changes
(for example "<con...
Script Events
so put it in a after player breaks note_block: section
i have this but it dosent seem to work
Content of Denizen Script Paste #108557: block break remove... pasted 2023/04/07 03:30:12 UTC-07:00, Paste length: 181 characters across 5 lines, Content: # Remove vanilla block break soundcontrol_break_sound:
There was a thread with cancelling portal sounds and there was a point that some of the sounds are client-side and you can't really cancel them. If everything okay, that can probably be the case?
Did you tried to stop all the sounds instead of just one?
ive tried on player hears sound:
- determine cancelled
and that didnt work either
Just tried it - enabled rain in the world, stop_sound stopped rain sound for a moment but not a block breaking one. The same will be with the portal, opening a chest and etc, that comes from a server
damn
do you happen to know if there is a way to detect what face of a block the player places a note_block on
It is something about .relative tag, as I remember, but I'm not sure. It'll be better to wait for someone else's answer
ive had icecapade help me but we couldnt rlly figure at a way to do it other than player.direction & player.eye_location.ray_trace[return=normal] which is the old method of directional block placement
im looking to replicate how logs are placed, which is based on what block face you right click on it chages the direction
Actually... I found one thing, but it could not be that helpful as we want... Let me show you
!e player clicks block
Player
this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.
player (right|left) clicks <block>
with:<item> to only process the event if a specified item was held.
using:hand/off_hand/either_hand to only process the event if the specified hand was used to click.
type:<material> to only run if the block clicked matches the material input.
when a player clicks on a block or in the air.
Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.item> returns the ItemTag the player is clicking with.
<context.location> returns the LocationTag the player is clicking on.
<context.relative> returns a LocationTag of the air block in front of the clicked block.
<context.click_type> returns an ElementTag of the Spigot API click type <@link url https://hub.spi...
<context.hand> returns an ElementTag of the used hand.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
<context.relative>
but it seems like you're seeking for an action inside the block placement event
what im doing is when the player right clicks the side of a note_block it removes the note update and sets the side of the block that the player clicked on to the block in the players hand as well as removing 1 item from the players hand the only problem is that when its a directional block like a log it just places it vertically, so what i think i could do is:
compare
<context.location.block>
and
<context.relative.location.block>
and get the value it provides to detect where the block was placed as this will fix it for vanilla blocks as well as i could apply this same logic to when a player clicks a vanilla block which should in theory provide my expected outcome
sorry for the paragraph
- if <context.location> -= <context.relative> == 0,0,1:
how would i compare these 2 numbers
im trying to subtract the second 1 from the first 1 which should result in a 1 block ofset
!t location.sub
Returns the location with the specified coordinates subtracted from it.
math
LocationTag
first, if you are subtracting locations you need to use the tag. bare math symbols arent supported
2nd, a location wont ever just equal 0,0,1 or anything like that. you can compare each of the parts though
!t location.x
Returns the X coordinate of the location.
identity
ElementTag(Decimal)
ie with that
thank you, i will have to try it when i get home
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@muted galleon