当前位置: 首页>>代码示例>>Java>>正文


Java Container类代码示例

本文整理汇总了Java中net.minecraft.inventory.Container的典型用法代码示例。如果您正苦于以下问题:Java Container类的具体用法?Java Container怎么用?Java Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Container类属于net.minecraft.inventory包,在下文中一共展示了Container类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTest

import net.minecraft.inventory.Container; //导入依赖的package包/类
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());
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:26,代码来源:DamageableShapelessOreRecipeTest.java

示例2: getCraftingGrid

import net.minecraft.inventory.Container; //导入依赖的package包/类
@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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:ProgWidgetCrafting.java

示例3: getComparatorInputOverride

import net.minecraft.inventory.Container; //导入依赖的package包/类
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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:BlockRailDetector.java

示例4: test_useUpItem

import net.minecraft.inventory.Container; //导入依赖的package包/类
@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());
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:20,代码来源:DamageableShapelessOreRecipeTest.java

示例5: getComparatorInputOverride

import net.minecraft.inventory.Container; //导入依赖的package包/类
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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:BlockRailDetector.java

示例6: handleConfirmTransaction

import net.minecraft.inventory.Container; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:NetHandlerPlayClient.java

示例7: GuiAnimaGenerator

import net.minecraft.inventory.Container; //导入依赖的package包/类
public GuiAnimaGenerator(Container inventorySlotsIn)
{
	super(inventorySlotsIn);

	xSize = WIDTH;
	ySize = HEIGHT;
}
 
开发者ID:Lemonszz,项目名称:Anima-Mundi,代码行数:8,代码来源:GuiAnimaGenerator.java

示例8: handleClientSide

import net.minecraft.inventory.Container; //导入依赖的package包/类
@Override
public void handleClientSide(PacketUpdateGui message, EntityPlayer player) {
    Container container = player.openContainer;
    if (container instanceof ContainerPneumaticBase) {
        ((ContainerPneumaticBase) container).updateField(message.syncId, message.value);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:PacketUpdateGui.java

示例9: sendAllWindowProperties

import net.minecraft.inventory.Container; //导入依赖的package包/类
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)));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:EntityPlayerMP.java

示例10: GuiBarrel

import net.minecraft.inventory.Container; //导入依赖的package包/类
public GuiBarrel(Container inventorySlotsIn, TileEntityBarrel te) {
	super(inventorySlotsIn);
	this.te = te;
	this.xSize = 176;
	this.ySize = 166;
	te.getAltar(true);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:8,代码来源:GuiBarrel.java

示例11: updateDragSplitting

import net.minecraft.inventory.Container; //导入依赖的package包/类
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;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:29,代码来源:GuiContainer.java

示例12: GuiDankNull

import net.minecraft.inventory.Container; //导入依赖的package包/类
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"));
}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:11,代码来源:GuiDankNull.java

示例13: applyDrag

import net.minecraft.inventory.Container; //导入依赖的package包/类
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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:EntityMinecartContainer.java

示例14: Open

import net.minecraft.inventory.Container; //导入依赖的package包/类
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();
}
 
开发者ID:poqdavid,项目名称:VirtualTool,代码行数:12,代码来源:Invs.java

示例15: sendSlotContents

import net.minecraft.inventory.Container; //导入依赖的package包/类
/**
 * 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();
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:GuiRepair.java


注:本文中的net.minecraft.inventory.Container类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。