首页 > 解决方案 > 我正在为自定义食物制作 Minecraft 数据包,但它不工作

问题描述

我是制作 Minecraft 数据包的新手,我有点困惑。

我按照 TimberForge 的教程制作定制食物,当我尝试将食物从 切换minecraft:sweet_berries到 时minecraft:mutton,它突然停止工作。(食用时不给予药水效果)。

我目前在我的 loop.mcfunction 中的代码是:

scoreboard players set @a[nbt={SelectedItem:{id:"minecraft:mutton",tag:{poop:1b}}}] poo_delay 2


#### Run command for effect or any other command or function file if player eats custon item
#### (If the player has recently held the custom item and also just ate the base item)
execute as @a[scores={poo_delay=1..,poo_eat=1}] at @s run effect give @s nausea 10 1
execute as @a[scores={poo_delay=1..,poo_eat=1}] at @s run effect give @s weakness 10 1

#### Reset eat scoreboard
scoreboard players reset @a[scores={poo_eat=1..}] poo_eat
#### Constantly remove 1 from the delay
execute as @a[scores={poo_delay=1..}] unless entity @s[nbt={SelectedItem:{id:"minecraft:mutton",tag:{poop:1b}}}] run scoreboard players remove @s poo_delay 1

我的加载文件有这个:

tellraw @a {"text":"load","color":"yellow"}
    
    #### Scoreboards
    
    # Detect eating the base item
    scoreboard objectives add poo_eat minecraft.used:minecraft.mutton
    # Delay for detecting if player has recently held custom item
    scoreboard objectives add poo_delay dummy
    
video)
    give @a mutton{poop:1b,CustomModelData:1,display:{Name:'{"text":"Kent\'s Fecal Matter","italic":false}'}}

但是这不起作用。当我把所有东西都换回甜浆果时,它就可以了。有谁知道如何修理它?

标签: visual-studio-codeminecraft

解决方案


推荐阅读