Im trying to prevent blocks from igniting if theyre not flagged with fire_spread_block. Issue is, the context.location returns the location of the fire. Not the location of the block that's on fire. So I tried getting the blocks around the fire using - define locations <context.location.find_blocks_flagged[fire_spread_block].within[1].filter_tag[<[filter_value].material.is_solid>]> I tried multiple values in the within, but all of them give me a very weird result. See the image, the middle block is flagged with the fire_spread_block flag. For some reason, the top left 3 blocks can also get ignited by my fireball, but the other 5 cant??!? The only block thats supposed to be ignited is the middle block, thats flagged. Im confused
#(JustinS) Limited fire spreading (OLD:how to get the blocks attached to a location)
175 messages · Page 1 of 1 (latest)
(JustinS) how to get the blocks attached to a location?
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.
ig .is_within isnt the right tag. Is there another one I could use for this?
what the fuck is going on here
on block ignites:
- define l_up <context.location.add[0,1,0]>
- define l_down <context.location.add[0,-1,0]>
- define l_1 <context.location.add[1,0,0]>
- define l_2 <context.location.add[-1,0,0]>
- define l_3 <context.location.add[0,0,1]>
- define l_4 <context.location.add[0,0,1]>
- define locs <list[<[l_up]>, <[l_down]>, <[l_1]>, <[l_2]>, <[l_3]>, <[l_4]>]>
- foreach <[locs]> as:loc:
- if <[loc].material.is_solid> && <[loc].has_flag[fire_spread_block]>:
- announce "solid loc: <[loc]>"
- stop```
The debugs are making 0 sense. I'm literally getting a list of locations, then looping through it, and the debug is saying that <[loc]> == <[locs]>?!??!?!?!? https://paste.denizenscript.com/View/123431 am I just being stupid here or...?!??!
Content of Server Log Paste #123431: Denizen Debug Logs From A Minecraft Server... pasted 2024/06/03 11:49:23 UTC-07:00, Paste length: 9619 characters across 69 lines, Content: Java Version: 17.0.10Up-time: 6m 15s
(JustinS) debug making 0 sense (OLD: how to get the blocks attached to a location?)
Perhaps you might want to look into the physics event.
You mean this?
Yes.
Could you maybe give an example? I find that event very confusing
Put the event in a test server, and light a block, or wait for firespread. A void/flat world would help.
Yep. Hence a flat world or void world suggestion.
I dont see how this could be very useful
I cant check if it's fire
I simply need to prevent all blocks from catching fire and breaking from fire, except those flagged with fire_spread_block, which should go back in 5 minutes if theyre broken by fire
(JustinS) debug making 0 sense and how to get the blocks attached to a location
!e fire
huh i could've sworn there was a fire spreads event
!e block spread
Group
Block
Event Lines
block spreads
Switches
type:<block> to only run if the block spreading matches the material input.
Triggers
when a block spreads based on world conditions, EG, when fire spreads, or when mushrooms spread, or when vines grow.
Context
<context.source_location> returns the LocationTag of the block that spread.
<context.location> returns the LocationTag of the new block.
<context.material> returns the MaterialTag of the block that spread.
Has Known Location
True - this adds switches in:<area> + location_flagged:<flag name>.
Cancellable
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
yup
Group
Block
Event Lines
<block> burns
Triggers
when a block is destroyed by fire.
Context
<context.location> returns the LocationTag the block was burned at.
<context.material> returns the MaterialTag of the block that was burned.
Has Known Location
True - this adds switches in:<area> + location_flagged:<flag name>.
Cancellable
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
wait so i dont get what's the question here
Let me reformulate
he wants the location of the block the fire is attached to
not the actual fire block location
!t MaterialTag.faces
Returns a list of the current faces for a material that has multiple faces (like a mushroom block).
Output is a direction name like "NORTH".
Group
properties
Returns
ListTag
Mechanism
MaterialTag.faces
The on block burns questions works perfectly fine.
If I use on block ignites, it will only ignite the fire_spread_blocks. WIth some experimenting I found out it takes years before it then finally gets them all. So that doesnt work
And for on block ignites, see what Tek said. I cant get the location working
Might be able to do something with that?
i was thinking flood fill
(To get the block a fire is on)
whats flood fill
Ill give that a try too
oh yeah yes
!t location.flood_fill
Returns the set of all blocks, starting at the given location,
that can be directly reached in a way that only travels through blocks of the same type as the starting block.
For example, if starting at an air block inside an enclosed building, this will return all air blocks inside the building (but none outside, and no non-air blocks).
As another example, if starting on a block of iron_ore in the ground, this will find all other blocks of iron ore that are part of the same vein.
This will not t...
Group
world
Returns
ListTag(LocationTag)
How do I change the face of the fire to a direction though?
you could use that on the fire spreads event, to see if any adjacent blocks are "unflammable" by your rules
The only unflammable blocks are those that are standard unflammable in minecraft or dont have the flag 'fire_spreads_block'
not sure if flood_fill can do that
Because if I have wood and hay next to each other it''ll only get the hay
.
is it possible to remove the fire after it has been burning for 10 seconds?
if its not a flagged block
aya probably has the best answer, use the faces thingie
Tried - announce <context.location.material.faces>
and it narrates "context.location.material.faces"
huh
that should be in the block spreads event
why
the block ignites event usually returns the fire's location with <context.location>
because it's the one that's referring to fire, "block burns" is referring to wood, hay, etc
yeah
!e block ignites
Group
Block
Event Lines
block ignites
Switches
cause:<cause> to only process the event when it came from a specified cause.
Triggers
when a block is set on fire.
Context
<context.location> returns the LocationTag of the block that was set on fire.
<context.entity> returns the EntityTag of the entity that ignited the block (if any).
<context.origin_location> returns the LocationTag of the fire block that ignited this block (if any).
<context.cause> returns an ElementTag of the cause of the event: <@link url https://hub.spigotmc.o...
Has Known Location
True - this adds switches in:<area> + location_flagged:<flag name>.
Cancellable
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
dont you want the face of the fire?
Apparently Im confused on what I want to do with the faces
the LocationTag of the block that was set on fire
you need the location of the fire
it returns the location of the fire
the docs are just wrong there
Already tested that
I tried putting it in on block burns anyways. Same issue
still thinks it's air
right so now it seems both of those events return air
Im lost
!lang on vs after
Possible Confusion
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...
Group
Script Events
it's because you're using on block ignites
it fires before the actual event happens
therefore the location is still air
if no faces then it's just below the location
oh its empty otherwise
now how do I get the block thats facing the face?
Aka how do I convert EAST or WEST into a direction
Tried block_facing
ok so
i didnt really find any tag that lets you convert direction into a normal vector
i tried playing around with raytrace but it seems funky when i raytrace from the fire's location and return a normal vector
so i just made a proc for it
faces_to_normal_vec:
type: procedure
definitions: face
script:
- definemap vectors:
west: 1,0,0
north: 0,0,1
east: -1,0,0
south: 0,0,-1
- determine <[vectors.<[face]>]||null>
...
after block ignites:
- define face <context.location.material.faces.first||null>
- if <[face]> == null:
- announce "Burnt block is below."
- debugblock <context.location.below> players:<server.online_players> d:5s
- stop
- announce "Burnt block is on the side."
- define vec <[face].proc[faces_to_normal_vec]>
- debugblock <context.location.sub[<[vec]>]> players:<server.online_players> d:5s```
the location in the debugblock commands is the block being burnt
not sure if faces can have more values (up/down whatever) so ill leave that for you to discover (i turned off server already)
if they can you can just exclude them i guess
my lord and saviour Tek
it works
the middle 4 were flagged
Determine cancelled didnt work so I used - modifyblock <context.location> air for the on ignite
and I paired it with the on block burns event
Only thing now is, I need to put the broken block back after 5 min. Should be possible
only thing is, for larger structures it takes ages to fully combust
and it doesnt always spread properly
hmm theres a little issue
the flagged blocks behind other blocks cant get ignited 🤔
- define face <context.location.material.faces.first||null>
shouldnt you be foreaching the faces
you mean you didn't know that at listtag.first ;D
Right so I added the foreach, but it doesnt fix this issue
Content of Denizen Script Paste #123432: Unnamed Denizen Script Paste... pasted 2024/06/04 01:06:57 UTC-07:00, Paste length: 1100 characters across 22 lines, Content: fire_spread_handler: type: world
Well Im looking at the block and narrating its flags
but
sure Ill get the debug
alright its getting weirder, bcs why not. I set both 4 front middle blocks on fire. This is what I ended up with after like a minute of burning. What shouldve happened: all 8 middle blocks gone, pretty fast.
https://paste.denizenscript.com/View/123433
Content of Server Log Paste #123433: Denizen Debug Logs From A Minecraft Server... pasted 2024/06/04 01:13:56 UTC-07:00, Paste length: 154641 characters across 1350 lines, Content: Java Version: 17.0.10Up-time: 55m
all middle 8 blocks are flagged with fire_spread_block
you can remove ln 17-20
that if will never run
ill play around w this later more if someone doesnt get to u first
k awesome
hi
looking over this now
is the first event working as you want it to?
Yeah, the burning works
The spreading is just bugging out now and then. See the vids/images
oke ill check it out
Awesome
@strong raven i didnt have a lot of time to test but i can replicate it yeah
it makes me think there's maybe some underlaying conditions or something to do with how fire spread/burning is handled internally
because if you leave off the second part of the script all flagged blocks eventually burn
I'd be fine with fire spreading on other blocks too, as long as it disappears in like 7 seconds, and doesnt combust
But Im not sure if its possible to check how long fire is alive
in seconds
@strong raven hi
the only way i could get this working without fire spreading to the other blocks is to imitate the burning on your own
sorry got distracted
anyway
only middle 4 blocks were flagged
though if you want like, depth to it (say there's 8 blocks flagged, 2x2 on top of each other), you probably want the fire to spread and then manually remove it
I did some more testing and I think I know why I cant light deeper blocks on fire even thought theyre flagged. In the code it mentions:
- foreach <context.location.material.faces> as:face:
- define vec <[face].proc[faces_to_normal_vec]>
- if !<context.location.sub[<[vec]>].has_flag[fire_spread_block]>:
- modifyblock <context.location> air```
Now, if i try setting one of the deeper blocks on fire, usually theres 2 or 3 faces of which a few face a not-flagged block. So I need to somehow check if ALL the faces are facing a non flagged block
instead of just one
Not sure how I would do that to be honest
(JustinS) Limited fire spreading (OLD:how to get the blocks attached to a location)
So I tried changing it to this, to check whether any of the faces are flagged
- if <context.location.material.faces.is_empty>:
- if !<context.location.below.has_flag[fire_spread_block]>:
- modifyblock <context.location> air
- stop
- foreach <context.location.material.faces> as:face:
- define vec <[face].proc[faces_to_normal_vec]>
- if !<context.location.sub[<[vec]>].has_flag[fire_spread_block]>:
- define no_fire_faces:->:<context.location.sub[<[vec]>]>
# If all the faces arent connected to a fire block, stop
- if <[no_fire_faces].size> == <context.material.faces.size>:
- modifyblock <context.location> air```
Still doesnt allow deeper flagged blocks to ignite though
hmm wait it does, sort of. It just doesnt work for standing fires (fires that sit on the block below them)
So I basically need to check if the blocks surrounding the standing fire have a fire spread flag
- if <context.location.material.faces.is_empty> && !<context.location.below.has_flag[fire_spread_block]>:
- modifyblock <context.location> air
- stop```
Alright so I changed it to this, and it seems to work
https://paste.denizenscript.com/View/123490
There's only 1 issue. When all the flagged blocks have burnt, the fire still remains and keeps spreading to where the old fire_spread_blocks were. If the blocks then respawn, they catch fire again, and it loops