-1

我正在尝试注册自定义,但出现错误!这是错误The Error

这是我的代码(VS代码):

package modsandmore.cheese.mc;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolItem;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CheeseMC implements ModInitializer {
    
    public static ToolItem CHEESE_SWORD = new SwordItem(CheeseSwordMaterial.INSTANCE, 1, -0.5F, new Item.Settings().group(ItemGroup.COMBAT));
    public static final Item CHEESE = new Cheese(new Item.Settings().group(ItemGroup.MISC).food(new FoodComponent.Builder().hunger(4).saturationModifier(1.5f).alwaysEdible().build()));

    public static final Block CHEESE_BLOCK = new Block(FabricBlockSettings.of(Material.ORGANIC_PRODUCT).strength(0.1f, 0.1f).sounds(BlockSoundGroup.SNOW)).breakByTool(FabricToolTags.SHOVELS);

    public static final Logger LOGGER = LoggerFactory.getLogger("modsandmore");

    @Override
    public void onInitialize() {
        
        Registry.register(Registry.ITEM, new Identifier("modsandmore", "cheese_sword"), CHEESE_SWORD);
        Registry.register(Registry.ITEM, new Identifier("modsandmore", "cheese"), CHEESE);
        
        Registry.register(Registry.BLOCK, new Identifier("modsandmore", "cheese_block"), CHEESE_BLOCK);
        Registry.register(Registry.ITEM, new Identifier("modsandmore", "cheese_block"), new BlockItem(CHEESE_BLOCK, new Item.Settings().group(ItemGroup.MISC)));

    }
}

我很困惑,因为这只是我在 java 中的第二次编码。

Thnaks提前,用户名是用户名

4

0 回答 0