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


Java ItemStackHandler.getSlots方法代码示例

本文整理汇总了Java中net.minecraftforge.items.ItemStackHandler.getSlots方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStackHandler.getSlots方法的具体用法?Java ItemStackHandler.getSlots怎么用?Java ItemStackHandler.getSlots使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.items.ItemStackHandler的用法示例。


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

示例1: writeToNBT

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {

    super.writeToNBT(tag);
    tag.setTag("Items", inventory.serializeNBT());

    NBTTagCompound tankTag = new NBTTagCompound();
    tank.writeToNBT(tankTag);
    tag.setTag("tank", tankTag);

    ItemStackHandler handler = new ItemStackHandler(getFakePlayer().inventory.getSizeInventory());
    for (int i = 0; i < handler.getSlots(); i++) {
        handler.setStackInSlot(i, getFakePlayer().inventory.getStackInSlot(i));
    }
    tag.setTag("droneItems", handler.serializeNBT());

    return tag;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:TileEntityProgrammableController.java

示例2: retrieveValue

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
@Override
protected ItemStackHandler retrieveValue(Field field, Object te) throws Exception {
    ItemStackHandler handler = (ItemStackHandler) field.get(te);
    ItemStackHandler result = new ItemStackHandler(handler.getSlots());
    for (int i = 0; i < handler.getSlots(); i++) {
        result.setStackInSlot(i, handler.getStackInSlot(i));
    }
    return result;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:SyncedField.java

示例3: injectValue

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
@Override
protected void injectValue(Field field, Object te, ItemStackHandler value) throws Exception {
    ItemStackHandler handler = (ItemStackHandler) field.get(te);
    for (int i = 0; i < value.getSlots(); i++) {
        handler.setStackInSlot(i, value.getStackInSlot(i));
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:SyncedField.java

示例4: equals

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
@Override
protected boolean equals(ItemStackHandler oldValue, ItemStackHandler newValue) {
    if (oldValue.getSlots() != newValue.getSlots()) return false;
    for (int i = 0; i < oldValue.getSlots(); i++) {
        if (!ItemStack.areItemsEqual(oldValue.getStackInSlot(i), newValue.getStackInSlot(i))) {
            return false;
        }
    }
    return true;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:11,代码来源:SyncedField.java

示例5: copyWhenNecessary

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
@Override
protected ItemStackHandler copyWhenNecessary(ItemStackHandler oldValue) {
    ItemStackHandler result = new ItemStackHandler(oldValue.getSlots());
    for (int i = 0; i < oldValue.getSlots(); i++) {
        result.setStackInSlot(i, oldValue.getStackInSlot(i));
    }
    return result;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:SyncedField.java

示例6: canInsert

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
private boolean canInsert(int slot, ItemStackHandler handler, ItemStack stack) {
    if (getReactorsEntries().stream().noneMatch(entry -> entry.doesStackMatch(stack))) {
        return false;
    }
    if (handler.getStackInSlot(slot).isItemEqual(stack)) {
        return true;
    }
    for (int i = 0; i < handler.getSlots(); ++i) {
        if (stack.isItemEqual(handler.getStackInSlot(i)))
            return false;
    }
    return true;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:14,代码来源:AbstractReactorTile.java

示例7: getDefaultOrFind

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
public ItemStack getDefaultOrFind(int i, ItemStackHandler handler, ItemStack filter) {
    if (handler.getStackInSlot(i).isItemEqual(filter)) return handler.getStackInSlot(i);
    for (ItemStackHandler h : new ItemStackHandler[]{top, middle, bottom}) {
        for (int s = 0; s < h.getSlots(); ++s) {
            if (h.getStackInSlot(s).isItemEqual(filter)) return h.getStackInSlot(s);
        }
    }
    return ItemStack.EMPTY;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:10,代码来源:WitherBuilderTile.java

示例8: dropItems

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
public void dropItems() {
    for (ItemStackHandler items : new ItemStackHandler[]{input, storage, output}) {
        for (int i = 0; i < items.getSlots(); ++i) {
            ItemStack stack = items.getStackInSlot(i);
            if (!stack.isEmpty()) {
                InventoryHelper.spawnItemStack(this.getWorld(), pos.getX(), pos.getY(), pos.getZ(), stack);
            }
        }
    }
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:11,代码来源:BlackHoleControllerTile.java

示例9: BaseHarshenContainer

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
public BaseHarshenContainer(ItemStackHandler handler, EntityPlayer player) 
{
	this.handler = handler;
	this.playerInventory = player != null;
	totalSize = handler.getSlots() + (playerInventory ? 36 : 0);
	for(int i = 0; i < handler.getSlots(); i++)
		try 
		{
			getPoint(i);
		} 
		catch (IndexOutOfBoundsException e) 
		{
			throw new IllegalArgumentException("There arnt enough registered points to quantify all the slots");
		}
	
	for(int i = 0; i < handler.getSlots(); i++)
		this.addSlotToContainer(getSlot(handler, i, getPoint(i).x, getPoint(i).y));
	
	if(playerInventory)
	{
		Point p = getInventoryStart();
		for(int y = 0; y < 3; ++y)
			for(int x = 0; x < 9; ++x)
				this.addSlotToContainer(new Slot(player.inventory, x + y * 9 + 9, p.x + x * 18, p.y + y * 18));
		for(int x = 0; x < 9; ++x) 
			this.addSlotToContainer(new Slot(player.inventory, x, p.x + x * 18, p.y + 58));
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:29,代码来源:BaseHarshenContainer.java

示例10: addUpgradeSlots

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
@Override
public void addUpgradeSlots(ItemStackHandler inventory) {

    int x = 152;
    int y = 8;

    // Add our own slots
    int slotIndex = 0;
    for (int i = 0; i < inventory.getSlots(); i++) {
        addSlotToContainer(new SlotItemHandler(inventory, slotIndex, x, y));
        slotIndex++;
        y += 18;
    }

}
 
开发者ID:CreeperShift,项目名称:WirelessCharger,代码行数:16,代码来源:ContainerBase.java

示例11: isEmpty

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
@Override
public boolean isEmpty()
{
    ItemStackHandler hand = ContainerMagibench.this.tile.handler;
    for(int i = 0; i < hand.getSlots(); i++)
        if(!hand.getStackInSlot(i).isEmpty())
            return false;
    return true;
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:10,代码来源:ContainerMagibench.java

示例12: fillStackedContents

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
@Override
public void fillStackedContents(RecipeItemHelper helper)
{
    ItemStackHandler handler = ContainerMagibench.this.tile.handler;
    for (int i = 0; i < handler.getSlots(); i++)
    {
        helper.accountStack(handler.getStackInSlot(i));
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:10,代码来源:ContainerMagibench.java

示例13: addSortSlots

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
private void addSortSlots()
{
	int y = 6;
	int x = 8;

	for(ItemStackHandler handler : te.getSortStacks())
	{
		for(int i = 0; i < handler.getSlots(); i++)
		{
			this.addSlotToContainer(new SlotSorter(handler, i, x + (i * 18), y));
		}
		y += 18;
	}
}
 
开发者ID:Lemonszz,项目名称:Anima-Mundi,代码行数:15,代码来源:ContainerSorter.java

示例14: decrStackInInventory

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
public static void decrStackInInventory(ItemStackHandler handler, int slot) {
    if (slot < 0 || slot >= handler.getSlots()) return;
    ItemStack st = handler.getStackInSlot(slot);
    if (st.isEmpty()) return;
    st.setCount(st.getCount() - 1);
    if (st.getCount() <= 0) {
        handler.setStackInSlot(slot, ItemStack.EMPTY);
    }
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:10,代码来源:ItemUtils.java

示例15: isInventoryFull

import net.minecraftforge.items.ItemStackHandler; //导入方法依赖的package包/类
public static boolean isInventoryFull(ItemStackHandler handler) {
    for (int i = 0; i < handler.getSlots(); ++i) {
        if (handler.getStackInSlot(i).isEmpty()) return false;
    }
    return true;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:7,代码来源:ItemStackUtils.java


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