Package net.minecraft.inventory

Examples of net.minecraft.inventory.Container


  @SneakyThrows(IOException.class)
  public static void openGui(GuiProvider guiProvider, EntityPlayer oPlayer) {
    if(!(oPlayer instanceof EntityPlayerMP)) throw new UnsupportedOperationException("Gui can only be opened on the server side");
    EntityPlayerMP player = (EntityPlayerMP) oPlayer;
    Container container = guiProvider.getContainer(player);
    if(container == null) return;
    player.getNextWindowId();
        player.closeContainer();
        int windowId = player.currentWindowId;
View Full Code Here


  }

  @Override
  public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
  {
    Container c = player.openContainer;
    if ( c instanceof AEBaseContainer )
    {
      AEBaseContainer bc = (AEBaseContainer) c;
      ContainerOpenContext context = bc.openContext;
      if ( context != null )
View Full Code Here

  @Override
  public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
  {
    EntityPlayerMP pmp = (EntityPlayerMP) player;
    Container con = pmp.openContainer;

    if ( con != null && con instanceof IContainerCraftingPacket )
    {
      IContainerCraftingPacket cct = (IContainerCraftingPacket) con;
      IGridNode node = cct.getNetworkNode();
      if ( node != null )
      {
        IGrid grid = node.getGrid();
        if ( grid == null )
          return;

        IStorageGrid inv = grid.getCache( IStorageGrid.class );
        IEnergyGrid energy = grid.getCache( IEnergyGrid.class );
        ISecurityGrid security = grid.getCache( ISecurityGrid.class );
        IInventory craftMatrix = cct.getInventoryByName( "crafting" );

        Actionable realForFake = cct.useRealItems() ? Actionable.MODULATE : Actionable.SIMULATE;

        if ( inv != null && recipe != null && security != null )
        {
          InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
          for (int x = 0; x < 9; x++)
          {
            if ( recipe[x] != null && recipe[x].length > 0 )
            {
              ic.setInventorySlotContents( x, recipe[x][0] );
            }
          }

          IRecipe r = Platform.findMatchingRecipe( ic, pmp.worldObj );

          if ( r != null && security.hasPermission( player, SecurityPermissions.EXTRACT ) )
          {
            ItemStack is = r.getCraftingResult( ic );

            if ( is != null )
            {
              IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
              IItemList all = storage.getStorageList();
              IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );

              for (int x = 0; x < craftMatrix.getSizeInventory(); x++)
              {
                ItemStack PatternItem = ic.getStackInSlot( x );

                ItemStack currentItem = craftMatrix.getStackInSlot( x );
                if ( currentItem != null )
                {
                  ic.setInventorySlotContents( x, currentItem );
                  ItemStack newItemStack = r.matches( ic, pmp.worldObj ) ? r.getCraftingResult( ic ) : null;
                  ic.setInventorySlotContents( x, PatternItem );

                  if ( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
                  {
                    IAEItemStack in = AEItemStack.create( currentItem );
                    if ( in != null )
                    {
                      IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in,
                          cct.getSource() );
                      if ( out != null )
                        craftMatrix.setInventorySlotContents( x, out.getItemStack() );
                      else
                        craftMatrix.setInventorySlotContents( x, null );

                      currentItem = craftMatrix.getStackInSlot( x );
                    }
                  }
                }

                if ( PatternItem != null && currentItem == null )
                {
                  ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getSource(), storage, player.worldObj, r, is, ic,
                      PatternItem, x, all, realForFake, filter );

                  if ( whichItem == null )
                  {
                    for (int y = 0; y < recipe[x].length; y++)
                    {
                      IAEItemStack request = AEItemStack.create( recipe[x][y] );
                      if ( request != null )
                      {
                        if ( filter == null || filter.isListed( request ) )
                        {
                          request.setStackSize( 1 );
                          IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getSource() );
                          if ( out != null )
                          {
                            whichItem = out.getItemStack();
                            break;
                          }
                        }
                      }
                    }
                  }

                  craftMatrix.setInventorySlotContents( x, whichItem );
                }
              }
              con.onCraftMatrixChanged( craftMatrix );
            }
          }
        }
      }
    }
View Full Code Here

    super.actionPerformed( btn );

    if ( clearBtn == btn )
    {
      Slot s = null;
      Container c = inventorySlots;
      for (Object j : c.inventorySlots)
      {
        if ( j instanceof SlotCraftingMatrix )
          s = (Slot) j;
      }
View Full Code Here

  }

  @Override
  public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
  {
    Container c = player.openContainer;

    if ( Name.equals( "Item" ) && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IMouseWheelItem )
    {
      ItemStack is = player.getHeldItem();
      IMouseWheelItem si = (IMouseWheelItem) is.getItem();
View Full Code Here

  }

  @Override
  public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
  {
    Container c = player.openContainer;

    if ( Name.equals( "CustomName" ) && c instanceof AEBaseContainer )
    {
      ((AEBaseContainer) c).customName = Value;
    }
View Full Code Here

  }

  @Override
  public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
  {
    Container c = player.openContainer;
    if ( c instanceof AEBaseContainer )
      ((AEBaseContainer) c).updateFullProgressBar( id, value );
  }
View Full Code Here

  }

  @Override
  public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
  {
    Container c = player.openContainer;
    if ( c instanceof AEBaseContainer )
      ((AEBaseContainer) c).updateFullProgressBar( id, value );
  }
View Full Code Here

        return null;
    }

    public static Container getGuiContainer(EnumGui guiType, InventoryPlayer inv, Object obj, World world, int x, int y, int z) {
        for (Module m : loadedModules) {
            Container con = m.instance.getGuiContainer(guiType, inv, obj, world, x, y, z);
            if (con != null)
                return con;
        }
        return null;
    }
View Full Code Here

  private int update = Utils.RANDOM.nextInt();

  private class LocalInventoryCrafting extends InventoryCrafting {

    public LocalInventoryCrafting() {
      super(new Container() {
        @Override
        public boolean canInteractWith(EntityPlayer entityplayer) {
          return false;
        }
      }, 3, 3);
View Full Code Here

TOP

Related Classes of net.minecraft.inventory.Container

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.