Arqade Asked by Crabby Fish on May 13, 2021
So I am extremely immature and want to create a "poop" function in Minecraft Java edition. The problem is, it’s not looping. Here’s my idea: When you run the function, it will wait for the one who run it to crouch. When that happens, it should summon a cocoa bean named "poop" and play a sound. After that, it should not summon another item or play another sound unless it is run again. Here’s the code I wrote for it:
tag @s[tag=!pooping, name=!Server] add pooping
execute if entity @s[name=!Server] run scoreboard objectives add pooperCount dummy
execute if entity @s[name=!Server] run scoreboard players set count pooperCount 0
execute if entity @s[name=!Server] run execute as @a[tag=pooping] run scoreboard players add count entityCount 1
execute if entity @s[name=!Server] run execute if score count pooperCount matches 2.. run tellraw @s {"text": "Only one person can poop at a time"}
execute if entity @s[name=!Server] run execute if score count pooperCount matches 2.. run tag @s remove pooping
execute if entity @s[name=!Server] run scoreboard objectives remove pooperCount
execute unless entity @a[tag=pooping, scores={Sneak=0..}] run scoreboard objectives add Sneak minecraft.custom:minecraft.crouch_one_cm
execute if entity @a[tag=pooping, scores={Sneak=1..}] run summon item ~ ~-1 ~ {Item:{id:"minecraft:cocoa_beans", Count: 1b, tag:{display:{Name:'{"text":"poop"}'}}}}
execute if entity @a[tag=pooping, scores={Sneak=1..}] run playsound block.stone.break player @s
execute if entity @a[tag=pooping, scores={Sneak=1..}] run scoreboard objectives remove Sneak
# just for testing
say hi
execute if entity @a[tag=pooping, scores={Sneak=0}] run schedule function crab:poop 1s replace
Now what actually happens when I run this code (after reloading)?:
The first time I run it: I only say "hi" once, and the Sneak objective is not removed.
The second time depends: If I crouched before running it, the poop is summoned immediately and the sound plays, and the Sneak objective is removed. If I didn’t crouch, nothing is played or summoned, and the Sneak objective is not removed. In both of these cases, I only say "hi" once.
So I guess my looping technique is wrong.
NOTE: Minecraft Version 1.16.5
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP