Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PekkaA

Members
  • Joined

  • Last visited

  1. PekkaA joined the community
  2. Hello everyone! I am working on my first mod, a minimalistic thing that adds a trash bin custom block (The block, the custom gui for the block, recipe, a loot table, block item) to the game. Everything is working in single player, but when I add it to the mods folder of my forge server, I get log messages that loading the recipes and loot tables fails because it doesn't find the items I'm referencing in them. I realise I am likely doing something wrong with where I'm registering the items, like reaching across the sides or something, but I can't figure out exactly what I should be doing differently. The full server log is here https://pastebin.com/z6B0uwh8 but I think this is the relevant part: ... [13:25:38.185] [Server thread/INFO] [minecraft/DedicatedServer]: Preparing level "world" [13:25:38.369] [Server thread/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: trashbin-1.0.0.jar, forge-1.14.4-28.0.45-universal.jar, Default [13:25:38.813] [Server thread/ERROR] [minecraft/RecipeManager]: Parsing error loading recipe trashbin:item_trashbin com.google.gson.JsonSyntaxException: Unknown item 'trashbin:item_trashbin' at net.minecraft.item.crafting.ShapedRecipe.lambda$deserializeItem$0(ShapedRecipe.java:264) ~[?:?] at java.util.Optional.orElseThrow(Unknown Source) ~[?:1.8.0_221] ... ... [13:25:39.048] [Server thread/ERROR] [minecraft/LootTableManager]: Couldn't parse loot table trashbin:blocks/block_trashbin com.google.gson.JsonSyntaxException: Expected name to be an item, was unknown string 'trashbin:item_trashbin' at net.minecraft.util.JSONUtils.func_219793_a(SourceFile:128) ~[?:?] at java.util.Optional.orElseThrow(Unknown Source) ~[?:1.8.0_221] ... ... So it seems to me it's loading the mod but "trashbin:item_trashbin" can't be found because it wasn't registered properly (?). The full source can be found here https://github.com/PekkaAstala/minecraft-mod-trashbin but I think this is the relevant file: @Mod("trashbin") public class TrashbinMod { private static final Logger LOGGER = LogManager.getLogger(); public TrashbinMod() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); MinecraftForge.EVENT_BUS.register(this); } private void doClientStuff(final FMLClientSetupEvent event) { ScreenManager.registerFactory(ModBlocks.TRASHBIN_CONTAINER, BlockTrashbinScreen::new); } @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll( new BlockTrashbin().setRegistryName(Reference.MODID, "block_trashbin") ); } @SubscribeEvent public static void onTileEntityRegistry(final RegistryEvent.Register<TileEntityType<?>> event) { event.getRegistry().register(TileEntityType.Builder.create(BlockTrashbinTile::new, ModBlocks.TRASHBIN).build(null).setRegistryName("tile_trashbin")); } @SubscribeEvent public static void onItemsRegistry(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( new BlockItem( GameRegistry.findRegistry(Block.class).getValue(ResourceLocation.tryCreate("trashbin:block_trashbin")), new Item.Properties() ).setRegistryName(Reference.MODID, "item_trashbin") ); } @SubscribeEvent public static void onContainerRegistry(final RegistryEvent.Register<ContainerType<?>> event) { event.getRegistry().registerAll( IForgeContainerType.create(((windowId, inv, data) -> { BlockPos pos = data.readBlockPos(); return new BlockTrashbinContainer(windowId, Minecraft.getInstance().world, pos, inv, Minecraft.getInstance().player); })).setRegistryName("container_trashbin") ); } } } Could someone help me forward? I have read the basic docs on the forge site about sides and registries but I might need a code example of this being done right or something. Thank you!

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.