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


Java InventoryPlayer类代码示例

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


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

示例1: sendSlotContents

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的package包/类
@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);
	}
	
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:26,代码来源:RemoteShellEntity.java

示例2: ContainerCreative

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

示例3: ContainerHopper

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

示例4: ContainerMerchant

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

示例5: canCraft

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的package包/类
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;
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:18,代码来源:TileEntityAutoWorkBench.java

示例6: ContainerProgrammer

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的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

示例7: removeItemsFromPlayer

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的package包/类
/**
 * 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;
				}
			}
		}
	}
}
 
开发者ID:DonBruce64,项目名称:OpenFlexiTrack,代码行数:32,代码来源:BlockSurveyFlag.java

示例8: ContainerAmmoFurnace

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的package包/类
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));
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:17,代码来源:ContainerAmmoFurnace.java

示例9: ContainerBrewingStand

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

示例10: ContainerBrewingStand

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

示例11: ContainerApiary

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的package包/类
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));
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:21,代码来源:ContainerApiary.java

示例12: GuiEnchantment

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的package包/类
public GuiEnchantment(InventoryPlayer inventory, World worldIn, IWorldNameable nameable)
{
    super(new ContainerEnchantment(inventory, worldIn));
    this.playerInventory = inventory;
    this.container = (ContainerEnchantment)this.inventorySlots;
    this.nameable = nameable;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:GuiEnchantment.java

示例13: ContainerPersonalCharger

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的package包/类
public ContainerPersonalCharger(final EntityPlayer player, TileEntityBase tile) {

        tilePersonalCharger = (TilePersonalCharger) tile;
        InventoryPlayer inventory = player.inventory;
        addPlayerSlots(inventory);
        addUpgradeSlots(((TilePersonalCharger) tile).getUpgradeStackHandler());
    }
 
开发者ID:CreeperShift,项目名称:WirelessCharger,代码行数:8,代码来源:ContainerPersonalCharger.java

示例14: combineSlots

import net.minecraft.entity.player.InventoryPlayer; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:41,代码来源:InventoryCommandsImplementation.java

示例15: GuiEnchantment

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


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