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


Java ItemStack.areItemStackTagsEqual方法代码示例

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


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

示例1: setInventorySlotContents

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Sets the given item stack to the specified slot in the inventory (can be
 * crafting or armor sections).
 */
@Override
public void setInventorySlotContents(int index, @Nullable ItemStack stack) {
	boolean flag = !stack.isEmpty() && stack.isItemEqual(this.furnaceItemStacks.get(index))
			&& ItemStack.areItemStackTagsEqual(stack, this.furnaceItemStacks.get(index));
	this.furnaceItemStacks.set(index, stack);

	if (!stack.isEmpty() && stack.getCount() > this.getInventoryStackLimit())
		stack.setCount( this.getInventoryStackLimit());

	if (index < 9 && !flag) {
		this.totalCookTime = this.getCookTime(stack);
		this.cookTime = 0;
		this.markDirty();
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:20,代码来源:TileEntityAmmoFurnace.java

示例2: canItemStacksStackRelaxed

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * A relaxed version of canItemStacksStack that stacks itemstacks with different metadata if they don't have subtypes.
 * This usually only applies when players pick up items.
 */
public static boolean canItemStacksStackRelaxed(ItemStack a, ItemStack b)
{
    if (a == null || b == null || a.getItem() != b.getItem())
        return false;

    if (!a.isStackable())
        return false;

    // Metadata value only matters when the item has subtypes
    // Vanilla stacks non-subtype items with different metadata together
    // e.g. a stick with metadata 0 and a stick with metadata 1 stack
    if (a.getHasSubtypes() && a.getMetadata() != b.getMetadata())
        return false;

    return ItemStack.areItemStackTagsEqual(a, b);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:ItemHandlerHelper.java

示例3: setInventorySlotContents

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
 */
public void setInventorySlotContents(int index, ItemStack stack)
{
    boolean flag = stack != null && stack.isItemEqual(this.furnaceItemStacks[index]) && ItemStack.areItemStackTagsEqual(stack, this.furnaceItemStacks[index]);
    this.furnaceItemStacks[index] = stack;

    if (stack != null && stack.stackSize > this.getInventoryStackLimit())
    {
        stack.stackSize = this.getInventoryStackLimit();
    }

    if (index == 0 && !flag)
    {
        this.totalCookTime = this.getCookTime(stack);
        this.cookTime = 0;
        this.markDirty();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:TileEntityFurnace.java

示例4: canItemStacksStack

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static boolean canItemStacksStack(ItemStack a, ItemStack b)
{
    if (a == null || !a.isItemEqual(b))
        return false;

    return ItemStack.areItemStackTagsEqual(a, b);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:ItemHandlerHelper.java

示例5: equals

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
public boolean equals(Object o)
{
    if (!(o instanceof ContainerKey)) return false;
    ContainerKey ck = (ContainerKey)o;
    if (container.getItem() != ck.container.getItem()) return false;
    if (container.getItemDamage() != ck.container.getItemDamage()) return false;
    if (!ItemStack.areItemStackTagsEqual(container, ck.container)) return false;
    if (fluid == null && ck.fluid != null) return false;
    if (fluid != null && ck.fluid == null) return false;
    if (fluid == null && ck.fluid == null) return true;
    if (fluid.getFluid() != ck.fluid.getFluid()) return false;
    return true;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:FluidContainerRegistry.java

示例6: canAddItemToSlot

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Checks if it's possible to add the given itemstack to the given slot.
 */
public static boolean canAddItemToSlot(Slot slotIn, ItemStack stack, boolean stackSizeMatters)
{
    boolean flag = slotIn == null || !slotIn.getHasStack();

    if (slotIn != null && slotIn.getHasStack() && stack != null && stack.isItemEqual(slotIn.getStack()) && ItemStack.areItemStackTagsEqual(slotIn.getStack(), stack))
    {
        flag |= slotIn.getStack().stackSize + (stackSizeMatters ? 0 : stack.stackSize) <= stack.getMaxStackSize();
    }

    return flag;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:Container.java

示例7: storeItemStack

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * stores an itemstack in the users inventory
 */
private int storeItemStack(ItemStack itemStackIn)
{
    for (int i = 0; i < this.mainInventory.length; ++i)
    {
        if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && this.mainInventory[i].stackSize < this.mainInventory[i].getMaxStackSize() && this.mainInventory[i].stackSize < this.getInventoryStackLimit() && (!this.mainInventory[i].getHasSubtypes() || this.mainInventory[i].getMetadata() == itemStackIn.getMetadata()) && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn))
        {
            return i;
        }
    }

    return -1;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:InventoryPlayer.java

示例8: setInventorySlotContents

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
public void setInventorySlotContents (int index, @Nonnull ItemStack stack) {
    boolean stackEqual = !stack.isEmpty() && stack.isItemEqual(this.furnaceItemStacks.get(index)) && ItemStack.areItemStackTagsEqual(stack, this.furnaceItemStacks.get(index));
    furnaceItemStacks.set(index, stack);

    if (!stack.isEmpty() && stack.getCount() > getInventoryStackLimit())
        stack.setCount(getInventoryStackLimit());

    if (index == SLOT_PRIMARY && !stackEqual) {
        totalCookTime = getCookTime(stack);
        cookTime = 0;
        markDirty();
    }
}
 
开发者ID:jaquadro,项目名称:GardenStuff,代码行数:15,代码来源:TileBloomeryFurnace.java

示例9: isHittingPosition

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private boolean isHittingPosition(BlockPos pos)
{
    ItemStack itemstack = this.mc.player.getHeldItemMainhand();
    boolean flag = this.currentItemHittingBlock.func_190926_b() && itemstack.func_190926_b();

    if (!this.currentItemHittingBlock.func_190926_b() && !itemstack.func_190926_b())
    {
        flag = itemstack.getItem() == this.currentItemHittingBlock.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.currentItemHittingBlock) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.currentItemHittingBlock.getMetadata());
    }

    return pos.equals(this.currentBlock) && flag;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:PlayerControllerMP.java

示例10: combineSlots

import net.minecraft.item.ItemStack; //导入方法依赖的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

示例11: updateTick

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * The update tick for the ingame UI
 */
public void updateTick()
{
    if (this.recordPlayingUpFor > 0)
    {
        --this.recordPlayingUpFor;
    }

    if (this.titlesTimer > 0)
    {
        --this.titlesTimer;

        if (this.titlesTimer <= 0)
        {
            this.displayedTitle = "";
            this.displayedSubTitle = "";
        }
    }

    ++this.updateCounter;

    if (this.mc.player != null)
    {
        ItemStack itemstack = this.mc.player.inventory.getCurrentItem();

        if (itemstack.func_190926_b())
        {
            this.remainingHighlightTicks = 0;
        }
        else if (!this.highlightingItemStack.func_190926_b() && itemstack.getItem() == this.highlightingItemStack.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.highlightingItemStack) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.highlightingItemStack.getMetadata()))
        {
            if (this.remainingHighlightTicks > 0)
            {
                --this.remainingHighlightTicks;
            }
        }
        else
        {
            this.remainingHighlightTicks = 40;
        }

        this.highlightingItemStack = itemstack;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:47,代码来源:GuiIngame.java

示例12: areMergeCandidates

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
boolean areMergeCandidates(ItemStack source, ItemStack target) {
	return source.isItemEqual(target) && ItemStack.areItemStackTagsEqual(source, target) && target.getCount() < target.getMaxStackSize();
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:4,代码来源:EntityFrienderman.java

示例13: isItemStackConsideredEqual

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static boolean isItemStackConsideredEqual(ItemStack result, ItemStack itemstack1) {
    return ItemStackTools.isValid(itemstack1) && itemstack1.getItem() == result.getItem() && (!result.getHasSubtypes() || result.getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(result, itemstack1);
}
 
开发者ID:McJty,项目名称:interactionwheel,代码行数:4,代码来源:InventoryHelper.java

示例14: findFirstAvailableSlotFor

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@SuppressWarnings("SuspiciousNameCombination")
   public static int findFirstAvailableSlotFor(ItemStack is, Optional<Map<Pair<Integer, Integer>, Boolean>> data, EntityPlayer player)
{
	InventoryPlayer inventory = player.inventory;
	for (int i = 0; i < inventory.getSizeInventory(); ++i)
	{
		ItemStack stack = player.inventory.getStackInSlot(i);
		if (ItemStack.areItemsEqual(stack, is) && ItemStack.areItemStackTagsEqual(stack, is))
		{
			int max = Math.min(player.openContainer != null ? player.openContainer.getSlot(i).getItemStackLimit(stack) : inventory.getInventoryStackLimit(), stack.getMaxStackSize());
			if (stack.getCount() < max)
			{
				return Short.MAX_VALUE + i;
			}
		}
	}
	
	for (int i = 0; i < 9; ++i)
	{
		if (inventory.getStackInSlot(i).isEmpty())
		{
			return i;
		}
	}
	
	Map<Pair<Integer, Integer>, Boolean> lookup = data.orElseGet(() -> PlayerInventoryHelper.getSlotData(player));
	Pair<Byte, Byte> volume = getVolume(is);
	slotLoop: for (int i = 9; i < 36; ++i)
	{
		int x = (i - 9) % 9;
		int y = (i - 9) / 9;
		if (x + volume.getLeft() > 9 || y + volume.getRight() > 3)
		{
			continue;
		}
		
		Pair<Integer, Integer> pos = Pair.of(x, y);
		if (lookup.containsKey(pos) && lookup.get(pos))
		{
			continue;
		}
		
		for (int dx = x; dx < x + volume.getLeft(); ++dx)
		{
			for (int dy = y; dy < y + volume.getRight(); ++dy)
			{
				pos = Pair.of(dx, dy);
				if (dx >= 9 || dy >= 3 || (lookup.containsKey(pos) && lookup.get(pos)))
				{
				    continue slotLoop;
				}
			}
		}
		
		return i;
	}
	
	return -1;
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:60,代码来源:PlayerInventoryHelper.java

示例15: updateTick

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * The update tick for the ingame UI
 */
public void updateTick()
{
    if (this.recordPlayingUpFor > 0)
    {
        --this.recordPlayingUpFor;
    }

    if (this.field_175195_w > 0)
    {
        --this.field_175195_w;

        if (this.field_175195_w <= 0)
        {
            this.field_175201_x = "";
            this.field_175200_y = "";
        }
    }

    ++this.updateCounter;
    this.streamIndicator.func_152439_a();

    if (this.mc.thePlayer != null)
    {
        ItemStack itemstack = this.mc.thePlayer.inventory.getCurrentItem();

        if (itemstack == null)
        {
            this.remainingHighlightTicks = 0;
        }
        else if (this.highlightingItemStack != null && itemstack.getItem() == this.highlightingItemStack.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.highlightingItemStack) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.highlightingItemStack.getMetadata()))
        {
            if (this.remainingHighlightTicks > 0)
            {
                --this.remainingHighlightTicks;
            }
        }
        else
        {
            this.remainingHighlightTicks = 40;
        }

        this.highlightingItemStack = itemstack;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:48,代码来源:GuiIngame.java


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