gpt4 book ai didi

java - 为什么我得到 "Unidentified mapping from registry minecraft:block"?

转载 作者:行者123 更新时间:2023-12-02 08:50:54 27 4
gpt4 key购买 nike

我正在学习如何编写 Minecraft mod(版本 1.14.4)并且能够制作一个项目。现在我正在尝试做一个 block 。我正在关注this tutorial video它实际上涵盖了 1.14.3,但我认为它已经足够接近了。

我目前收到此错误:

[20Mar2020 14:09:10.522] [服务器线程/信息] [net.minecraftforge.registries.ForgeRegistry/REGISTRIES]:注册表 block :发现世界中缺少的 id examplemod:examplemod[20Mar2020 14:09:10.613] [服务器线程/错误] [net.minecraftforge.registries.GameData/REGISTRIES]:注册表中的不明映射: block 示例修改:示例修改:676

我还在运行时遇到了这个问题: enter image description here

我尝试过修改注册表的命名方式,但我似乎无法确定问题是什么。也许我没有正确格式化我的 json 文件?

请注意,ItemList 和 BlockList 只是包含我创建的每个 block /项目的静态实例的类。

ExampleMod.java:

// The value here should match an entry in the META-INF/mods.toml file
@Mod(ExampleMod.MOD_ID)
public class ExampleMod
{
// Directly reference a log4j logger.
private static final Logger LOGGER = LogManager.getLogger();

public static final String MOD_ID = "examplemod";

public ExampleMod() {
// Register the setup method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
// Register the enqueueIMC method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
// Register the processIMC method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
// Register the doClientStuff method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
}

private void setup(final FMLCommonSetupEvent event)
{
// some preinit code
LOGGER.info("HELLO FROM PREINIT");
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}

private void doClientStuff(final FMLClientSetupEvent event) {
// do something that can only be done on the client
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
}

private void enqueueIMC(final InterModEnqueueEvent event)
{
// some example code to dispatch IMC to another mod
InterModComms.sendTo(ExampleMod.MOD_ID, "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";});
}

private void processIMC(final InterModProcessEvent event)
{
// some example code to receive and process InterModComms from other mods
LOGGER.info("Got IMC {}", event.getIMCStream().
map(m->m.getMessageSupplier().get()).
collect(Collectors.toList()));
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
// do something when the server starts
LOGGER.info("HELLO from server starting");
}

// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
// Event bus for receiving Registry Events)
@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
public static class RegistryEvents {

@SubscribeEvent
public static void onItemsRegistry(final RegistryEvent.Register<Item> blockItemEvent)
{
ItemList.bomb_item = new Item(new Item.Properties().group(ItemGroup.COMBAT));
ItemList.bomb_item.setRegistryName(new ResourceLocation(ExampleMod.MOD_ID, "bomb_item"));

ItemList.mystery_block = new BlockItem(BlockList.mystery_block, new Item.Properties().group(ItemGroup.MISC));
ItemList.mystery_block.setRegistryName(new ResourceLocation(ExampleMod.MOD_ID, "mystery_block"));

blockItemEvent.getRegistry().registerAll(ItemList.bomb_item, ItemList.mystery_block);

LOGGER.info("Items registered.");
}

@SubscribeEvent
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
BlockList.mystery_block = new Block(Block.Properties.create(Material.CAKE)
.hardnessAndResistance(2.0f, 2.0f)
.sound(SoundType.GLASS));

BlockList.mystery_block.setRegistryName(new ResourceLocation(MOD_ID, "mystery_block"));

blockRegistryEvent.getRegistry().registerAll(BlockList.mystery_block);

LOGGER.info("Blocks registered.");
}
}

}

blockstates/mystery_block.json:

{ “变体”:{ “”:{ “模型”:“examplemod: block /神秘_ block ” } } }

models/block/mystery_block.json:

{ “父”:“ block /cube_all”, “纹理”:{ “全部”:“examplemod: block /神秘_ block ” }}

models/item/mystery_block.json:

{ “父”:“examplemod: block /神秘_ block ”}

最佳答案

这意味着在某个时候您有一个 block 注册为“examplemod:examplemod”,但现在没有。您可以安全地忽略该消息。如果您开始一个新世界而不是打开一个旧世界,您将不会收到该消息。

顺便说一句,HarryTalks 并不是学习 mod 的推荐方法(在 Minecraft Forge forums 上)。显然他使用了一些不好的做法(我实际上没有使用它们)。替代建议是Cadiboo's example mod ,或McJty's tutorials .

关于java - 为什么我得到 "Unidentified mapping from registry minecraft:block"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60779991/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com