net.minecraft.container.Container Java Examples
The following examples show how to use
net.minecraft.container.Container.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PatchworkPlayNetworkingMessages.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void sendContainerOpenPacket(ServerPlayerEntity player, NameableContainerFactory factory, Consumer<PacketByteBuf> extraDataWriter) { if (player.world.isClient) { return; } player.method_14247(); ContainerSyncAccess access = (ContainerSyncAccess) player; int openContainerId = access.patchwork$getNewContainerSyncId(); PacketByteBuf extraData = new PacketByteBuf(Unpooled.buffer()); extraDataWriter.accept(extraData); // reset to beginning in case modders read for whatever reason extraData.readerIndex(0); PacketByteBuf output = new PacketByteBuf(Unpooled.buffer()); output.writeVarInt(extraData.readableBytes()); output.writeBytes(extraData); if (output.readableBytes() > 32600 || output.readableBytes() < 1) { throw new IllegalArgumentException("Invalid PacketByteBuf for openGui, found " + output.readableBytes() + " bytes"); } Container c = factory.createMenu(openContainerId, player.inventory, player); ContainerType<?> type = c.getType(); FMLPlayMessages.OpenContainer msg = new FMLPlayMessages.OpenContainer(type, openContainerId, factory.getDisplayName(), output); Packet<?> packet = PatchworkPlayNetworkingMessages.getOpenContainerPacket(msg); player.networkHandler.sendPacket(packet); player.container = c; player.container.addListener(player); // TODO MinecraftForge.EVENT_BUS.post(new PlayerContainerEvent.Open(player, c)); }
Example #2
Source File: MixinAbstractInventoryScreen.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public MixinAbstractInventoryScreen(Container container, PlayerInventory playerInventory, Text name) { super(container, playerInventory, name); }
Example #3
Source File: MixinContainerScreen.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
public MixinContainerScreen(Container container_1, PlayerInventory playerInventory_1, Text text_1) { super(text_1); }
Example #4
Source File: MixinContainerScreen.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
public MixinContainerScreen(Container container_1, PlayerInventory playerInventory_1, Text text_1) { super(text_1); }