#non-experimental, custom tnt block + single 64x64 texture

1 messages · Page 1 of 1 (latest)

autumn rain
#

without experimental features, im not sure how to detect if an item is being used on a block. the exploding entity for the tnt block works, but im not sure how to trigger the block despawning and summoning the entity, i tried using an animation controller to check whether the player is using flint and steel, but then i ofc cant detect what block its being used on.

as to the 64x64 texture, i have a single texture in textures/blocks which i defined in terrain_texture.json, but when i map it to the block in blocks.json like so:

{
    "format_version": "1.10.0",
    "sample:custom_tnt_block": {
        "textures": "custom_tnt_block"
    }
}

the whole texture png is applied to each side like in the attached image

quick heart
#

Use a different texture for the top, sides and bottom. Then set those up in material instances.

#

By different I mean separate them into their own texture. I.e. tnt_top.png, tnt_bottom.png and tnt_sides.png. not those names exactly, I think that would just use the vanilla te tures.

#

Use on_interect component with a query.is_item_name_any(item_name) for the condition. Then add the commands or whatever.
I believe that would work. I'm not the best at this.

fiery saffron
autumn rain
autumn rain
fiery saffron
#

Because in the block file itself had material_instances

#

You try remove the texture in block.json and tell us the result

autumn rain
#

i believe material_instances are also experimental and i do not use those

fiery saffron
#

You need that in block file itself and in description you add "is_experimental": false

autumn rain
fiery saffron
#

Bye I take sleep because my time in Philippines is late like 11 pm and good night in my time

autumn rain
#

looks like minecraft:material_instances is experimental

#

gn

fiery saffron
#

Yeah but you add "is_experimental": false at the under the identifier and you try and I read the results tomorrow

autumn rain
#

"is_experimental" only indicates whether it uses experiemntal features or not

#

setting it to false doesnt allow me to use experimental features without holiday creator toggle

fiery saffron
#

Addon is needed that feature

#

And good night

autumn rain
#

no, i am creating a marketplace addon, i cannot use experimental features

fiery saffron
#

You wait other to help you too

#

Bye

hybrid mirage
#

@autumn rain You will need to separate your texture into different files for top, sides and bottom - and then use the blocks.json file as custom models (which would be needed for one single image file) requires experimental.

autumn rain
#

alright, thank you :)

#

can you think of any way to realise custom tnt blocks without holiday features?

#

someone else said something about making it just an entity and not using a tnt block that gets despawned, they said this would be possible by copying the behaviour of the shulker_box entity, but im not sure how to achieve this

bold trout
#

(you should usually do this for any addon system you use)

#

setting the format_version to 1.19.60 would unlock block components like geometry and material_instances

#

however, this still does not allow you to replicate the tnt interaction mechanic

#

for that you would need to use an entity

#

So I would advise moving away from blocks and making it an entity instead. You can make this behavior by using the interaction component in your entity and adding a component group with the explode component

floral gazelle
#

Damn you stole the chance for me to enlighten them with my knowledge

autumn rain
#

thanks for the help so far, i got it to work entirely, the only thing missing is the flashing animation
and tysm for the format_version tip, even if im not using it for material_instances, it still fixed an issue where minecraft:interact wasnt working because the version was too low, lol

#

also, is there a way to make an entity destructible like a block? i dont want the entity to play the hurt animation and sound, but i still need it to die so the loot table gets triggered

bold trout
autumn rain
#

oh that sounds good

#

i already have a damage sensor to disable all incoming damage so the hurt sound doesnt play

bold trout
#

use a damage sensor to first detect when it is attacked, if it is an entity attack, trigger an event that runs a loot command to run your loot table, or if you only want to drop one specific item, you can just use the spawn_entity component

#

after that first trigger, you can list another trigger to disable all other damage

autumn rain
#

could i make an exception so the explosion triggers the from_explosion event in other entities?

#

to simulate exploding tnt setting off other tnts

bold trout
#

you may be able to detect explosion damage

#

and also trigger an event

autumn rain
#

oh neat

#

yep, entity_explosion is a valid cause, awesome

#

ill do it this way then, thank you (:

bold trout
#

np

faint gull
torn crow
#

the block summons the entity that actually explodes

faint gull
#

So the block has a command that summons a somewhat visibly identical entity with explosion behaviour?

Could you link to some documentation on this?

#

Thanks for the reply by the way. Think I picked the wrong block to tinker with to start with.

torn crow
#

not sure about any tutorials tho

#

cant find any rn

faint gull
#

I'll trawl through reference docs. Didn't know a regular block could have a command.

#

I see run_command there. That's super useful. Thanks @torn crow!

torn crow
#

np

autumn rain
#

You can only use a block if you use experimental features though, since the block component is a holiday feature

#

For non experimental, the closest you can get is with two entities, where the block entity can only somewhat mimic block behaviour

faint gull
#

Thanks @autumn rain
Thanks for the heads up.
Could you elaborate a little? Do you have a link to where I can read more about what is and isn't possible without experimental turned on?

I went through the basic MS tutorials and docs on creating custom blocks and the components field was available to use without experimental. I was just doing a custom block though.

I'm a boring world developer just entering the world of MC and trying to link everything together in my head. I'm happy to go the scripting route if needed but think I need to understand this block to entity switcheroo before even going there 🙂

How would you do it with a block and and entity, and how would you do it with 2 entities? I know it depends, but I likely wouldn't need to stack them or construct with them. So maybe your double entity way would be better?

autumn rain
# faint gull Thanks <@588334360542052353> Thanks for the heads up. Could you elaborate a li...

basically, every MS docs page that has the holiday features disclaimer is an experimental feature, everything else should be fine.
i realised they just released some new block components out of experimental, so it might be possible without using 2 entites now, but im not sure

for 2 entities its a little complex, but it works:
one entity would be the tnt block which has a "minecraft:interact" component which triggers an event that adds a placeholder component like "minecraft:illager_captain" so you can check for "query.is_illager_captain" in an animation controller for the tnt. this animation controller simply checks if the player is holding flint and steel with "query.is_item_name_any" and triggers an event with an "on_entry": ["/event entity ..."]
this event adds a component group with "minecraft:transformation" that transforms it into the exploding entity, which simply explodes with "minecraft:explosion" and has the animation for the tnt flashing

#

when using 2 entites there wont be any collision for the block entity of course, but in the entity description you can use "minecraft:runtime_identifier": "minecraft:shulker" to make it mimic some block behaviour

faint gull
#

Yea, I'm trying it with the block now and struggling. Replacing the block with air and summoning the entity when flint and steel is used in it. Unfortunately custom block is just going on fire. I'll play with it a little more as I feel I'm doing something wrong there. I'll try the entity approach next.

At least the entity is working and can be summoned with a command or egg so I'm half way there.

Thanks for the help @autumn rain and @torn crow You've given me far more points in the right direction than I was expecting. I'm very grateful.

autumn rain
#

Sure thing, it really does take some playing around to understand fully how bedrock addons work, at least it took me a bit lol

torn crow
#

*needs toggles

faint gull
#

Thank you @torn crow
Needs toggles means creator holiday etc.?

torn crow
#

yep

faint gull
#

This is what I was using. It didn't work of course.

Is the only way to do this without toggles, with another entity? Happy to spend the time as I'm sure I'll need to do this again.

#

Is this possible using scripting (haven't even looked at scripting yet) but I think I'd be more comfortable in code than working around things in JSON.

autumn rain
#

change event_test to event_ignition in on_interact

faint gull
#

Uggg. That's what I get for copying and pasting.

torn crow
autumn rain
#

most errors are like this, json can be tedious lol

torn crow
#

get_equipped_item_name is deprecated

#

also you dont need "minecraft:collision_box": true,

#

its true by default

faint gull
#

Any params to is_item_name_any? Just query.is_item_name_any() ?

torn crow
#

this would return true if the player was holding flint and steel

faint gull
autumn rain
#

you set it to just "event_ignition" not "exocraft:event_ignition"

faint gull
#

I believe exocraft was where I got some of the sample code. It's not me or my event.

autumn rain
#

doesnt matter, the names just need to match

faint gull
#

Duh.... sorry, I'm completely brain farting here.

#

I'll rename both.

autumn rain
#

no worries, happens to me all the time hahah

faint gull
#

Nope. Still nothing. Now, weirdly, I can only light the TOP of the block with F&S.

Regardless, nothing happens.

Summon commands work great (both sound and entity summon). Added in the target: self to the minecraft:on_interact too but still the same.

Not much info on the reference site.
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/blocktriggers/minecraftblock_on_interact

Any ideas what I could be doing wrong? Could it be I'm being completely dumb about and not understanding the condition? Right clicking with flint and steel should trigger the event, not set fire to the block right?

#

Thanks for being so patient with me, I'm extremely grateful. Not used to this 🙂

faint gull
#

Ok, I was using Bedrock_launcher on linux (don't have a windows machine). I changed the block texture and that didn't change in game so something was off. Even changing the versioning didn't work, despite them being in the development_*_packs.

Moved it to my phone and it worked!

Thank you both so much for your help with this. I'm thrilled and I learned a lot. Your patience is extremely appreciated. My kid will be delighted that he can use a block with his face on it to blow up his Dad's structures.

Any idea if the on_interact method/API is going to make it out of experimental? Where can I see the dev notes or docs on that? Not going to dive into using an 2 x entity workaround unless I have to.

Thanks again @torn crow and @autumn rain , What a fantastic and friendly first interaction I've had here. You folks are amazing.

torn crow
#

Np!

astral sky
bold trout
astral sky
# bold trout There's not really a good way to do that, the simplest may be to create an item ...

I am playing with all sorts of ideas. I may have to have a function file that is looking for floating item and if next to a dispenser (if I can manage that) convert to entity.

But I have 2 new TNT entities and am having fun trying to figure out all the parts, from geo, materials, entity file... because they do not have those parts for it in the vanilla files.

The dispenser does not seem to use the on_placed event of a block. Must be hard coded for TNT to come out entity ready to explode. Still playing with how to get it to shoot as a projectile. Which means an item.

All this because I need to be able to change the blast radius between vanilla, 2x & 3x. I can do it within the one TNT with component groups called by events, something in tick.json and a setting to determine with, but it kinda goes against the recipes. I am doing 1 gunpowder for vanilla, then 2 and 3 respective.

Learning a lot, but kinda frustrating.

#

I will try the entity placer to see if the dispenser can use it