hello again, i have used the DeferredRegister but the same thing happens.
i have quite literally copypasted the example in the comment:
@Mod(JSONCraft.MODID)
public class JSONCraft
{
public static final String MODID = "jsoncraft";
public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<Block>(ForgeRegistries.BLOCKS, MODID);
public static final DeferredRegister<Item> ITEMS = new DeferredRegister<Item>(ForgeRegistries.ITEMS, MODID);
public static final RegistryObject<Block> EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(Block.Properties.create(Material.ROCK)));
public static final RegistryObject<Item> ROCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties().group(ModItemGroups.MOD_ITEM_GROUP)));
public JSONCraft() {
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
trace:
[13apr2020 13:02:49.166] [modloading-worker-2/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v31.1.19 Initialized
[13apr2020 13:02:49.552] [Render thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: ROCK
Index: 2
Listeners:
0: NORMAL
1: net.minecraftforge.eventbus.EventBus$$Lambda$2081/1783933562@3d5f08d4
2: net.minecraftforge.eventbus.EventBus$$Lambda$2081/1783933562@3afaa39f
java.lang.NoSuchFieldError: ROCK
at network.eden.jsoncraft.JSONCraft.lambda$static$0(JSONCraft.java:36)
at network.eden.jsoncraft.JSONCraft$$Lambda$2220/581639050.get(Unknown Source)
at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:84)
at net.minecraftforge.registries.DeferredRegister$$Lambda$2222/1711574174.get(Unknown Source)
at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:117)
at net.minecraftforge.registries.DeferredRegister$$Lambda$2251/659577981.accept(Unknown Source)
looks like "nearly foolproof" is not enough for me