Started by
P'titeLouise
on
Topic category: Help with Minecraft modding (Java Edition)
I don't know if I put this topic in the right category, sorry ...
So to keep it simple, I spent a good hour researching how to apply an effect when donning armor.
But not just for a single piece of armor!
I would like the effect (fire resistance) to trigger when the armor is fully donned.
Can someone help me please? ^^"
Edited by P'titeLouise on Mon, 07/19/2021 - 10:50
This prosecute for each item
ItemInInventoryTick
If [helm] in armor slot 0
Thanks! ^^
ouh, hold up! armor slot 0 is actually for boots, slot 1 for leggings, slot 2 for chestplate, and slot 3 for helmet. TechTastic, you got it turned around. it should be:
or even better, you can make it more efficient. you don't have to use 4 separate if-statements to check for armor, you can just combine them using "AND" blocks, like so:
that way, there'll be only 1 condition checking for armor, with 4 checks. if only 1 of the checks is true (e.g. only helmet in slot 3 is true), the condition will result to false and it won't execute. and if only 1 of the checks is false (e.g. only boots in slot 0 is true, others are false), it also won't execute. it'll only run the procedure when, and only when, all 4 checks are true and condition is met, which will result to (you guessed it) true. you know this already if you're a programmer, but it isn't that hard of a concept to learn ;)
another thing to add: you can use the global trigger of "on player tick update" for this instead of local "item in inventory tick" for each armor piece. simply create a procedure, click the dropdown button on the green "start" block, and select "on player tick update" from the list. then, add everything else needed in the procedure
Thank you very much, Sajevius! ^^
By the way, I have another question :3
If I want my pickaxe to smelt the block I am mining, what should I do? ;-;
hmm, i've done that before, i made a procedurewhere it drops the smelting result of the block mined if the block can be smelted instead of the block's default drop/s itself and it's quite simple! basically all you need is to create a procedure for your pickaxe's "when block destroyed with tool" trigger, make a local itemstack variable there called "block_item" or whatever you want, then set that itemstack variable to the block at x y z (the one we mined), converted into an item. then, if the itemstack variable (aka the block you just mined, now converted into its block item form) can be smelted, destroy the block at x y z which won't spawn the default drops, and spawn the smelting result of the variable instead (again, it's equivalent to the block mined, when converted to item). looks something like:
really small but really fun procedure ^^ (oh, and it works with modded ores/smeltable blocks too!)
...oh you classic Sajevius. I got it wrong, I can't believe it XD
i meant to say "only boots in slot 0 is false, others are true", sorry for the confusion if any