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

项目:customstuff4    文件:DamageableShapelessOreRecipeTest.java   
private void doTest(boolean inOrder, boolean enoughDamage)
{
    DamageableShapelessOreRecipe recipe = new DamageableShapelessOreRecipe(new ResourceLocation("group"),
                                                                           new int[] {enoughDamage ? 5 : 5000, 0},
                                                                           new ItemStack(Blocks.DIRT), new ItemStack(Items.WOODEN_SWORD), new ItemStack(Items.APPLE));
    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);
    inv.setInventorySlotContents(inOrder ? 3 : 4, new ItemStack(Items.WOODEN_SWORD));
    inv.setInventorySlotContents(inOrder ? 4 : 3, new ItemStack(Items.APPLE));

    assertSame(enoughDamage, recipe.matches(inv, null));

    if (enoughDamage)
    {
        NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
        assertSame(Items.WOODEN_SWORD, remaining.get(inOrder ? 3 : 4).getItem());
        assertEquals(5, remaining.get(inOrder ? 3 : 4).getItemDamage());
    }
}
项目:pnc-repressurized    文件:ProgWidgetCrafting.java   
@Override
public InventoryCrafting getCraftingGrid() {
    InventoryCrafting invCrafting = new InventoryCrafting(new Container() {
        @Override
        public boolean canInteractWith(EntityPlayer p_75145_1_) {
            return false;
        }

    }, 3, 3);
    for (int y = 0; y < 3; y++) {
        ProgWidgetItemFilter itemFilter = (ProgWidgetItemFilter) getConnectedParameters()[y];
        for (int x = 0; x < 3 && itemFilter != null; x++) {
            invCrafting.setInventorySlotContents(y * 3 + x, itemFilter.getFilter());
            itemFilter = (ProgWidgetItemFilter) itemFilter.getConnectedParameters()[0];
        }
    }
    return invCrafting;
}
项目:Backmemed    文件:BlockRailDetector.java   
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos)
{
    if (((Boolean)blockState.getValue(POWERED)).booleanValue())
    {
        List<EntityMinecartCommandBlock> list = this.<EntityMinecartCommandBlock>findMinecarts(worldIn, pos, EntityMinecartCommandBlock.class, new Predicate[0]);

        if (!list.isEmpty())
        {
            return ((EntityMinecartCommandBlock)list.get(0)).getCommandBlockLogic().getSuccessCount();
        }

        List<EntityMinecart> list1 = this.<EntityMinecart>findMinecarts(worldIn, pos, EntityMinecart.class, new Predicate[] {EntitySelectors.HAS_INVENTORY});

        if (!list1.isEmpty())
        {
            return Container.calcRedstoneFromInventory((IInventory)list1.get(0));
        }
    }

    return 0;
}
项目:customstuff4    文件:DamageableShapelessOreRecipeTest.java   
@Test
public void test_useUpItem()
{
    DamageableShapelessOreRecipe recipe = new DamageableShapelessOreRecipe(new ResourceLocation("group"),
                                                                           new int[] {60}, new ItemStack(Blocks.DIRT), new ItemStack(Items.WOODEN_SWORD));
    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);
    inv.setInventorySlotContents(3, new ItemStack(Items.WOODEN_SWORD));

    assertTrue(recipe.matches(inv, null));
    NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
    assertTrue(remaining.get(3).isEmpty());
}
项目:DecompiledMinecraft    文件:BlockRailDetector.java   
public int getComparatorInputOverride(World worldIn, BlockPos pos)
{
    if (((Boolean)worldIn.getBlockState(pos).getValue(POWERED)).booleanValue())
    {
        List<EntityMinecartCommandBlock> list = this.<EntityMinecartCommandBlock>findMinecarts(worldIn, pos, EntityMinecartCommandBlock.class, new Predicate[0]);

        if (!list.isEmpty())
        {
            return ((EntityMinecartCommandBlock)list.get(0)).getCommandBlockLogic().getSuccessCount();
        }

        List<EntityMinecart> list1 = this.<EntityMinecart>findMinecarts(worldIn, pos, EntityMinecart.class, new Predicate[] {EntitySelectors.selectInventories});

        if (!list1.isEmpty())
        {
            return Container.calcRedstoneFromInventory((IInventory)list1.get(0));
        }
    }

    return 0;
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Verifies that the server and client are synchronized with respect to the inventory/container opened by the player
 * and confirms if it is the case.
 */
public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Container container = null;
    EntityPlayer entityplayer = this.gameController.thePlayer;

    if (packetIn.getWindowId() == 0)
    {
        container = entityplayer.inventoryContainer;
    }
    else if (packetIn.getWindowId() == entityplayer.openContainer.windowId)
    {
        container = entityplayer.openContainer;
    }

    if (container != null && !packetIn.func_148888_e())
    {
        this.addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
    }
}
项目:Anima-Mundi    文件:GuiAnimaGenerator.java   
public GuiAnimaGenerator(Container inventorySlotsIn)
{
    super(inventorySlotsIn);

    xSize = WIDTH;
    ySize = HEIGHT;
}
项目:pnc-repressurized    文件:PacketUpdateGui.java   
@Override
public void handleClientSide(PacketUpdateGui message, EntityPlayer player) {
    Container container = player.openContainer;
    if (container instanceof ContainerPneumaticBase) {
        ((ContainerPneumaticBase) container).updateField(message.syncId, message.value);
    }
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
public void sendAllWindowProperties(Container containerIn, IInventory inventory)
{
    for (int i = 0; i < inventory.getFieldCount(); ++i)
    {
        this.connection.sendPacket(new SPacketWindowProperty(containerIn.windowId, i, inventory.getField(i)));
    }
}
项目:Bewitchment    文件:GuiBarrel.java   
public GuiBarrel(Container inventorySlotsIn, TileEntityBarrel te) {
    super(inventorySlotsIn);
    this.te = te;
    this.xSize = 176;
    this.ySize = 166;
    te.getAltar(true);
}
项目:DecompiledMinecraft    文件:GuiContainer.java   
private void updateDragSplitting()
{
    ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();

    if (itemstack != null && this.dragSplitting)
    {
        this.dragSplittingRemnant = itemstack.stackSize;

        for (Slot slot : this.dragSplittingSlots)
        {
            ItemStack itemstack1 = itemstack.copy();
            int i = slot.getStack() == null ? 0 : slot.getStack().stackSize;
            Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i);

            if (itemstack1.stackSize > itemstack1.getMaxStackSize())
            {
                itemstack1.stackSize = itemstack1.getMaxStackSize();
            }

            if (itemstack1.stackSize > slot.getItemStackLimit(itemstack1))
            {
                itemstack1.stackSize = slot.getItemStackLimit(itemstack1);
            }

            this.dragSplittingRemnant -= itemstack1.stackSize - i;
        }
    }
}
项目:DankNull    文件:GuiDankNull.java   
public GuiDankNull(Container container, EntityPlayer player) {
    super(container);
    this.player = player;
    ItemStack dankNull = DankNullUtils.getDankNull(player);
    pRenderItem = new DankNullRenderItem(Minecraft.getMinecraft().renderEngine, Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager(), Minecraft.getMinecraft().getItemColors(), dankNull, false, (ContainerDankNull) container);
    numRows = dankNull.getItemDamage();
    setWidth(210);
    setHeight(140 + (numRows * 20 + numRows + 1));
    setBackgroundTexture(new ResourceLocation(ModGlobals.MODID, "textures/gui/danknullscreen" + numRows + ".png"));
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
public void sendAllWindowProperties(Container containerIn, IInventory inventory)
{
    for (int i = 0; i < inventory.getFieldCount(); ++i)
    {
        this.connection.sendPacket(new SPacketWindowProperty(containerIn.windowId, i, inventory.getField(i)));
    }
}
项目:DecompiledMinecraft    文件:EntityMinecartContainer.java   
protected void applyDrag()
{
    int i = 15 - Container.calcRedstoneFromInventory(this);
    float f = 0.98F + (float)i * 0.001F;
    this.motionX *= (double)f;
    this.motionY *= 0.0D;
    this.motionZ *= (double)f;
}
项目:VirtualTool    文件:Invs.java   
public CommandResult Open(CommandSource src, Container opencon, String inventoryTypeIn, String title) {
    final Player player = Tools.getPlayer(src, vt);
    final EntityPlayerMP MPlayer = (EntityPlayerMP) player;
    MPlayer.getNextWindowId();
    MPlayer.connection.sendPacket(new SPacketOpenWindow(MPlayer.currentWindowId, inventoryTypeIn, new TextComponentString(title)));
    MPlayer.openContainer = opencon;
    MPlayer.openContainer.windowId = MPlayer.currentWindowId;
    MPlayer.openContainer.addListener(MPlayer);

    return CommandResult.success();
}
项目:BaseClient    文件:GuiRepair.java   
/**
 * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
 * contents of that slot. Args: Container, slot number, slot contents
 */
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
{
    if (slotInd == 0)
    {
        this.nameField.setText(stack == null ? "" : stack.getDisplayName());
        this.nameField.setEnabled(stack != null);

        if (stack != null)
        {
            this.renameItem();
        }
    }
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
/**
 * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
 * contents of that slot.
 */
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
{
    if (!(containerToSend.getSlot(slotInd) instanceof SlotCrafting))
    {
        if (!this.isChangingQuantityOnly)
        {
            this.connection.sendPacket(new SPacketSetSlot(containerToSend.windowId, slotInd, stack));
        }
    }
}
项目:UniversalRemote    文件:EntityPlayerMPProxy.java   
@Override
public void sendContainerToPlayer(Container containerIn) {
    if(m_realPlayer != null) {
        syncToRealPlayer();
        m_realPlayer.sendContainerToPlayer(containerIn);
        syncPublicFieldsFromReal();
    } else {
        super.sendContainerToPlayer(containerIn);
    }
}
项目:UniversalRemote    文件:EntityPlayerMPProxy.java   
@Override
public void sendAllContents(Container containerToSend, NonNullList<ItemStack> itemsList) {
    if(m_realPlayer != null) {
        syncToRealPlayer();
        m_realPlayer.sendAllContents(containerToSend, itemsList);
        syncPublicFieldsFromReal();
    } else {
        super.sendAllContents(containerToSend, itemsList);
    }
}
项目:BaseClient    文件:GuiContainer.java   
private void updateDragSplitting()
{
    ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();

    if (itemstack != null && this.dragSplitting)
    {
        this.dragSplittingRemnant = itemstack.stackSize;

        for (Slot slot : this.dragSplittingSlots)
        {
            ItemStack itemstack1 = itemstack.copy();
            int i = slot.getStack() == null ? 0 : slot.getStack().stackSize;
            Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i);

            if (itemstack1.stackSize > itemstack1.getMaxStackSize())
            {
                itemstack1.stackSize = itemstack1.getMaxStackSize();
            }

            if (itemstack1.stackSize > slot.getItemStackLimit(itemstack1))
            {
                itemstack1.stackSize = slot.getItemStackLimit(itemstack1);
            }

            this.dragSplittingRemnant -= itemstack1.stackSize - i;
        }
    }
}
项目:Backmemed    文件:GuiContainer.java   
private void updateDragSplitting()
{
    ItemStack itemstack = this.mc.player.inventory.getItemStack();

    if (!itemstack.func_190926_b() && this.dragSplitting)
    {
        if (this.dragSplittingLimit == 2)
        {
            this.dragSplittingRemnant = itemstack.getMaxStackSize();
        }
        else
        {
            this.dragSplittingRemnant = itemstack.func_190916_E();

            for (Slot slot : this.dragSplittingSlots)
            {
                ItemStack itemstack1 = itemstack.copy();
                ItemStack itemstack2 = slot.getStack();
                int i = itemstack2.func_190926_b() ? 0 : itemstack2.func_190916_E();
                Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i);
                int j = Math.min(itemstack1.getMaxStackSize(), slot.getItemStackLimit(itemstack1));

                if (itemstack1.func_190916_E() > j)
                {
                    itemstack1.func_190920_e(j);
                }

                this.dragSplittingRemnant -= itemstack1.func_190916_E() - i;
            }
        }
    }
}
项目:BaseClient    文件:EntityMinecartContainer.java   
protected void applyDrag()
{
    int i = 15 - Container.calcRedstoneFromInventory(this);
    float f = 0.98F + (float)i * 0.001F;
    this.motionX *= (double)f;
    this.motionY *= 0.0D;
    this.motionZ *= (double)f;
}
项目:UniversalRemote    文件:EntityPlayerMPProxy.java   
@Override
public void sendWindowProperty(Container containerIn, int varToUpdate, int newValue) {
    if(m_realPlayer != null) {
        syncToRealPlayer();
        m_realPlayer.sendWindowProperty(containerIn, varToUpdate, newValue);
        syncPublicFieldsFromReal();
    } else {
        super.sendWindowProperty(containerIn, varToUpdate, newValue);
    }
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
/**
 * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
 * contents of that slot.
 */
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
{
    if (!(containerToSend.getSlot(slotInd) instanceof SlotCrafting))
    {
        if (!this.isChangingQuantityOnly)
        {
            this.connection.sendPacket(new SPacketSetSlot(containerToSend.windowId, slotInd, stack));
        }
    }
}
项目:BaseClient    文件:CreativeCrafting.java   
/**
 * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
 * contents of that slot. Args: Container, slot number, slot contents
 */
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
{
    this.mc.playerController.sendSlotPacket(stack, slotInd);
}
项目:rezolve    文件:BundlerBlock.java   
@Override
public Container createServerGui(EntityPlayer player, World world, int x, int y, int z) {
    return new BundlerContainer(player.inventory, (BundlerEntity) world.getTileEntity(new BlockPos(x, y, z)));
}
项目:BaseClient    文件:BlockBrewingStand.java   
public int getComparatorInputOverride(World worldIn, BlockPos pos)
{
    return Container.calcRedstone(worldIn.getTileEntity(pos));
}
项目:rezolve    文件:RemoteShellBlock.java   
@Override
public Container createServerGui(EntityPlayer player, World world, int x, int y, int z) {
    return new RemoteShellContainer(player.inventory, (RemoteShellEntity) world.getTileEntity(new BlockPos(x, y, z)));
}
项目:Backmemed    文件:TileEntityEnchantmentTable.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerEnchantment(playerInventory, this.world, this.pos);
}
项目:Backmemed    文件:TileEntityShulkerBox.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerShulkerBox(playerInventory, this, playerIn);
}
项目:Backmemed    文件:EntityMinecartHopper.java   
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
{
    return new ContainerHopper(playerInventory, this, playerIn);
}
项目:CustomWorldGen    文件:CreativeCrafting.java   
/**
 * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
 * contents of that slot.
 */
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
{
    this.mc.playerController.sendSlotPacket(stack, slotInd);
}
项目:Backmemed    文件:BlockDispenser.java   
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos)
{
    return Container.calcRedstone(worldIn.getTileEntity(pos));
}
项目:BaseClient    文件:CreativeCrafting.java   
public void func_175173_a(Container p_175173_1_, IInventory p_175173_2_)
{
}
项目:DecompiledMinecraft    文件:CreativeCrafting.java   
public void func_175173_a(Container p_175173_1_, IInventory p_175173_2_)
{
}
项目:rezolve    文件:Machine.java   
@Override
public abstract Container createServerGui(EntityPlayer player, World world, int x, int y, int z);
项目:pnc-repressurized    文件:GuiLiquidCompressor.java   
public GuiLiquidCompressor(Container container, TileEntityLiquidCompressor te, String texture) {
    super(container, te, texture);
}
项目:DecompiledMinecraft    文件:CreativeCrafting.java   
/**
 * update the crafting window inventory with the items in the list
 */
public void updateCraftingInventory(Container containerToSend, List<ItemStack> itemsList)
{
}
项目:BaseClient    文件:GuiRepair.java   
public void func_175173_a(Container p_175173_1_, IInventory p_175173_2_)
{
}
项目:BetterBeginningsReborn    文件:InventoryWorkbenchAdditionalMaterials.java   
public InventoryWorkbenchAdditionalMaterials(Container container_, int size)
{
    stackList = new ItemStack[size];
    container = container_;
}