當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。