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.

throwawaymodder

Members
  • Joined

  • Last visited

  1. I'm running into an odd issue when right-clicking a custom tile entity to open its container on a server, and no amount of Googling has brought me to a solution. It all works fine in singleplayer, but on a server, no GUI appears, and instead this is logged in the client's debug.log: Neither the server nor the client crashes, and nothing is logged on the server. Here's the relevant code: PackageBlock.Java: public class PackageBlock extends ContainerBlock { ... @Override public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { ... if (!world.isRemote()) { ... TileEntity te = world.getTileEntity(pos); if (te != null && te instanceof PackageTileEntity) { NetworkHooks.openGui((ServerPlayerEntity) player, (PackageTileEntity) te); } return ActionResultType.SUCCESS; } } } PackageTileEntity.java public class PackageTileEntity extends TileEntity implements IInventory, INamedContainerProvider { ... @Override public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) { return new PackageContainer(windowId, playerInventory, this); } ... } PackageContainer.java public class PackageContainer extends Container implements INameable { public PackageContainer(int windowId, PlayerInventory playerInventory) { this(windowId, playerInventory, new Inventory(PackageBlock.INVENTORY_SIZE)); } public PackageContainer(int windowId, PlayerInventory playerInventory, IInventory packageInventory) { super(EnderMailContainers.PACKAGE_CONTAINER, windowId); this.packageInventory = packageInventory; packageInventory.openInventory(playerInventory.player); ...<add slots>... } ... } EnderMailContainers.java @EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD) @ObjectHolder(EnderMail.MODID) public class EnderMailContainers { @ObjectHolder(PackageContainer.NAME) public static final ContainerType<PackageContainer> PACKAGE_CONTAINER = null; @SubscribeEvent public static void onContainerTypeRegistry(final RegistryEvent.Register<ContainerType<?>> event) { event.getRegistry().register(new ContainerType<>(PackageContainer::new).setRegistryName(PackageContainer.NAME)); } } EnderMail.java public void clientInit(FMLClientSetupEvent event) { ... ScreenManager.registerFactory(EnderMailContainers.PACKAGE_CONTAINER, PackageScreen::new); } The entirety of the source code can be found here, if it's needed. Things I've tried: Using player.openContainer instead of NetworkHooks.openGui in PackageBlock.java. The result was the same, except that the player was kicked off the server with a similar error message appearing on the screen before returning to the multiplayer menu: "Internal Exception: io.netty.handler.codec.DecoderException:com.google.gson.JsonParseException: Don't know how to turn {} into a Component." The error logged in debug.log was identical, and nothing was logged on the server. Passing a PacketBuffer argument with the NetworkHooks.openGui call. Same result. Thanks in advance for the help.

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.