本文整理汇总了Java中net.minecraft.network.play.server.S2DPacketOpenWindow类的典型用法代码示例。如果您正苦于以下问题:Java S2DPacketOpenWindow类的具体用法?Java S2DPacketOpenWindow怎么用?Java S2DPacketOpenWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
S2DPacketOpenWindow类属于net.minecraft.network.play.server包,在下文中一共展示了S2DPacketOpenWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayVillagerTradeGui
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void displayVillagerTradeGui(IMerchant villager)
{
this.getNextWindowId();
this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj);
this.openContainer.windowId = this.currentWindowId;
this.openContainer.onCraftGuiOpened(this);
IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
IChatComponent ichatcomponent = villager.getDisplayName();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:villager", ichatcomponent, iinventory.getSizeInventory()));
MerchantRecipeList merchantrecipelist = villager.getRecipes(this);
if (merchantrecipelist != null)
{
PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
packetbuffer.writeInt(this.currentWindowId);
merchantrecipelist.writeToBuf(packetbuffer);
this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
}
}
示例2: displayGUIMerchant
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str)
{
this.getNextWindowId();
this.openContainer = new ContainerMerchant(this.inventory, par1IMerchant, this.worldObj);
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
InventoryMerchant var3 = ((ContainerMerchant)this.openContainer).getMerchantInventory();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 6, par2Str == null ? "" : par2Str, var3.getSizeInventory(), par2Str != null));
MerchantRecipeList var4 = par1IMerchant.getRecipes(this);
if (var4 != null)
{
try
{
PacketBuffer var5 = new PacketBuffer(Unpooled.buffer());
var5.writeInt(this.currentWindowId);
var4.func_151391_a(var5);
this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", var5));
}
catch (IOException var6)
{
logger.error("Couldn\'t send trade list", var6);
}
}
}
示例3: displayGUIWorkbench
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void displayGUIWorkbench(int p_71058_1_, int p_71058_2_, int p_71058_3_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.worldObj, p_71058_1_, p_71058_2_, p_71058_3_));
if (container == null)
{
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 1, "Crafting", 9, true));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例4: displayGUIEnchantment
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void displayGUIEnchantment(int p_71002_1_, int p_71002_2_, int p_71002_3_, String p_71002_4_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantment(this.inventory, this.worldObj, p_71002_1_, p_71002_2_, p_71002_3_));
if (container == null)
{
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 4, p_71002_4_ == null ? "" : p_71002_4_, 9, p_71002_4_ != null));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例5: displayGUIAnvil
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void displayGUIAnvil(int p_82244_1_, int p_82244_2_, int p_82244_3_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerRepair(this.inventory, this.worldObj, p_82244_1_, p_82244_2_, p_82244_3_, this));
if (container == null)
{
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 8, "Repairing", 9, true));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例6: displayGUIChest
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void displayGUIChest(IInventory p_71007_1_)
{
if (this.openContainer != this.inventoryContainer)
{
this.closeScreen();
}
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, p_71007_1_));
if (container == null)
{
p_71007_1_.closeInventory(); // Cauldron - prevent chest from being stuck in open state on clients
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 0, p_71007_1_.getInventoryName(), p_71007_1_.getSizeInventory(), p_71007_1_.hasCustomInventoryName()));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例7: func_146093_a
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void func_146093_a(TileEntityHopper p_146093_1_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, p_146093_1_));
if (container == null)
{
p_146093_1_.closeInventory(); // Cauldron - prevent chest from being stuck in open state on clients
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 9, p_146093_1_.getInventoryName(), p_146093_1_.getSizeInventory(), p_146093_1_.hasCustomInventoryName()));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例8: displayGUIHopperMinecart
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void displayGUIHopperMinecart(EntityMinecartHopper p_96125_1_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, p_96125_1_));
if (container == null)
{
p_96125_1_.closeInventory(); // Cauldron - prevent chest from being stuck in open state on clients
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 9, p_96125_1_.getInventoryName(), p_96125_1_.getSizeInventory(), p_96125_1_.hasCustomInventoryName()));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例9: func_146101_a
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void func_146101_a(TileEntityFurnace p_146101_1_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, p_146101_1_));
if (container == null)
{
p_146101_1_.closeInventory(); // Cauldron - prevent chests from being stuck in open state on clients
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 2, p_146101_1_.getInventoryName(), p_146101_1_.getSizeInventory(), p_146101_1_.hasCustomInventoryName()));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例10: func_146102_a
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void func_146102_a(TileEntityDispenser p_146102_1_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, p_146102_1_));
if (container == null)
{
p_146102_1_.closeInventory(); // Cauldron - prevent chests from being stuck in open state on clients
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, p_146102_1_ instanceof TileEntityDropper ? 10 : 3, p_146102_1_.getInventoryName(), p_146102_1_.getSizeInventory(), p_146102_1_.hasCustomInventoryName()));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例11: func_146098_a
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void func_146098_a(TileEntityBrewingStand p_146098_1_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, p_146098_1_));
if (container == null)
{
p_146098_1_.closeInventory(); // Cauldron - prevent chests from being stuck in open state on clients
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 5, p_146098_1_.getInventoryName(), p_146098_1_.getSizeInventory(), p_146098_1_.hasCustomInventoryName()));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例12: func_146104_a
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void func_146104_a(TileEntityBeacon p_146104_1_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, p_146104_1_));
if (container == null)
{
p_146104_1_.closeInventory(); // Cauldron - prevent chests from being stuck in open state on clients
return;
}
// CraftBukkit end
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 7, p_146104_1_.getInventoryName(), p_146104_1_.getSizeInventory(), p_146104_1_.hasCustomInventoryName()));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例13: displayGUIHorse
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
public void displayGUIHorse(EntityHorse p_110298_1_, IInventory p_110298_2_)
{
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorseInventory(this.inventory, p_110298_2_, p_110298_1_));
if (container == null)
{
p_110298_2_.closeInventory(); // Cauldron - prevent chests from being stuck in open state on clients
return;
}
// CraftBukkit end
if (this.openContainer != this.inventoryContainer)
{
this.closeScreen();
}
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 11, p_110298_2_.getInventoryName(), p_110298_2_.getSizeInventory(), p_110298_2_.hasCustomInventoryName(), p_110298_1_.getEntityId()));
this.openContainer = container; // CraftBukkit - Use container we passed to event
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
示例14: invsee
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
@Command(aliases = "invsee", desc = "Look at the inventory of another player")
@Require("admin")
public void invsee(CommandSender sender, Player player) throws CommandException {
NailedPlayer p;
if(sender instanceof Player){
p = ((NailedPlayer) sender);
}else{
throw new CommandException("You are not a player");
}
EntityPlayerMP entity = p.getEntity();
if(entity.openContainer != entity.inventoryContainer){
entity.closeScreen();
}
entity.getNextWindowId();
InventoryOtherPlayer chest = new InventoryOtherPlayer(((NailedPlayer) player).getEntity(), entity);
entity.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(entity.currentWindowId, "minecraft:container", chest.getDisplayName(), chest.getSizeInventory()));
entity.openContainer = new ContainerChest(entity.inventory, chest, entity);
entity.openContainer.windowId = entity.currentWindowId;
entity.openContainer.onCraftGuiOpened(entity);
}
示例15: openContainer
import net.minecraft.network.play.server.S2DPacketOpenWindow; //导入依赖的package包/类
/**
* Opens a mod added container.
*
* @param player The player to open the container for
* @param inventory The tile entity providing the inventory
*/
public static void openContainer(EntityPlayerMP player, IModInventory inventory) {
if (player.openContainer != player.inventoryContainer) player.closeScreen();
if (inventory instanceof IModLockableInventory) {
IModLockableInventory lockable = (IModLockableInventory)inventory;
if (lockable.isLocked() && !player.canOpen(lockable.getLockCode()) && !player.isSpectator()) {
player.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation(lockable.getLockMessageString(), inventory.getDisplayName()), (byte) 2));
player.playerNetServerHandler.sendPacket(new S29PacketSoundEffect(lockable.getLockSoundString(), player.posX, player.posY, player.posZ, 1.0F, 1.0F));
return;
}
}
player.getNextWindowId();
Container container = inventory.createContainer(player.inventory, player);
player.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(player.currentWindowId, inventory.getGuiID(), inventory.getDisplayName(), inventory.getSizeInventory()));
player.openContainer = container;
player.openContainer.windowId = player.currentWindowId;
player.openContainer.onCraftGuiOpened(player);
}