Почему я получаю «Неопознанное отображение из реестра minecraft: block»? - PullRequest
0 голосов
/ 20 марта 2020

Я учусь писать моды для Minecraft (версия 1.14.4) и смог создать предмет. Сейчас я пытаюсь сделать блок. Я слежу за этим учебным видео , которое фактически охватывает 1.14.3, но я подумал, что оно будет достаточно близко.

В настоящее время я получаю эту ошибку:

[20Mar2020 14 : 09: 10.522] [Поток сервера / INFO] [net .minecraftforge.registries.ForgeRegistry / REGISTRIES]: Блок реестра: Обнаружен отсутствующий идентификатор из мира examplemod: examplemod [20Mar2020 14: 09: 10.613] [Поток сервера / ERROR ] [net .minecraftforge.registries.GameData / REGISTRIES]: неопознанное отображение из реестра minecraft: block examplemod: examplemod: 676

Мне также представляется это во время выполнения: enter image description here

Я пытался возиться с тем, как я называю реестры, но я просто не могу понять, в чем проблема. Может быть, я неправильно форматирую свои json файлы?

Обратите внимание, что ItemList и BlockList - это просто классы, которые содержат stati c экземпляров каждого созданного мной блока / элемента.

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 / mystery_block "}}}

models / block / mystery_block. json:

{" parent ":" block / cube_all "," textures ": {" all " : "examplemod: block / mystery_block"}}

models / item / mystery_block. json:

{"parent": "examplemod: block / mystery_block"}

1 Ответ

1 голос
/ 24 марта 2020

Все это означает, что в какой-то момент у вас был блок, зарегистрированный как "examplemod: examplemod", а теперь нет. Вы можете смело игнорировать сообщение. Если вы начнете новый мир вместо того, чтобы открывать старый, вы не получите этого сообщения.

Кроме того, HarryTalks не является рекомендуемым способом изучения модов (на форумах Minecraft Forge) ). Видимо, он использует несколько плохих практик (на самом деле я их не использовал). Альтернативные предложения: Пример мод Cadiboo , или Учебники McJty .

...