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


Java SlotItemHandler类代码示例

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


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

示例1: ContainerChargingStationItemInventory

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerChargingStationItemInventory(InventoryPlayer inventoryPlayer, TileEntityChargingStation te) {
    super(te);
    if (te.getPrimaryInventory().getStackInSlot(TileEntityChargingStation.CHARGE_INVENTORY_INDEX).isEmpty())
        throw new IllegalArgumentException("instanciating ContainerPneumaticArmor with a charge item being empty!");
    chargeableItemHandler = te.getChargeableInventory();

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            addSlotToContainer(new SlotInventoryLimiting(chargeableItemHandler, i * 3 + j, 31 + j * 18, 24 + i * 18));
        }
    }

    addPlayerSlots(inventoryPlayer, 84);

    // Add the player's armor slots to the container.
    EntityArmorInvWrapper armorInvWrapper = new EntityArmorInvWrapper(inventoryPlayer.player);
    for (int i = 0; i < 4; i++) {
        // order is feet, legs, chest, head; so add slots from bottom up
        addSlotToContainer(new SlotItemHandler(armorInvWrapper, i, 9,  62 - i * 18));
    }

    addSlotToContainer(new SlotUntouchable(te.getPrimaryInventory(), 0, -50000, -50000)); //Allows the charging stack to sync.

}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:25,代码来源:ContainerChargingStationItemInventory.java

示例2: ContainerChargingStation

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerChargingStation(InventoryPlayer inventoryPlayer, TileEntityChargingStation te) {
        super(te);

        // add the cannoned slot.
        addSlotToContainer(new SlotInventoryLimiting(te.getPrimaryInventory(), 0, 91, 39) {
            @Override
            public int getSlotStackLimit() {
                return 1;
            }
        });

        addUpgradeSlots(42, 29);

        // Add the player's armor slots to the container.
        EntityArmorInvWrapper armorInvWrapper = new EntityArmorInvWrapper(inventoryPlayer.player);
        for (int i = 0; i < 4; i++) {
            addSlotToContainer(new SlotItemHandler(armorInvWrapper, i, 9, 62 - i * 18));
//            addSlotToContainer(new SlotPneumaticArmor(inventoryPlayer.player, inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - i,
//                    9, 8 + i * 18, i));
        }

        addPlayerSlots(inventoryPlayer, 84);
    }
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:24,代码来源:ContainerChargingStation.java

示例3: ContainerProgrammer

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
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));
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:23,代码来源:ContainerProgrammer.java

示例4: CraftiniumForgeContainer

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public CraftiniumForgeContainer(CraftiniumForgeTileEntity tileEntity, InventoryPlayer playerInventory) {
    this.tileEntity = tileEntity;
    this.player = playerInventory.player;
    this.world = tileEntity.getWorld();
    this.forge = tileEntity.getPos();
    this.addSlotToContainer(new SlotItemHandler(tileEntity.getInput(), 0, 56, 17));
    this.addSlotToContainer(new SlotItemHandler(tileEntity.getFuel(), 0, 56, 53));
    this.addSlotToContainer(new SlotItemHandler(tileEntity.getOutput(), 0, 116, 35));

    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));
    }
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:20,代码来源:CraftiniumForgeContainer.java

示例5: ContainerPrimalChest

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerPrimalChest(InventoryPlayer invPlayer, TileEntityPrimalChest tile) {
    this.tile = tile;
    for(int i = 0; i < tile.itemStackHandler.getSlots(); i++) {
        addSlotToContainer(new SlotItemHandler(tile.itemStackHandler, i, 8 + 18 * i, 18));
    }
    
    for(int x = 0; x < 9; x++) {
        addSlotToContainer(new Slot(invPlayer, x, 8 + 18 * x, 142));
    }
    
    for(int y = 0; y < 3; y++) {
        for(int x = 0; x < 9; x++) {
            addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 84 + y * 18));
        }
    }
    
}
 
开发者ID:jaredlll08,项目名称:PrimalChests,代码行数:18,代码来源:ContainerPrimalChest.java

示例6: ContainerPrimalChestAdvanced

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerPrimalChestAdvanced(InventoryPlayer invPlayer, TileEntityPrimalChestAdvanced tile) {
    this.tile = tile;
    for(int i = 0; i < 9; i++) {
        addSlotToContainer(new SlotItemHandler(tile.itemStackHandler, i, 8 + 18 * i, 18));
    }
    for(int i = 9; i < tile.itemStackHandler.getSlots(); i++) {
        addSlotToContainer(new SlotItemHandler(tile.itemStackHandler, i, 8 + 18 * (i-9)+36, 36));
    }
    
    for(int x = 0; x < 9; x++) {
        addSlotToContainer(new Slot(invPlayer, x, 8 + 18 * x, 142));
    }
    
    for(int y = 0; y < 3; y++) {
        for(int x = 0; x < 9; x++) {
            addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 84 + y * 18));
        }
    }
    
}
 
开发者ID:jaredlll08,项目名称:PrimalChests,代码行数:21,代码来源:ContainerPrimalChestAdvanced.java

示例7: addSlotAmmo

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public void addSlotAmmo(){
	IItemHandler handler=nullInv;
	ammoBelt=false;
	if(!this.wearables.getStackInSlot(3).isEmpty()&&this.wearables.getStackInSlot(3).hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)){
		handler=this.wearables.getStackInSlot(3).getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
		ammoBelt=true;
	}
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 3; ++j){
			Slot slot=new SlotItemHandler( handler,
					j + i * 3, 98 + j * 18, 18 + i * 18) {

				@Override
				public boolean isItemValid(@Nullable ItemStack stack) {
					return this.getItemHandler()!=nullInv&&!stack.isEmpty() && stack.getItem() instanceof ItemAmmo && super.isItemValid(stack);
				}
			};
			this.inventorySlots.set(this.inventorySlots.size()-9+j + i * 3, slot);
			slot.slotNumber=this.inventorySlots.size()-9+j + i * 3;
		}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:22,代码来源:ContainerWearables.java

示例8: ContainerSmelter

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerSmelter(EntityPlayer player, TileEntitySmelter tileEntitySmelter)
{
	super(tileEntitySmelter);
	PlayerInvWrapper playerInv = (PlayerInvWrapper) player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
	addSlotToContainer(new SlotItemHandler(itemHandler, TileEntitySmelter.INPUT, 46, 17));
	addSlotToContainer(new SlotItemHandler(itemHandler, TileEntitySmelter.FUEL, 56, 53));
	addSlotToContainer(new SlotOutput(itemHandler, TileEntitySmelterBase.OUTPUT, 116, 35));
	addSlotToContainer(new SlotItemHandler(itemHandler, TileEntitySmelter.BOOSTER, 66, 17));

	int i;
	for (i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 9; ++j)
		{
			addSlotToContainer(new SlotItemHandler(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
		}
	}

	for (i = 0; i < 9; ++i)
	{
		addSlotToContainer(new SlotItemHandler(playerInv, i, 8 + i * 18, 142));
	}
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:24,代码来源:ContainerSmelter.java

示例9: ContainerKiln

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerKiln(EntityPlayer player, TileEntityKiln tileEntityKiln)
{
	super(tileEntityKiln);
	PlayerInvWrapper playerInv = (PlayerInvWrapper) player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
	addSlotToContainer(new SlotItemHandler(itemHandler, TileEntityKiln.SLOT_INPUT, 56, 17));
	addSlotToContainer(new SlotConfigurableAccess(itemHandler, TileEntityKiln.SLOT_FUEL, 56, 53));
	addSlotToContainer(new SlotOutput(itemHandler, TileEntityKiln.SLOT_OUTPUT, 116, 35));

	int i;
	for (i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 9; ++j)
		{
			addSlotToContainer(new SlotItemHandler(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
		}
	}

	for (i = 0; i < 9; ++i)
	{
		addSlotToContainer(new SlotItemHandler(playerInv, i, 8 + i * 18, 142));
	}
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:23,代码来源:ContainerKiln.java

示例10: ContainerEnderSmelter

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerEnderSmelter(EntityPlayer player, TileEntityEnderSmelter tileSmelter)
{
	super(tileSmelter);
	PlayerInvWrapper playerInv = (PlayerInvWrapper) player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
	addSlotToContainer(new SlotItemHandler(itemHandler, TileEntitySmelterBase.INPUT, 46, 17));
	addSlotToContainer(new SlotItemHandler(itemHandler, TileEntitySmelterBase.FUEL, 56, 53));
	addSlotToContainer(new SlotOutput(itemHandler, TileEntityEnderSmelter.OUTPUT, 116, 35));
	addSlotToContainer(new SlotItemHandler(itemHandler, TileEntitySmelterBase.BOOSTER, 66, 17));

	int i;
	for (i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 9; ++j)
		{
			addSlotToContainer(new SlotItemHandler(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
		}
	}

	for (i = 0; i < 9; ++i)
	{
		addSlotToContainer(new SlotItemHandler(playerInv, i, 8 + i * 18, 142));
	}
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:24,代码来源:ContainerEnderSmelter.java

示例11: ContainerBackpackEnderBuffer

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerBackpackEnderBuffer(InventoryBackpack backpackInv, EnderBuffer buffer)
{
    IItemHandler inventory = buffer.sendInv;

    for (int j = 0; j < 2; ++j)
    {
        for (int k = 0; k < 5; ++k)
        {
            this.addSlotToContainer(new SlotItemHandler(inventory, k + j * 5, 120 + k * 18, 32 + j * 18));
        }
    }

    for (int py = 0; py < 3; ++py)
    {
        for (int px = 0; px < 9; ++px)
        {
            int slot = px + py * 9 + 9;
            this.addSlotToContainer(new Slot(backpackInv.getPlayer().inventory, slot, 47 + px * 18, 104 + py * 18 - 18));
        }
    }

    for (int slot = 0; slot < 9; ++slot)
    {
        this.addSlotToContainer(new Slot(backpackInv.getPlayer().inventory, slot, 47 + slot * 18, 144));
    }
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:27,代码来源:ContainerBackpackEnderBuffer.java

示例12: ContainerSecurityController

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerSecurityController(EntityPlayer player, TileSecurityController controller){
	for (int i = 0; i < controller.getCards().getSlots(); ++i) {
		if(i >= 8){
			addSlotToContainer(new SlotItemHandler(controller.getCards(), i, ((i-8) * 18)+17, 40));
		}else
           addSlotToContainer(new SlotItemHandler(controller.getCards(), i, (i * 18)+17, 22));
       }
	
	for (int i = 0; i < 3; i++)
       {
           for (int j = 0; j < 9; j++)
           {
               addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
           }
       }

       for (int i = 0; i < 9; i++)
       {
           addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
       }
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:22,代码来源:ContainerSecurityController.java

示例13: ContainerCrafter

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerCrafter(EntityPlayer player, TileCrafter crafter){
	for (int i = 0; i < crafter.getPatterns().getSlots(); ++i) {
		if(i >= 8){
			addSlotToContainer(new SlotItemHandler(crafter.getPatterns(), i, ((i-8) * 18)+17, 40));
		}else
           addSlotToContainer(new SlotItemHandler(crafter.getPatterns(), i, (i * 18)+17, 22));
       }
	
	for (int i = 0; i < 3; i++)
       {
           for (int j = 0; j < 9; j++)
           {
               addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
           }
       }

       for (int i = 0; i < 9; i++)
       {
           addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
       }
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:22,代码来源:ContainerCrafter.java

示例14: ContainerSourceLight

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
public ContainerSourceLight(EntityPlayer player, IItemHandler burningSlot, TileEntitySourceLight tileEntity) {
    this.tileEntity = Optional.fromNullable(tileEntity);
    this.burningSlot = Preconditions.checkNotNull(burningSlot);

    this.addSlotToContainer(new SlotItemHandler(this.burningSlot, 0, 56, 51) {
        @Override
        public boolean isItemValid(ItemStack stack) {
            return TileEntityFurnace.isItemFuel(stack) && super.isItemValid(stack);
        }
    });

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

    for (int i = 0; i < 9; ++i) {
        this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
    }
}
 
开发者ID:InfinityStudio,项目名称:InspiringWorld,代码行数:22,代码来源:ContainerSourceLight.java

示例15: debugPrintSlotInfo

import net.minecraftforge.items.SlotItemHandler; //导入依赖的package包/类
private static void debugPrintSlotInfo(GuiContainer gui, Slot slot)
{
    if (slot == null)
    {
        ItemScroller.logger.info("slot was null");
        return;
    }

    boolean hasSlot = gui.inventorySlots.inventorySlots.contains(slot);
    Object inv = slot instanceof SlotItemHandler ? ((SlotItemHandler) slot).getItemHandler() : slot.inventory;
    String stackStr = InventoryUtils.getStackString(slot.getStack());

    ItemScroller.logger.info(String.format("slot: slotNumber: %d, getSlotIndex(): %d, getHasStack(): %s, " +
            "slot class: %s, inv class: %s, Container's slot list has slot: %s, stack: %s",
            slot.slotNumber, slot.getSlotIndex(), slot.getHasStack(), slot.getClass().getName(),
            inv != null ? inv.getClass().getName() : "<null>", hasSlot ? " true" : "false", stackStr));
}
 
开发者ID:maruohon,项目名称:itemscroller,代码行数:18,代码来源:InputEventHandler.java


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