This has so much potential for horror maps! Great video
@InfernalDevice3 күн бұрын
It does make things a lot creepier. :)
@sotoso86803 күн бұрын
Hi, I have a question regarding the removal of items from a player's inventory. I am creating a map in which I want to create a mechanism where, when it starts raining, it removes 50% of all equipment. So let's say I have 8 apples and 4 sticks, I want it to remove these 4 apples and 2 sticks. Do you know how to do this?
@InfernalDevice3 күн бұрын
Hello. :) Sounds a bit tricky. You could count the number of apples using clear 0 and save that to a scoreboard, then divide that scoreboard by 2 and give that many number of apples back, but that would move all the items around, and you would need to do it for every item type in the game, which seems crazy. :) A better way would probably be to loop over every inventory slot using a macro, save the item id to storage and the item count to a score. Then divide the score by 2 and using another macro put the item back with the new count. I don't know how Minecraft deals with a score of 1 being divided by 2, is the result 0 or 1, although I suppose you could add a line like if score = 0 then set it to 1 if you wanted?
@sotoso86803 күн бұрын
@@InfernalDevice Thanks for your answer! I think it is too complicated for me though and I will try to make a different but similar mechanism.
@InfernalDevice3 күн бұрын
@@sotoso8680 I made a note of it and will have a play around at some point. Seems like an interesting thing to try. :)
@InfernalDevice13 сағат бұрын
Hello, I was going to play around with this, and I mentioned my ideas to GalSergey. They answered shortly after with the following, so all credit to them. :D It does the hotbar, inventory and offhand. This won't remove the last item in a slot. # function example:half data remove storage example:data inv data modify storage example:data inv set from entity @s Inventory data remove storage example:data inv[{Slot:100b}] data remove storage example:data inv[{Slot:101b}] data remove storage example:data inv[{Slot:102b}] data remove storage example:data inv[{Slot:103b}] function example:loop_check # function example:loop_check function example:slot_convert with storage example:data inv[-1] execute store result storage example:data clear int -0.5 run data get storage example:data inv[-1].count function example:clear_slot with storage example:data inv[-1] data remove storage example:data inv[-1] execute if data storage example:data inv[-1] run function example:loop_check # function example:slot_convert $data modify storage example:data inv[-1].Slot set value "container.$(Slot)" $execute if predicate {condition:"minecraft:value_check",value:$(Slot),range:-106} run data modify storage example:data inv[-1].Slot set value "weapon.offhand" # function example:clear_slot $item modify entity @s $(slot) example:half_clear # item_modifier example:half_clear { "function": "minecraft:set_count", "count": { "type": "minecraft:storage", "storage": "example:data", "path": "clear" }, "add": true }
@sotoso868013 сағат бұрын
@@InfernalDevice Thank you so much! You have really helped me! :)