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


Java ItemStack.EMPTY属性代码示例

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


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

示例1: getCraftingResult

@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
    Optional<RandoresItemData> itemDataOptional = extractData(inv);
    if (itemDataOptional.isPresent()) {
        RandoresItemData data = itemDataOptional.get();
        if (RandoresWorldData.contains(data)) {
            MaterialDefinition definition = RandoresWorldData.get(data);
            Component component = this.type.from(definition);
            ItemStack res = definition.createStack(component);
            res.setCount(this.quantity);
            return res;
        }
    }

    return ItemStack.EMPTY;
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:16,代码来源:RandoresItemRecipe.java

示例2: extractItem

@Nonnull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
    if (storage.getStackInSlot(slot).isEmpty() || amount == 0) return ItemStack.EMPTY;
    ItemStack existing = blackHoleUnitBlock.getItemStack(storage.getStackInSlot(slot)).copy();
    if (existing.isEmpty()) return ItemStack.EMPTY;
    int visualAmount = blackHoleUnitBlock.getAmount(storage.getStackInSlot(slot)) + output.getStackInSlot(slot).getCount();
    if (visualAmount <= amount) {
        if (!simulate) {
            blackHoleUnitBlock.setAmount(storage.getStackInSlot(slot), 0);
            output.setStackInSlot(slot, ItemStack.EMPTY);
        }
        return ItemHandlerHelper.copyStackWithSize(existing, visualAmount);
    } else {
        if (!simulate) {
            blackHoleUnitBlock.setAmount(storage.getStackInSlot(slot), Math.max(0, blackHoleUnitBlock.getAmount(storage.getStackInSlot(slot)) - amount));
            output.setStackInSlot(slot, ItemHandlerHelper.copyStackWithSize(existing, Math.min(64, visualAmount - amount)));
        }
        return ItemHandlerHelper.copyStackWithSize(existing, amount);
    }
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:21,代码来源:BlackHoleControllerTile.java

示例3: transferStackInSlot

@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
	ItemStack itemstack = ItemStack.EMPTY;
	Slot slot = this.inventorySlots.get(index);

	if (slot != null && slot.getHasStack()) {
		ItemStack itemstack1 = slot.getStack();
		itemstack = itemstack1.copy();

		if (index < 2) {
			if (!this.mergeItemStack(itemstack1, 2, this.inventorySlots.size(), true)) {
				return ItemStack.EMPTY;
			}
		} else if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
			return ItemStack.EMPTY;
		}

		if (itemstack1.isEmpty()) {
			slot.putStack(ItemStack.EMPTY);
		} else {
			slot.onSlotChanged();
		}
	}

	return itemstack;
}
 
开发者ID:tiffit,项目名称:Defier,代码行数:26,代码来源:DefierContainer.java

示例4: getCraftingResult

@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
	ItemStack out = new ItemStack(ModItems.sword);

	if (adornmentMat == null) {
		adornmentMat = ModMaterials.ADORNMENT_NULL;
	}

	if (bladeMat == null || crossguardMat == null || handleMat == null || adornmentMat == null) {
		return ItemStack.EMPTY;
	}

	NBTTagCompound tag = new NBTTagCompound();
	tag.setString(IBladeTool.BLADE_TAG, bladeMat.getName());
	tag.setString(ICrossguardTool.CROSSGUARD_TAG, crossguardMat.getName());
	tag.setString(IHandleTool.HANDLE_TAG, handleMat.getName());
	tag.setString(IAdornedTool.ADORNMENT_TAG, adornmentMat.getName());
	out.setTagCompound(tag);

	return out;
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:21,代码来源:SwordRecipe.java

示例5: onCraftMatrixChanged

/**
 * Callback for when the crafting matrix is changed.
 */
@Override
public void onCraftMatrixChanged(IInventory inventoryIn) {
	ItemStack stack = ItemStack.EMPTY;
	List<IRecipe> recipes = TF2CraftingManager.INSTANCE.getRecipeList();
	if (currentRecipe >= 0 && currentRecipe < recipes.size()
			&& recipes.get(currentRecipe).matches(this.craftMatrix, world))
		stack = getReplacement(player, recipes.get(currentRecipe).getCraftingResult(this.craftMatrix));
	// ?TF2CraftingManager.INSTANCE.getRecipeList().get(currentRecipe)TF2CraftingManager.INSTANCE.findMatchingRecipe(this.craftMatrix,
	// this.world);
	else
		stack = getReplacement(player, TF2CraftingManager.INSTANCE.findMatchingRecipe(this.craftMatrix, this.world));
	this.craftResult.setInventorySlotContents(0, stack);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:16,代码来源:ContainerTF2Workbench.java

示例6: transferStackInSlot

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int sourceSlotIndex) {
	Slot sourceSlot = inventorySlots.get(sourceSlotIndex);
	if (sourceSlot == null || !sourceSlot.getHasStack())
		return ItemStack.EMPTY;
	ItemStack sourceStack = sourceSlot.getStack();
	ItemStack copyOfSourceStack = sourceStack.copy();

	if (sourceSlotIndex >= VANILLA_FIRST_SLOT_INDEX && sourceSlotIndex < VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT) {
		if (!mergeItemStack(sourceStack, TE_INVENTORY_FIRST_SLOT_INDEX, TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT, false)) {
			return ItemStack.EMPTY;
		}
	} else if (sourceSlotIndex >= TE_INVENTORY_FIRST_SLOT_INDEX && sourceSlotIndex < TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT) {
		if (!mergeItemStack(sourceStack, VANILLA_FIRST_SLOT_INDEX, VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT, false)) {
			return ItemStack.EMPTY;
		}
	} else {
		System.err.print("Invalid slotIndex:" + sourceSlotIndex);
		return ItemStack.EMPTY;
	}

	if (sourceStack.getCount() == 0) {
		sourceSlot.putStack(ItemStack.EMPTY);
	} else {
		sourceSlot.onSlotChanged();
	}

	sourceSlot.onTake(player, sourceStack);
	return copyOfSourceStack;
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:30,代码来源:ContainerStockCrate.java

示例7: drawPost

@Override
public void drawPost(int x, int y, int mouseX, int mouseY, GuiScreen notebook)
{
	// New matrix!
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();

	// Adjust the x and y values to fit the tooltips properly
	x += 22;
	y += 3;

	// Render the tooltips for the recipe matrix
	for (int inputX = 0; inputX < 3; inputX++)
	{
		for (int inputY = 0; inputY < 3; inputY++)
		{
			if (recipeIn[inputY][inputX] != ItemStack.EMPTY)
			{
				// Render the tooltip if the mouse is over the item
				drawItemstackTooltip(recipeIn[inputY][inputX], x + (inputX * 25), y + (inputY * 25), mouseX, mouseY,
						notebook);
			}
		}
	}

	// Draw the tooltip for the output item
	drawItemstackTooltip(recipeOut, x + 113, y + 25, mouseX, mouseY, notebook);

	// Go back to the main render matrix
	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:32,代码来源:NotebookEntryCraftingRecipe.java

示例8: updateEntity

@SubscribeEvent
public void updateEntity(LivingEvent.LivingUpdateEvent event){
    if(event.getEntity() instanceof EntityPlayer && event.getEntity().getAir() <= 300 - Config.ARMOR_TICKS_PER_LANOLIN){
        // The entity is a player and is not at full air
        if(event.getEntity().isInsideOfMaterial(Material.WATER)){
            for(int i = 0; i < 4; i++){
                ItemStack armorPiece = ((EntityPlayer) event.getEntity()).inventory.armorInventory.get(i);
                if(armorPiece != ItemStack.EMPTY){
                    NBTTagCompound tags = armorPiece.getTagCompound();
                    if(tags != null && tags.hasKey("lanolin")){
                        // Found armor with lanolin. Reset air and remove a piece of lanolin.
                        event.getEntity().setAir(300);
                        if(tags.getInteger("lanolin") == 1){
                            // No more lanolin on this item, remove the tag
                            tags.removeTag("lanolin");
                        }
                        else{
                            tags.setInteger("lanolin", tags.getInteger("lanolin")-1);
                        }
                        armorPiece.setTagCompound(tags);
                        ((EntityPlayer) event.getEntity()).inventory.armorInventory.set(i, armorPiece);
                        break;
                    }
                }
            }
        }
    }
}
 
开发者ID:SirLyle,项目名称:Lanolin,代码行数:28,代码来源:EventHandlerCommon.java

示例9: getStackInSlot

@Override
public ItemStack getStackInSlot(int index) {
	if (index < 0 || index >= this.getSizeInventory()) {
		return ItemStack.EMPTY;
	}

	return inventory.get(index);
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:8,代码来源:TileEntityDisplay.java

示例10: extractItem

@Nonnull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
    if (slotChecksEnabled && type.isFuelSlot(slot))
    {
        Item item = getStackInSlot(slot).getItem();
        if (item != Items.WATER_BUCKET && item != Items.BUCKET)
            return ItemStack.EMPTY;
    }

    return super.extractItem(slot, amount, simulate);
}
 
开发者ID:cubex2,项目名称:morefurnaces,代码行数:13,代码来源:ItemHandlerFurnace.java

示例11: getFirstItem

public static ItemStack getFirstItem(IInventory inventory, Predicate<ItemStack> pred) {
	
		for (int i = 0; i<inventory.getSizeInventory(); i++) {
			ItemStack stack=inventory.getStackInSlot(i);
			if (!stack.isEmpty() && pred.apply(stack))
				return stack;
		}
		return ItemStack.EMPTY;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:9,代码来源:TF2Util.java

示例12: readFromNBT

@Override
public void readFromNBT(NBTTagCompound compound)
{
	super.readFromNBT(compound);
	if (compound.hasKey("item"))
	{
		stack = new ItemStack(compound.getCompoundTag("item"));
	} else
	{
		stack = ItemStack.EMPTY;
	}
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:12,代码来源:TileEntityAnimaConjurer.java

示例13: transferStackInSlot

@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
    ItemStack itemstack = ItemStack.EMPTY;
    Slot slot = this.inventorySlots.get(index);

    if (slot != null && slot.getHasStack()) {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();

        if(index >= 0 && index < 36) {
            if(!itemstack1.isEmpty() && itemstack1.getItem() instanceof ItemBlueprint) {
                Slot sb = this.inventorySlots.get(this.slotBlueprint.slotNumber);
                if(!sb.getHasStack()) {
                    if(!this.mergeItemStack(itemstack1, sb.slotNumber, sb.slotNumber + 1, false)) {
                        return ItemStack.EMPTY;
                    }
                }
            }
        }

        if (index >= 0 && index < 27) {
            if (!this.mergeItemStack(itemstack1, 27, 36, false)) {
                return ItemStack.EMPTY;
            }
        } else if (index >= 27 && index < 36) {
            if (!this.mergeItemStack(itemstack1, 0, 27, false)) {
                return ItemStack.EMPTY;
            }
        } else if (!this.mergeItemStack(itemstack1, 0, 36, false)) {
            return ItemStack.EMPTY;
        }

        if (itemstack1.getCount() == 0) {
            slot.putStack(ItemStack.EMPTY);
        } else {
            slot.onSlotChanged();
        }

        if (itemstack1.getCount() == itemstack.getCount()) {
            return ItemStack.EMPTY;
        }

        slot.onTake(playerIn, itemstack1);
    }

    return itemstack;
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:47,代码来源:ContainerController.java

示例14: getItemStackFromSlot

@Override
public ItemStack getItemStackFromSlot(EntityEquipmentSlot slotIn) {
	return ItemStack.EMPTY;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:4,代码来源:EntityEyeOfSchrodinger.java

示例15: getJEIIcon

default ItemStack getJEIIcon(){
    return ItemStack.EMPTY;
}
 
开发者ID:canitzp,项目名称:Metalworks,代码行数:3,代码来源:IGeoburnable.java


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