Java源码示例:net.minecraft.container.Container
示例1
@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));
}
示例2
public MixinAbstractInventoryScreen(Container container, PlayerInventory playerInventory, Text name) {
super(container, playerInventory, name);
}
示例3
public MixinContainerScreen(Container container_1, PlayerInventory playerInventory_1, Text text_1) {
super(text_1);
}
示例4
public MixinContainerScreen(Container container_1, PlayerInventory playerInventory_1, Text text_1) {
super(text_1);
}