diff --git a/fabric-containers-v0/build.gradle b/fabric-containers-v0/build.gradle index 6a4b7f359..4a1b4225e 100644 --- a/fabric-containers-v0/build.gradle +++ b/fabric-containers-v0/build.gradle @@ -1,5 +1,5 @@ archivesBaseName = "fabric-containers-v0" -version = getSubprojectVersion(project, "0.1.0") +version = getSubprojectVersion(project, "0.1.1") dependencies { compile project(path: ':fabric-api-base', configuration: 'dev') diff --git a/fabric-containers-v0/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java b/fabric-containers-v0/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java index 6a1edee2a..bf18e7ba2 100644 --- a/fabric-containers-v0/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java +++ b/fabric-containers-v0/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java @@ -66,15 +66,21 @@ public class ScreenProviderRegistryImpl implements ScreenProviderRegistry { ClientSidePacketRegistry.INSTANCE.register(PacketTypes.OPEN_CONTAINER, (packetContext, packetByteBuf) -> { Identifier identifier = packetByteBuf.readIdentifier(); int syncId = packetByteBuf.readUnsignedByte(); + packetByteBuf.retain(); + MinecraftClient.getInstance().execute(() -> { - ContainerFactory factory = FACTORIES.get(identifier); - if (factory == null) { - LOGGER.error("No GUI factory found for {}!", identifier.toString()); - return; + try { + ContainerFactory factory = FACTORIES.get(identifier); + if (factory == null) { + LOGGER.error("No GUI factory found for {}!", identifier.toString()); + return; + } + AbstractContainerScreen gui = factory.create(syncId, identifier, packetContext.getPlayer(), packetByteBuf); + packetContext.getPlayer().container = gui.getContainer(); + MinecraftClient.getInstance().openScreen(gui); + } finally { + packetByteBuf.release(); } - AbstractContainerScreen gui = factory.create(syncId, identifier, packetContext.getPlayer(), packetByteBuf); - packetContext.getPlayer().container = gui.getContainer(); - MinecraftClient.getInstance().openScreen(gui); }); }); }