java类net.minecraft.entity.player.InventoryPlayer的实例源码

RemoteShellEntity.java 文件源码 项目:rezolve 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) {

    Slot slot = containerToSend.getSlot(slotInd);
    boolean charge = true;

    if (slot != null) {
        if (slot.inventory instanceof InventoryPlayer) {
            // We don't charge for changes to the player's inventory.
            charge = false;
        }
    }

    System.out.println("Send slot contents for "+slotInd+":");
    if (stack == null)
        System.out.println(" - No contents");
    else
        System.out.println(" - "+stack.stackSize+" "+stack.getDisplayName());

    if (charge) {
        System.out.println("Charging a fee for data transfer...");
        this.chargeForAccess(1);
    }

}
GuiContainerCreative.java 文件源码 项目:CustomWorldGen 阅读 19 收藏 0 点赞 0 评论 0
public ContainerCreative(EntityPlayer player)
{
    InventoryPlayer inventoryplayer = player.inventory;

    for (int i = 0; i < 5; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(GuiContainerCreative.basicInventory, i * 9 + j, 9 + j * 18, 18 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(inventoryplayer, k, 9 + k * 18, 112));
    }

    this.scrollTo(0.0F);
}
ContainerHopper.java 文件源码 项目:BaseClient 阅读 25 收藏 0 点赞 0 评论 0
public ContainerHopper(InventoryPlayer playerInventory, IInventory hopperInventoryIn, EntityPlayer player)
{
    this.hopperInventory = hopperInventoryIn;
    hopperInventoryIn.openInventory(player);
    int i = 51;

    for (int j = 0; j < hopperInventoryIn.getSizeInventory(); ++j)
    {
        this.addSlotToContainer(new Slot(hopperInventoryIn, j, 44 + j * 18, 20));
    }

    for (int l = 0; l < 3; ++l)
    {
        for (int k = 0; k < 9; ++k)
        {
            this.addSlotToContainer(new Slot(playerInventory, k + l * 9 + 9, 8 + k * 18, l * 18 + i));
        }
    }

    for (int i1 = 0; i1 < 9; ++i1)
    {
        this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 58 + i));
    }
}
ContainerHopper.java 文件源码 项目:DecompiledMinecraft 阅读 27 收藏 0 点赞 0 评论 0
public ContainerHopper(InventoryPlayer playerInventory, IInventory hopperInventoryIn, EntityPlayer player)
{
    this.hopperInventory = hopperInventoryIn;
    hopperInventoryIn.openInventory(player);
    int i = 51;

    for (int j = 0; j < hopperInventoryIn.getSizeInventory(); ++j)
    {
        this.addSlotToContainer(new Slot(hopperInventoryIn, j, 44 + j * 18, 20));
    }

    for (int l = 0; l < 3; ++l)
    {
        for (int k = 0; k < 9; ++k)
        {
            this.addSlotToContainer(new Slot(playerInventory, k + l * 9 + 9, 8 + k * 18, l * 18 + i));
        }
    }

    for (int i1 = 0; i1 < 9; ++i1)
    {
        this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 58 + i));
    }
}
ContainerMerchant.java 文件源码 项目:CustomWorldGen 阅读 19 收藏 0 点赞 0 评论 0
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
    this.theMerchant = merchant;
    this.theWorld = worldIn;
    this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant);
    this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
    this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
    this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
TileEntityAutoWorkBench.java 文件源码 项目:Technical 阅读 25 收藏 0 点赞 0 评论 0
public boolean canCraft() {
    if(currentEnergy <= 0) {
        FMLLog.log(Level.INFO, "Ba");
        currentEnergy = 0;
        return false;
    } else {
        FMLLog.log(Level.INFO, "Bb");
        InventoryCrafting inv = new InventoryCrafting(new ContainerAutoWorkBench(new InventoryPlayer(null), this), 3, 3);
        for(int i = 1; i < machineItemStacks.length - 1; i++) {
            inv.setInventorySlotContents(i - 1, machineItemStacks[i - 1]);
            FMLLog.log(Level.INFO, "Bc" + (i - 1));
        }
        ItemStack stack = AutoWorkBenchRecipes.smelting().getSmeltingResult(inv, worldObj, Tier.normal)[0];
        FMLLog.log(Level.INFO, "Bd" + (stack != null));
        return stack != null;
    }
}
ContainerProgrammer.java 文件源码 项目:pnc-repressurized 阅读 19 收藏 0 点赞 0 评论 0
public ContainerProgrammer(InventoryPlayer inventoryPlayer, TileEntityProgrammer te) {
    super(te);

    addSlotToContainer(new SlotItemHandler(te.getPrimaryInventory(), 0, 326, 15) {
        @Override
        public boolean isItemValid(@Nonnull ItemStack stack) {
            return isProgrammableItem(stack);
        }
    });

    // Add the player's inventory slots to the container
    for (int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for (int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 95 + inventoryColumnIndex * 18, 174 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for (int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 95 + actionBarSlotIndex * 18, 232));
    }
}
BlockSurveyFlag.java 文件源码 项目:OpenFlexiTrack 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Removes the given amount of items from the given player inventory. Scans through multiple inventory slots if needed.
 * 
 * @param inv - {@link net.minecraft.entity.player.InventoryPlayer Player inventory} to interact with.
 * @param item - {@link net.minecraft.item.Item Item type} to remove.
 * @param meta - Item metadata; set to {@code -1} to disregard item metadata.
 * @param qty - Number of items to remove.
 */
private static void removeItemsFromPlayer(InventoryPlayer inv, Item item, int meta, int qty){

    for(int i=0; i<inv.mainInventory.length; ++i){

        ItemStack stack = inv.mainInventory[i];
        if (stack == null) {
            continue;
        }

        if(stack.getItem().equals(item)){
            if(stack.getItemDamage() == meta || meta == -1){
                if(stack.stackSize <= qty){
                    qty -= stack.stackSize;
                    inv.removeStackFromSlot(i);
                }else{
                    stack.stackSize -= qty;
                    inv.setInventorySlotContents(i, stack);
                    return;
                }
            }
        }
    }
}
ContainerAmmoFurnace.java 文件源码 项目:Mods 阅读 19 收藏 0 点赞 0 评论 0
public ContainerAmmoFurnace(InventoryPlayer playerInventory, IInventory furnaceInventory) {
    this.tileFurnace = furnaceInventory;
    for (int i = 0; i < 9; i++)
        this.addSlotToContainer(new Slot(furnaceInventory, i, 9 + (i % 3) * 18, 17 + (i / 3) * 18));
    this.addSlotToContainer(new SlotFurnaceFuel(furnaceInventory, 9, 80, 53));
    for (int i = 0; i < 9; i++)
        this.addSlotToContainer(new SlotFurnaceOutput(playerInventory.player, furnaceInventory, i + 10,
                116 + (i % 3) * 18, 17 + (i / 3) * 18));

    for (int i = 0; i < 3; ++i)
        for (int j = 0; j < 9; ++j)
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));

    for (int k = 0; k < 9; ++k)
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
}
ContainerBrewingStand.java 文件源码 项目:BaseClient 阅读 30 收藏 0 点赞 0 评论 0
public ContainerBrewingStand(InventoryPlayer playerInventory, IInventory tileBrewingStandIn)
{
    this.tileBrewingStand = tileBrewingStandIn;
    this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 0, 56, 46));
    this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 1, 79, 53));
    this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 2, 102, 46));
    this.theSlot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(tileBrewingStandIn, 3, 79, 17));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
ContainerBrewingStand.java 文件源码 项目:CustomWorldGen 阅读 21 收藏 0 点赞 0 评论 0
public ContainerBrewingStand(InventoryPlayer playerInventory, IInventory tileBrewingStandIn)
{
    this.tileBrewingStand = tileBrewingStandIn;
    this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 0, 56, 51));
    this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 1, 79, 58));
    this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 2, 102, 51));
    this.theSlot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(tileBrewingStandIn, 3, 79, 17));
    this.addSlotToContainer(new ContainerBrewingStand.Fuel(tileBrewingStandIn, 4, 17, 17));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 9; ++j)
        {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k)
    {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
ContainerApiary.java 文件源码 项目:Bewitchment 阅读 20 收藏 0 点赞 0 评论 0
public ContainerApiary(InventoryPlayer playerInventory, IInventory inventory) {
    this.apiary = inventory;
    this.addSlotToContainer(new SlotBee(inventory, 0, 26, 34));

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 6; j++) {
            this.addSlotToContainer(new SlotItem(inventory, j + i * 6 + 1, 62 + j * 18, 16 + i * 18));
        }
    }

    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 9; ++j) {
            this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (int k = 0; k < 9; ++k) {
        this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
    }
}
GuiEnchantment.java 文件源码 项目:CustomWorldGen 阅读 31 收藏 0 点赞 0 评论 0
public GuiEnchantment(InventoryPlayer inventory, World worldIn, IWorldNameable nameable)
{
    super(new ContainerEnchantment(inventory, worldIn));
    this.playerInventory = inventory;
    this.container = (ContainerEnchantment)this.inventorySlots;
    this.nameable = nameable;
}
ContainerPersonalCharger.java 文件源码 项目:WirelessCharger 阅读 24 收藏 0 点赞 0 评论 0
public ContainerPersonalCharger(final EntityPlayer player, TileEntityBase tile) {

        tilePersonalCharger = (TilePersonalCharger) tile;
        InventoryPlayer inventory = player.inventory;
        addPlayerSlots(inventory);
        addUpgradeSlots(((TilePersonalCharger) tile).getUpgradeStackHandler());
    }
InventoryCommandsImplementation.java 文件源码 项目:Proyecto-DASI 阅读 28 收藏 0 点赞 0 评论 0
static void combineSlots(EntityPlayerMP player, int dst, int add)
{
    InventoryPlayer inv = player.inventory;
    ItemStack dstStack = inv.getStackInSlot(dst);
    ItemStack addStack = inv.getStackInSlot(add);

    if (addStack == null)
        return;    // Combination is a no-op.

    if (dstStack == null)   // Do a straight move - nothing to combine with.
    {
        inv.setInventorySlotContents(dst, addStack);
        inv.setInventorySlotContents(add, null);
        return;
    }

    // Check we can combine. This logic comes from InventoryPlayer.storeItemStack():
    boolean itemsMatch = dstStack.getItem() == addStack.getItem();
    boolean dstCanStack = dstStack.isStackable() && dstStack.stackSize < dstStack.getMaxStackSize() && dstStack.stackSize < inv.getInventoryStackLimit();
    boolean subTypesMatch = !dstStack.getHasSubtypes() || dstStack.getMetadata() == addStack.getMetadata();
    boolean tagsMatch = ItemStack.areItemStackTagsEqual(dstStack, addStack);
    if (itemsMatch && dstCanStack && subTypesMatch && tagsMatch)
    {
        // We can combine, so figure out how much we have room for:
        int limit = Math.min(dstStack.getMaxStackSize(), inv.getInventoryStackLimit());
        int room = limit - dstStack.stackSize;
        if (addStack.stackSize > room)
        {
            // Not room for all of it, so shift across as much as possible.
            addStack.stackSize -= room;
            dstStack.stackSize += room;
        }
        else
        {
            // Room for the whole lot, so empty out the add slot.
            dstStack.stackSize += addStack.stackSize;
            inv.setInventorySlotContents(add, null);
        }
    }
}
GuiEnchantment.java 文件源码 项目:DecompiledMinecraft 阅读 27 收藏 0 点赞 0 评论 0
public GuiEnchantment(InventoryPlayer inventory, World worldIn, IWorldNameable p_i45502_3_)
{
    super(new ContainerEnchantment(inventory, worldIn));
    this.playerInventory = inventory;
    this.container = (ContainerEnchantment)this.inventorySlots;
    this.field_175380_I = p_i45502_3_;
}
GuiBeacon.java 文件源码 项目:Backmemed 阅读 25 收藏 0 点赞 0 评论 0
public GuiBeacon(InventoryPlayer playerInventory, IInventory tileBeaconIn)
{
    super(new ContainerBeacon(playerInventory, tileBeaconIn));
    this.tileBeacon = tileBeaconIn;
    this.xSize = 230;
    this.ySize = 219;
}
NetHandlerPlayClient.java 文件源码 项目:Backmemed 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Updates which hotbar slot of the player is currently selected
 */
public void handleHeldItemChange(SPacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (InventoryPlayer.isHotbar(packetIn.getHeldItemHotbarIndex()))
    {
        this.gameController.player.inventory.currentItem = packetIn.getHeldItemHotbarIndex();
    }
}
GuiHopper.java 文件源码 项目:Backmemed 阅读 21 收藏 0 点赞 0 评论 0
public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv)
{
    super(new ContainerHopper(playerInv, hopperInv, Minecraft.getMinecraft().player));
    this.playerInventory = playerInv;
    this.hopperInventory = hopperInv;
    this.allowUserInput = false;
    this.ySize = 133;
}
ContainerWorkbench.java 文件源码 项目:CustomWorldGen 阅读 25 收藏 0 点赞 0 评论 0
public ContainerWorkbench(InventoryPlayer playerInventory, World worldIn, BlockPos posIn)
{
    this.worldObj = worldIn;
    this.pos = posIn;
    this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18));
        }
    }

    for (int k = 0; k < 3; ++k)
    {
        for (int i1 = 0; i1 < 9; ++i1)
        {
            this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18));
        }
    }

    for (int l = 0; l < 9; ++l)
    {
        this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142));
    }

    this.onCraftMatrixChanged(this.craftMatrix);
}
CraftiniumConverterContainer.java 文件源码 项目:Randores2 阅读 20 收藏 0 点赞 0 评论 0
public CraftiniumConverterContainer(InventoryPlayer playerInventory, World world, BlockPos converter) {
    this.world = world;
    this.converter = converter;
    this.player = playerInventory.player;

    this.input = new CraftiniumSlotConvertInput(this);

    this.delegate = new DelegatingItemStackHandler();
    PagedItemStackHandler handler = new PagedItemStackHandler(9, 0);
    this.handler = handler;
    this.delegate.setHandler(handler);

    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            this.addSlotToContainer(new CraftiniumSlotConvertOutput(this, this.delegate, j + i * 3, 30 + j * 18, 17 + i * 18)); //TODO proper offsets
        }
    }

    for (int k = 0; k < 3; ++k) {
        for (int i1 = 0; i1 < 9; ++i1) {
            this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18));
        }
    }

    for (int l = 0; l < 9; ++l) {
        this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142));
    }
}
ContainerWorkbench.java 文件源码 项目:BaseClient 阅读 25 收藏 0 点赞 0 评论 0
public ContainerWorkbench(InventoryPlayer playerInventory, World worldIn, BlockPos posIn)
{
    this.worldObj = worldIn;
    this.pos = posIn;
    this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18));
        }
    }

    for (int k = 0; k < 3; ++k)
    {
        for (int i1 = 0; i1 < 9; ++i1)
        {
            this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18));
        }
    }

    for (int l = 0; l < 9; ++l)
    {
        this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142));
    }

    this.onCraftMatrixChanged(this.craftMatrix);
}
GuiHopper.java 文件源码 项目:DecompiledMinecraft 阅读 22 收藏 0 点赞 0 评论 0
public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv)
{
    super(new ContainerHopper(playerInv, hopperInv, Minecraft.getMinecraft().thePlayer));
    this.playerInventory = playerInv;
    this.hopperInventory = hopperInv;
    this.allowUserInput = false;
    this.ySize = 133;
}
ContainerPneumaticBase.java 文件源码 项目:pnc-repressurized 阅读 23 收藏 0 点赞 0 评论 0
@Nonnull
private ItemStack slotClickPhantom(Slot slot, int dragType, ClickType clickType, EntityPlayer player) {
    ItemStack stack = ItemStack.EMPTY;

    if (clickType == ClickType.CLONE && dragType == 2) {
        // middle-click: clear slot
        if (((IPhantomSlot) slot).canAdjust()) {
            slot.putStack(ItemStack.EMPTY);
        }
    } else if ((clickType == ClickType.PICKUP || clickType == ClickType.QUICK_MOVE) && (dragType == 0 || dragType == 1)) {
        // left or right-click...
        InventoryPlayer playerInv = player.inventory;
        slot.onSlotChanged();
        ItemStack stackSlot = slot.getStack();
        ItemStack stackHeld = playerInv.getItemStack();

        stack = stackSlot.copy();
        if (stackSlot.isEmpty()) {
            if (!stackHeld.isEmpty() && slot.isItemValid(stackHeld)) {
                fillPhantomSlot(slot, stackHeld, clickType, dragType);
            }
        } else if (stackHeld.isEmpty()) {
            adjustPhantomSlot(slot, clickType, dragType);
            slot.onTake(player, playerInv.getItemStack());
        } else if (slot.isItemValid(stackHeld)) {
            if (canStacksMerge(stackSlot, stackHeld)) {
                adjustPhantomSlot(slot, clickType, dragType);
            } else {
                fillPhantomSlot(slot, stackHeld, clickType, dragType);
            }
        }
    }
    return stack;
}
ContainerWorldMachine.java 文件源码 项目:CraftingParadiseMod 阅读 22 收藏 0 点赞 0 评论 0
public ContainerWorldMachine(EntityPlayer player, TileWorldMachine tile)
{
    this.tile = tile;

    InventoryPlayer ip = player.inventory;
    int playerInventoryX = 35;
    int playerInventoryY = 147;

    for(int x = 0; x < 9; x++)
        this.addSlotToContainer(new Slot(ip, x, playerInventoryX + x * 18 , playerInventoryY+58));

    for(int x = 0; x < 9; x++)
        for(int y = 0; y < 3; y++)
            this.addSlotToContainer(new Slot(ip, 9 + y * 9 + x, playerInventoryX + x * 18, playerInventoryY + y * 18));

    SlotWorldModule core = new SlotWorldModule(tile, 0, 21, 21, IWorldBuilderModule.ModuleType.CORE);
    SlotWorldModule mantle = new SlotWorldModule(tile, 1, 39, 21, IWorldBuilderModule.ModuleType.MANTLE, core);
    SlotWorldModule crust = new SlotWorldModule(tile, 2, 57, 21, IWorldBuilderModule.ModuleType.CRUST, core, mantle);
    SlotWorldModule land = new SlotWorldModule(tile, 3, 21, 39, IWorldBuilderModule.ModuleType.LANDSCAPE, core, mantle, crust);
    SlotWorldModule world = new SlotWorldModule(tile, 4, 39, 39, IWorldBuilderModule.ModuleType.WORLD, core, mantle, crust, land);
    SlotWorldModule atmosphere = new SlotWorldModule(tile, 5, 57, 39, IWorldBuilderModule.ModuleType.ATMOSPHERE, core, mantle, crust, land, world);

    this.addSlotToContainer(core);
    this.addSlotToContainer(mantle);
    this.addSlotToContainer(crust);
    this.addSlotToContainer(land);
    this.addSlotToContainer(world);
    this.addSlotToContainer(atmosphere);
}
ContainerInventorySearcher.java 文件源码 项目:pnc-repressurized 阅读 21 收藏 0 点赞 0 评论 0
public ContainerInventorySearcher(InventoryPlayer inventoryPlayer) {
    // Add the player's inventory slots to the container
    for (int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for (int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 48 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for (int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 106));
    }
}
GuiUpgradeStation.java 文件源码 项目:Mods 阅读 28 收藏 0 点赞 0 评论 0
public GuiUpgradeStation(InventoryPlayer playerInv, TileEntityUpgrades station, World worldIn,
        BlockPos blockPosition) {
    super(new ContainerUpgrades(Minecraft.getMinecraft().player, playerInv, station, worldIn, blockPosition));
    this.station = station;
    this.xSize = 230;
    this.ySize = 216;
    // this.itemsToRender=new ItemStack[9];
}
ExPHandlerServer.java 文件源码 项目:ExPetrum 阅读 25 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onContainerOpened(PlayerContainerEvent.Open event)
{
       if (!SettingsFlags.instance.enableCustomInventory)
       {
           return;
       }

    try
    {
        Container c = event.getContainer();
        for (int i = 0; i < c.inventorySlots.size(); ++i)
        {
            Slot s = c.inventorySlots.get(i);
            if (s.getClass().equals(Slot.class) && s.inventory instanceof InventoryPlayer && !(s instanceof ManagedSlot) && s.getSlotIndex() >= 9 && s.getSlotIndex() < 36)
            {
                ManagedSlot wrapper = new ManagedSlot(s);
                c.inventorySlots.remove(i);
                c.inventorySlots.add(i, wrapper);
            }
        }
    }
    catch (Exception ex)
    {
        ExPMisc.modLogger.log(LogLevel.Error, "ExPetrum was unable to initialize it's inventory system! This is most likely caused by another mod!", ex);
    }
}
ContainerOmnidirectionalHopper.java 文件源码 项目:pnc-repressurized 阅读 18 收藏 0 点赞 0 评论 0
public ContainerOmnidirectionalHopper(InventoryPlayer inventoryPlayer, TileEntityOmnidirectionalHopper te) {
    super(te);

    addUpgradeSlots(23, 29);

    for (int i = 0; i < TileEntityOmnidirectionalHopper.INVENTORY_SIZE; i++) {
        addSlotToContainer(new SlotItemHandler(te.getPrimaryInventory(), i, 68 + i * 18, 36));
    }

    addPlayerSlots(inventoryPlayer, 84);
}
ContainerInfusionAltar.java 文件源码 项目:ArcaneMagic 阅读 18 收藏 0 点赞 0 评论 0
public ContainerInfusionAltar(InventoryPlayer playerInventory, TileEntityInfusionAltar te)
{
    super();
    this.te = te;
    addOwnSlots();
    addPlayerSlots(playerInventory);
}


问题


面经


文章

微信
公众号

扫码关注公众号