Started by
mangamaniacs2064
on
Topic category: Help with MCreator software
here is the picture of what i did
https://serving.photos.photobox.com/32109569d6343994f7bb364b510ce9acfa0…
when i use a global variable it work.. the number seem to increase the variable.. but wheni put it with local variable it doesnt stop
the number burnspeed should be more than 0 so no more text and no more adding gold ingot...
why this doesnt work?
only local variable dont work
A local variable only exists for the instance of that call. So this is what happens:
1. (behind the scene's: Local variable = Null so it is 0)
2. If local variable = 0 do. (which is true)
3. Set local variable to 1.
4. Procedure ends. Local variable gets cleared. Now gets called again:
5. (behind the scene's: Local variable = Null so it is 0)
6. If local variable = 0 do. (which is again true...) etc.
----------------------------
So obviously, you want a local variable that exists for the duration the block/entity/item exists and persists between procedure calls.
This variable you're looking for is called an NBT tag. Either a LOGIC nbt tag (which is true/false) or a number nbt tag.
If you use a block and want to use an NBT tag, make sure to enable inventory as that also allows you to store NBT data (which is basically the local variable you were searching for)
what i want to do is a furnace that takes 5 seconds before giving gold...
just that... after ive done that i will add more recipe etc.. but for testing.. just giving gold ingot after 5 seconds
i thought i would use a local variable to increase by 1 each tick.. but doesnt work
The local variable does work. It increases every tick. However it increases from 0 to 1 every tick. That's because local variables only exist until the procedure ends. At the end the value is (null/) 0 again.
What you mean/need by local variable is called number NBT tag in mcreator. Don't use a local variable. Use a number NBT tag.
can you give me an examplehow to use nbt tag...
for example the number must start from 0 an every tick go +1
when reach 10 do somethings... like add gold ingot or anything
https://ibb.co/fXHL4vk
Can be found in Block Procedures when scrolling down. Do note that when adding a "local variable" (nbt tag) to a block, it needs to have inventory enabled. Set inventory to 0 if you don't want to block to have any slots.
thanks a lot... it worked..
you see i am making a dirt furnace that works with hot_dirt block..