Java 类net.minecraft.inventory.ContainerChest 实例源码

项目:CheataClientSrc    文件:ChestStealer.java   
@Override
public void onUpdate() {
    if(mc.thePlayer.openContainer != null){
        if(mc.thePlayer.openContainer instanceof ContainerChest){
            ContainerChest chest = (ContainerChest) mc.thePlayer.openContainer;
            int i;
            for(i = 0; i<chest.numRows*9;i++){
                if(mc.thePlayer.openContainer == null){
                    break;
                }
                Slot slot =(Slot)chest.inventorySlots.get(i);
                if(slot.getStack() == null)
                    continue;
                if(!timer.check((float)(delay == 0 ? 1 : delay))){
                    return;
                }
                mc.playerController.func_187098_a(chest.windowId, i, 0, ClickType.QUICK_MOVE, mc.thePlayer);
            }
        }
    }
}
项目:Backpack    文件:Backpack.java   
@Listener
public void onInteractInventoryEventClose(InteractInventoryEvent.Close event) throws IOException, SQLException {
    final Container container = (Container) event.getTargetInventory();

    if (container instanceof ContainerChest) {
        final ContainerChest containerChest = (ContainerChest) container;

        if (containerChest.getLowerChestInventory() instanceof BackpackInventory) {
            final BackpackInventory inventory = (BackpackInventory) containerChest.getLowerChestInventory();
            final Backpacks record = inventory.getRecord();

            final Session session = DatabaseManager.getSessionFactory().openSession();
            session.beginTransaction();
            for (int i = 0; i < record.getSize(); i++) {
                final ItemStack stack = (ItemStack) (Object) inventory.getStackInSlot(i);
                DatabaseManager.saveSlot(session, record, i, stack == null ? null : stack.toContainer());
            }
            session.getTransaction().commit();
            session.close();
        }
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
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);
}
项目:nailed    文件:CommandPlugin.java   
@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);
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory chestInventory)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    if (chestInventory instanceof ILockableContainer)
    {
        ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;

        if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
        {
            this.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
            this.playerNetServerHandler.sendPacket(new S29PacketSoundEffect("random.door_close", this.posX, this.posY, this.posZ, 1.0F, 1.0F));
            return;
        }
    }

    this.getNextWindowId();

    if (chestInventory instanceof IInteractionObject)
    {
        this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
        this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
    }
    else
    {
        this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
        this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
    }

    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory chestInventory)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    if (chestInventory instanceof ILockableContainer)
    {
        ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;

        if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
        {
            this.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
            this.playerNetServerHandler.sendPacket(new S29PacketSoundEffect("random.door_close", this.posX, this.posY, this.posZ, 1.0F, 1.0F));
            return;
        }
    }

    this.getNextWindowId();

    if (chestInventory instanceof IInteractionObject)
    {
        this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
        this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
    }
    else
    {
        this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
        this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
    }

    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
}
项目:DecompiledMinecraft    文件:GuiChest.java   
public GuiChest(IInventory upperInv, IInventory lowerInv)
{
    super(new ContainerChest(upperInv, lowerInv, Minecraft.getMinecraft().thePlayer));
    this.upperChestInventory = upperInv;
    this.lowerChestInventory = lowerInv;
    this.allowUserInput = false;
    int i = 222;
    int j = i - 108;
    this.inventoryRows = lowerInv.getSizeInventory() / 9;
    this.ySize = j + this.inventoryRows * 18;
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory chestInventory)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    if (chestInventory instanceof ILockableContainer)
    {
        ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;

        if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
        {
            this.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
            this.playerNetServerHandler.sendPacket(new S29PacketSoundEffect("random.door_close", this.posX, this.posY, this.posZ, 1.0F, 1.0F));
            return;
        }
    }

    this.getNextWindowId();

    if (chestInventory instanceof IInteractionObject)
    {
        this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
        this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
    }
    else
    {
        this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
        this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
    }

    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
}
项目:BaseClient    文件:GuiChest.java   
public GuiChest(IInventory upperInv, IInventory lowerInv)
{
    super(new ContainerChest(upperInv, lowerInv, Minecraft.getMinecraft().thePlayer));
    this.upperChestInventory = upperInv;
    this.lowerChestInventory = lowerInv;
    this.allowUserInput = false;
    int i = 222;
    int j = i - 108;
    this.inventoryRows = lowerInv.getSizeInventory() / 9;
    this.ySize = j + this.inventoryRows * 18;
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory chestInventory)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    if (chestInventory instanceof ILockableContainer)
    {
        ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;

        if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
        {
            this.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
            this.playerNetServerHandler.sendPacket(new S29PacketSoundEffect("random.door_close", this.posX, this.posY, this.posZ, 1.0F, 1.0F));
            return;
        }
    }

    this.getNextWindowId();

    if (chestInventory instanceof IInteractionObject)
    {
        this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
        this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
    }
    else
    {
        this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
        this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
    }

    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
}
项目:BaseClient    文件:GuiChest.java   
public GuiChest(IInventory upperInv, IInventory lowerInv)
{
    super(new ContainerChest(upperInv, lowerInv, Minecraft.getMinecraft().thePlayer));
    this.upperChestInventory = upperInv;
    this.lowerChestInventory = lowerInv;
    this.allowUserInput = false;
    int i = 222;
    int j = i - 108;
    this.inventoryRows = lowerInv.getSizeInventory() / 9;
    this.ySize = j + this.inventoryRows * 18;
}
项目:EMC    文件:IMinecraft.java   
public static boolean isChestOpen() {
    if (Minecraft.getMinecraft().player.openContainer != null) {
        if (Minecraft.getMinecraft().player.openContainer instanceof ContainerChest) {
            return true;
        }
    }
    return false;
}
项目:Backmemed    文件:GuiChest.java   
public GuiChest(IInventory upperInv, IInventory lowerInv)
{
    super(new ContainerChest(upperInv, lowerInv, Minecraft.getMinecraft().player));
    this.upperChestInventory = upperInv;
    this.lowerChestInventory = lowerInv;
    this.allowUserInput = false;
    int i = 222;
    int j = 114;
    this.inventoryRows = lowerInv.getSizeInventory() / 9;
    this.ySize = 114 + this.inventoryRows * 18;
}
项目:CustomWorldGen    文件:GuiChest.java   
public GuiChest(IInventory upperInv, IInventory lowerInv)
{
    super(new ContainerChest(upperInv, lowerInv, Minecraft.getMinecraft().thePlayer));
    this.upperChestInventory = upperInv;
    this.lowerChestInventory = lowerInv;
    this.allowUserInput = false;
    int i = 222;
    int j = 114;
    this.inventoryRows = lowerInv.getSizeInventory() / 9;
    this.ySize = 114 + this.inventoryRows * 18;
}
项目:Aether-Legacy    文件:AetherGuiHandler.java   
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
    if (ID == accessories)
    {
        return new ContainerAccessories(PlayerAether.get(player).accessories, player);
    }
    else if (ID == enchanter)
    {
        return new ContainerEnchanter(player.inventory, (TileEntityEnchanter) world.getTileEntity(new BlockPos(x, y, z)));
    }
    else if (ID == freezer)
    {
        return new ContainerFreezer(player.inventory, (TileEntityFreezer) world.getTileEntity(new BlockPos(x, y, z)));
    }
    else if (ID == incubator)
    {
        return new ContainerIncubator(player, player.inventory, (TileEntityIncubator) world.getTileEntity(new BlockPos(x, y, z)));
    }
    else if (ID == treasure_chest)
    {
        return new ContainerChest(player.inventory, (IInventory) world.getTileEntity(new BlockPos(x, y, z)), player);
    }
    else if (ID == lore)
    {
        return new ContainerLore(player.inventory);
    }

    return null;
}
项目:Aether-Legacy    文件:GuiTreasureChest.java   
public GuiTreasureChest(InventoryPlayer playerInventory, TileEntityTreasureChest chestInventory)
 {
     super(new ContainerChest(playerInventory, chestInventory, Minecraft.getMinecraft().thePlayer));

     this.allowUserInput = false;

     this.inventoryRows = chestInventory.getSizeInventory() / 9;

     this.ySize = 114 + this.inventoryRows * 18;

     if (chestInventory.getKind() == 0)
     {
this.chestType = "Bronze Treasure Chest";
     }
     else if (chestInventory.getKind() == 1)
     {
this.chestType = "Silver Treasure Chest";
     }
     else if (chestInventory.getKind() == 2)
     {
this.chestType = "Gold Treasure Chest";
     }
     else
     {
        this.chestType = "Platinum Treasure Chest";
     }
 }
项目:EssentialCmds    文件:InvSeeExecutor.java   
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
    Player target = ctx.<Player> getOne("target").get();

    if (src instanceof Player)
    {
        Player player = (Player) src;
        EntityPlayerMP playerMP = ((EntityPlayerMP) (Object) player);
        EntityPlayerMP targetMP = ((EntityPlayerMP) (Object) target);

        InventoryPlayer inventory = targetMP.inventory;
        ContainerChest container = new ContainerChest(playerMP.inventory, inventory, playerMP);

        if (playerMP.openContainer != playerMP.inventoryContainer)
        {
            playerMP.closeScreen();
        }

        playerMP.getNextWindowId();

        playerMP.connection.sendPacket(new SPacketOpenWindow(playerMP.currentWindowId, "minecraft:container", inventory.getDisplayName(), inventory.getSizeInventory()));
        playerMP.openContainer = container;

        playerMP.openContainer.windowId = playerMP.currentWindowId;
        playerMP.openContainer.addListener(playerMP);
    }
    else
    {
        src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be a player to see other inventories."));
    }

    return CommandResult.success();
}
项目:Skree    文件:GoldRushListener.java   
@Listener
public void onChestOpen(InteractInventoryEvent.Open event, @Root Player player) {
  Optional<GoldRushInstance> optInst = manager.getApplicableZone(player);
  if (!optInst.isPresent()) {
    return;
  }

  GoldRushInstance inst = optInst.get();

  Inventory inventory = event.getTargetInventory();
  if (!inst.isLocked() && inventory instanceof ContainerChest) {
    IInventory chestInv = ((ContainerChest) inventory).getLowerChestInventory();
    if (chestInv instanceof ILockableContainer) {
      LockCode newLockCode = new LockCode(UUID.randomUUID().toString());
      tileEntityClaimMap.put(newLockCode.getLock(), player);
      ((ILockableContainer) chestInv).setLockCode(newLockCode);

      BigDecimal risk = Optional.ofNullable(
          inst.cofferRisk.get(player.getUniqueId())
      ).orElse(BigDecimal.ZERO);

      Collection<org.spongepowered.api.item.inventory.ItemStack> queue = CofferValueMap.inst().satisfy(risk.toBigInteger());
      Iterator<org.spongepowered.api.item.inventory.ItemStack> it = queue.iterator();
      for (int i = 0; i < chestInv.getSizeInventory(); ++i) {
        if (it.hasNext()) {
          chestInv.setInventorySlotContents(i, tf(it.next()));
          continue;
        }
        chestInv.setInventorySlotContents(i, ItemStack.EMPTY);
      }
    }
  }
}
项目:Resilience-Client-Source    文件:EntityPlayerMP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory par1IInventory)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 0, par1IInventory.getInventoryName(), par1IInventory.getSizeInventory(), par1IInventory.isInventoryNameLocalized()));
    this.openContainer = new ContainerChest(this.inventory, par1IInventory);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
项目:Resilience-Client-Source    文件:GuiChest.java   
public GuiChest(IInventory par1IInventory, IInventory par2IInventory)
{
    super(new ContainerChest(par1IInventory, par2IInventory));
    this.field_147016_v = par1IInventory;
    this.field_147015_w = par2IInventory;
    this.field_146291_p = false;
    short var3 = 222;
    int var4 = var3 - 108;
    this.field_147018_x = par2IInventory.getSizeInventory() / 9;
    this.field_147000_g = var4 + this.field_147018_x * 18;
}
项目:ExpandedRailsMod    文件:GuiChest.java   
public GuiChest(IInventory upperInv, IInventory lowerInv)
{
    super(new ContainerChest(upperInv, lowerInv, Minecraft.getMinecraft().thePlayer));
    this.upperChestInventory = upperInv;
    this.lowerChestInventory = lowerInv;
    this.allowUserInput = false;
    int i = 222;
    int j = 114;
    this.inventoryRows = lowerInv.getSizeInventory() / 9;
    this.ySize = 114 + this.inventoryRows * 18;
}
项目:Cauldron    文件:GuiChest.java   
public GuiChest(IInventory p_i1083_1_, IInventory p_i1083_2_)
{
    super(new ContainerChest(p_i1083_1_, p_i1083_2_));
    this.upperChestInventory = p_i1083_1_;
    this.lowerChestInventory = p_i1083_2_;
    this.allowUserInput = false;
    short short1 = 222;
    int i = short1 - 108;
    this.inventoryRows = p_i1083_2_.getSizeInventory() / 9;
    this.ySize = i + this.inventoryRows * 18;
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void displayGUIChest(IInventory p_71007_1_)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 0, p_71007_1_.getInventoryName(), p_71007_1_.getSizeInventory(), p_71007_1_.hasCustomInventoryName()));
    this.openContainer = new ContainerChest(this.inventory, p_71007_1_);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
项目:Cauldron    文件:GuiChest.java   
public GuiChest(IInventory p_i1083_1_, IInventory p_i1083_2_)
{
    super(new ContainerChest(p_i1083_1_, p_i1083_2_));
    this.upperChestInventory = p_i1083_1_;
    this.lowerChestInventory = p_i1083_2_;
    this.allowUserInput = false;
    short short1 = 222;
    int i = short1 - 108;
    this.inventoryRows = p_i1083_2_.getSizeInventory() / 9;
    this.ySize = i + this.inventoryRows * 18;
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
public void func_71007_a(IInventory p_71007_1_) {
   if(this.field_71070_bA != this.field_71069_bz) {
      this.func_71053_j();
   }

   this.func_71117_bO();
   this.field_71135_a.func_72567_b(new Packet100OpenWindow(this.field_71139_cq, 0, p_71007_1_.func_70303_b(), p_71007_1_.func_70302_i_(), p_71007_1_.func_94042_c()));
   this.field_71070_bA = new ContainerChest(this.field_71071_by, p_71007_1_);
   this.field_71070_bA.field_75152_c = this.field_71139_cq;
   this.field_71070_bA.func_75132_a(this);
}
项目:RuneCraftery    文件:GuiChest.java   
public GuiChest(IInventory p_i1083_1_, IInventory p_i1083_2_) {
   super(new ContainerChest(p_i1083_1_, p_i1083_2_));
   this.field_74220_o = p_i1083_1_;
   this.field_74219_p = p_i1083_2_;
   this.field_73885_j = false;
   short var3 = 222;
   int var4 = var3 - 108;
   this.field_74218_q = p_i1083_2_.func_70302_i_() / 9;
   this.field_74195_c = var4 + this.field_74218_q * 18;
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory par1IInventory)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    this.incrementWindowID();
    this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 0, par1IInventory.getInvName(), par1IInventory.getSizeInventory(), par1IInventory.isInvNameLocalized()));
    this.openContainer = new ContainerChest(this.inventory, par1IInventory);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
项目:RuneCraftery    文件:GuiChest.java   
public GuiChest(IInventory par1IInventory, IInventory par2IInventory)
{
    super(new ContainerChest(par1IInventory, par2IInventory));
    this.upperChestInventory = par1IInventory;
    this.lowerChestInventory = par2IInventory;
    this.allowUserInput = false;
    short short1 = 222;
    int i = short1 - 108;
    this.inventoryRows = par2IInventory.getSizeInventory() / 9;
    this.ySize = i + this.inventoryRows * 18;
}
项目:BetterNutritionMod    文件:EntityPlayerMP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory par1IInventory)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    this.incrementWindowID();
    this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 0, par1IInventory.getInvName(), par1IInventory.getSizeInventory(), par1IInventory.isInvNameLocalized()));
    this.openContainer = new ContainerChest(this.inventory, par1IInventory);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
项目:BetterNutritionMod    文件:GuiChest.java   
public GuiChest(IInventory par1IInventory, IInventory par2IInventory)
{
    super(new ContainerChest(par1IInventory, par2IInventory));
    this.upperChestInventory = par1IInventory;
    this.lowerChestInventory = par2IInventory;
    this.allowUserInput = false;
    short short1 = 222;
    int i = short1 - 108;
    this.inventoryRows = par2IInventory.getSizeInventory() / 9;
    this.ySize = i + this.inventoryRows * 18;
}
项目:DecompiledMinecraft    文件:EntityMinecartChest.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerChest(playerInventory, this, playerIn);
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerChest(playerInventory, this, playerIn);
}
项目:DecompiledMinecraft    文件:EntityMinecartChest.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerChest(playerInventory, this, playerIn);
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerChest(playerInventory, this, playerIn);
}
项目:BaseClient    文件:EntityMinecartChest.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerChest(playerInventory, this, playerIn);
}
项目:BaseClient    文件:TileEntityChest.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerChest(playerInventory, this, playerIn);
}
项目:BaseClient    文件:EntityMinecartChest.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerChest(playerInventory, this, playerIn);
}
项目:BaseClient    文件:TileEntityChest.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerChest(playerInventory, this, playerIn);
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
/**
 * Displays the GUI for interacting with a chest inventory.
 */
public void displayGUIChest(IInventory chestInventory)
{
    if (chestInventory instanceof ILootContainer && ((ILootContainer)chestInventory).getLootTable() != null && this.isSpectator())
    {
        this.addChatComponentMessage((new TextComponentTranslation("container.spectatorCantOpen", new Object[0])).setStyle((new Style()).setColor(TextFormatting.RED)), true);
    }
    else
    {
        if (this.openContainer != this.inventoryContainer)
        {
            this.closeScreen();
        }

        if (chestInventory instanceof ILockableContainer)
        {
            ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;

            if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
            {
                this.connection.sendPacket(new SPacketChat(new TextComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
                this.connection.sendPacket(new SPacketSoundEffect(SoundEvents.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.posX, this.posY, this.posZ, 1.0F, 1.0F));
                return;
            }
        }

        this.getNextWindowId();

        if (chestInventory instanceof IInteractionObject)
        {
            this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
            this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
        }
        else
        {
            this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
            this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
        }

        this.openContainer.windowId = this.currentWindowId;
        this.openContainer.addListener(this);
    }
}
项目:EMC    文件:IChest.java   
private static ContainerChest getCurrent() {
    if (Minecraft.getMinecraft().player.openContainer == null) {
        return null;
    }
    return (ContainerChest) Minecraft.getMinecraft().player.openContainer;
}