Posted April 27, 20205 yr 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: Spoiler [26Apr2020 21:11:45.761] [Render thread/FATAL] [net.minecraft.util.concurrent.ThreadTaskExecutor/]: Error executing task on Client com.google.gson.JsonParseException: Don't know how to turn {} into a Component at net.minecraft.util.text.ITextComponent$Serializer.deserialize(SourceFile:267) ~[?:?] at net.minecraft.util.text.ITextComponent$Serializer.deserialize(SourceFile:175) ~[?:?] at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[gson-2.8.0.jar:?] at net.minecraft.util.JSONUtils.func_188173_a(SourceFile:494) ~[?:?] at net.minecraft.util.JSONUtils.func_188176_a(SourceFile:519) ~[?:?] at net.minecraft.util.text.ITextComponent$Serializer.func_150699_a(SourceFile:399) ~[?:?] at net.minecraft.network.PacketBuffer.func_179258_d(PacketBuffer.java:153) ~[?:?] at net.minecraftforge.fml.network.FMLPlayMessages$OpenContainer.decode(FMLPlayMessages.java:279) ~[?:?] at net.minecraftforge.fml.network.simple.IndexedMessageCodec.lambda$tryDecode$0(IndexedMessageCodec.java:120) ~[?:?] at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_74] at net.minecraftforge.fml.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:120) ~[?:?] at net.minecraftforge.fml.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:162) ~[?:?] at net.minecraftforge.fml.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:80) ~[?:?] at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.0.0-milestone.1-service.jar:?] at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.0.0-milestone.1-service.jar:?] at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:84) ~[?:?] at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:78) ~[?:?] at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_74] at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:78) ~[?:?] at net.minecraft.client.network.play.ClientPlayNetHandler.func_147240_a(ClientPlayNetHandler.java:1868) ~[?:?] at net.minecraft.network.play.server.SCustomPayloadPlayPacket.func_148833_a(SCustomPayloadPlayPacket.java:59) ~[?:?] at net.minecraft.network.play.server.SCustomPayloadPlayPacket.func_148833_a(SCustomPayloadPlayPacket.java:11) ~[?:?] at net.minecraft.network.PacketThreadUtil.func_225383_a(SourceFile:21) ~[?:?] at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144) ~[?:?] at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) ~[?:?] at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118) ~[?:?] at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213160_bf(SourceFile:103) ~[?:?] at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:898) ~[?:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:554) ~[?:?] at net.minecraft.client.main.Main.main(SourceFile:204) ~[1.15.2-forge-31.1.25.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74] at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:56) ~[forge-1.15.2-31.1.25.jar:31.1] at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] 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. Edited April 27, 20205 yr by throwawaymodder
April 27, 20205 yr 25 minutes ago, throwawaymodder said: Don't know how to turn {} into a Component One of your ITextCompoments is incorrectly reading information. Maybe its an uninitialized string object within your tile entity. Maybe its the fact you have I18n on a variable in your container even though its client side only. You could easily put a breakpoint at all of your ITextComponent instances and find the location where it errors. I'm not sure where the exact error is, but your code seriously needs an overhaul to the current standard including no IInventory, TranslationTextComponent, etc.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.