本文整理汇总了Java中net.minecraft.item.ItemStack.func_190917_f方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.func_190917_f方法的具体用法?Java ItemStack.func_190917_f怎么用?Java ItemStack.func_190917_f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.ItemStack
的用法示例。
在下文中一共展示了ItemStack.func_190917_f方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public ItemStack apply(ItemStack stack, Random rand, LootContext context)
{
Entity entity = context.getKiller();
if (entity instanceof EntityLivingBase)
{
int i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity);
if (i == 0)
{
return stack;
}
float f = (float)i * this.count.generateFloat(rand);
stack.func_190917_f(Math.round(f));
if (this.limit != 0 && stack.func_190916_E() > this.limit)
{
stack.func_190920_e(this.limit);
}
}
return stack;
}
示例2: computeStackSize
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Compute the new stack size, Returns the stack with the new size. Args : dragSlots, dragMode, dragStack,
* slotStackSize
*/
public static void computeStackSize(Set<Slot> dragSlotsIn, int dragModeIn, ItemStack stack, int slotStackSize)
{
switch (dragModeIn)
{
case 0:
stack.func_190920_e(MathHelper.floor((float)stack.func_190916_E() / (float)dragSlotsIn.size()));
break;
case 1:
stack.func_190920_e(1);
break;
case 2:
stack.func_190920_e(stack.getItem().getItemStackLimit());
}
stack.func_190917_f(slotStackSize);
}
示例3: smeltItem
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
*/
public void smeltItem()
{
if (this.canSmelt())
{
ItemStack itemstack = (ItemStack)this.furnaceItemStacks.get(0);
ItemStack itemstack1 = FurnaceRecipes.instance().getSmeltingResult(itemstack);
ItemStack itemstack2 = (ItemStack)this.furnaceItemStacks.get(2);
if (itemstack2.func_190926_b())
{
this.furnaceItemStacks.set(2, itemstack1.copy());
}
else if (itemstack2.getItem() == itemstack1.getItem())
{
itemstack2.func_190917_f(1);
}
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.SPONGE) && itemstack.getMetadata() == 1 && !((ItemStack)this.furnaceItemStacks.get(1)).func_190926_b() && ((ItemStack)this.furnaceItemStacks.get(1)).getItem() == Items.BUCKET)
{
this.furnaceItemStacks.set(1, new ItemStack(Items.WATER_BUCKET));
}
itemstack.func_190918_g(1);
}
}
示例4: func_190901_a
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_)
{
this.onCrafting(p_190901_2_);
NonNullList<ItemStack> nonnulllist = CraftingManager.getInstance().getRemainingItems(this.craftMatrix, p_190901_1_.world);
for (int i = 0; i < nonnulllist.size(); ++i)
{
ItemStack itemstack = this.craftMatrix.getStackInSlot(i);
ItemStack itemstack1 = (ItemStack)nonnulllist.get(i);
if (!itemstack.func_190926_b())
{
this.craftMatrix.decrStackSize(i, 1);
itemstack = this.craftMatrix.getStackInSlot(i);
}
if (!itemstack1.func_190926_b())
{
if (itemstack.func_190926_b())
{
this.craftMatrix.setInventorySlotContents(i, itemstack1);
}
else if (ItemStack.areItemsEqual(itemstack, itemstack1) && ItemStack.areItemStackTagsEqual(itemstack, itemstack1))
{
itemstack1.func_190917_f(itemstack.func_190916_E());
this.craftMatrix.setInventorySlotContents(i, itemstack1);
}
else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack1))
{
this.thePlayer.dropItem(itemstack1, false);
}
}
}
return p_190901_2_;
}
示例5: combineItems
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Tries to merge this item with the item passed as the parameter. Returns true if successful. Either this item or
* the other item will be removed from the world.
*/
private boolean combineItems(EntityItem other)
{
if (other == this)
{
return false;
}
else if (other.isEntityAlive() && this.isEntityAlive())
{
ItemStack itemstack = this.getEntityItem();
ItemStack itemstack1 = other.getEntityItem();
if (this.delayBeforeCanPickup != 32767 && other.delayBeforeCanPickup != 32767)
{
if (this.age != -32768 && other.age != -32768)
{
if (itemstack1.getItem() != itemstack.getItem())
{
return false;
}
else if (itemstack1.hasTagCompound() ^ itemstack.hasTagCompound())
{
return false;
}
else if (itemstack1.hasTagCompound() && !itemstack1.getTagCompound().equals(itemstack.getTagCompound()))
{
return false;
}
else if (itemstack1.getItem() == null)
{
return false;
}
else if (itemstack1.getItem().getHasSubtypes() && itemstack1.getMetadata() != itemstack.getMetadata())
{
return false;
}
else if (itemstack1.func_190916_E() < itemstack.func_190916_E())
{
return other.combineItems(this);
}
else if (itemstack1.func_190916_E() + itemstack.func_190916_E() > itemstack1.getMaxStackSize())
{
return false;
}
else
{
itemstack1.func_190917_f(itemstack.func_190916_E());
other.delayBeforeCanPickup = Math.max(other.delayBeforeCanPickup, this.delayBeforeCanPickup);
other.age = Math.min(other.age, this.age);
other.setEntityItemStack(itemstack1);
this.setDead();
return true;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
示例6: addItem
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public ItemStack addItem(ItemStack stack)
{
ItemStack itemstack = stack.copy();
for (int i = 0; i < this.slotsCount; ++i)
{
ItemStack itemstack1 = this.getStackInSlot(i);
if (itemstack1.func_190926_b())
{
this.setInventorySlotContents(i, itemstack);
this.markDirty();
return ItemStack.field_190927_a;
}
if (ItemStack.areItemsEqual(itemstack1, itemstack))
{
int j = Math.min(this.getInventoryStackLimit(), itemstack1.getMaxStackSize());
int k = Math.min(itemstack.func_190916_E(), j - itemstack1.func_190916_E());
if (k > 0)
{
itemstack1.func_190917_f(k);
itemstack.func_190918_g(k);
if (itemstack.func_190926_b())
{
this.markDirty();
return ItemStack.field_190927_a;
}
}
}
}
if (itemstack.func_190916_E() != stack.func_190916_E())
{
this.markDirty();
}
return itemstack;
}
示例7: insertStack
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Insert the specified stack to the specified inventory and return any leftover items
*/
private static ItemStack insertStack(IInventory inventoryIn, IInventory stack, ItemStack index, int side, EnumFacing p_174916_4_)
{
ItemStack itemstack = stack.getStackInSlot(side);
if (canInsertItemInSlot(stack, index, side, p_174916_4_))
{
boolean flag = false;
boolean flag1 = stack.func_191420_l();
if (itemstack.func_190926_b())
{
stack.setInventorySlotContents(side, index);
index = ItemStack.field_190927_a;
flag = true;
}
else if (canCombine(itemstack, index))
{
int i = index.getMaxStackSize() - itemstack.func_190916_E();
int j = Math.min(index.func_190916_E(), i);
index.func_190918_g(j);
itemstack.func_190917_f(j);
flag = j > 0;
}
if (flag)
{
if (flag1 && stack instanceof TileEntityHopper)
{
TileEntityHopper tileentityhopper1 = (TileEntityHopper)stack;
if (!tileentityhopper1.mayTransfer())
{
int k = 0;
if (inventoryIn != null && inventoryIn instanceof TileEntityHopper)
{
TileEntityHopper tileentityhopper = (TileEntityHopper)inventoryIn;
if (tileentityhopper1.field_190578_g >= tileentityhopper.field_190578_g)
{
k = 1;
}
}
tileentityhopper1.setTransferCooldown(8 - k);
}
}
stack.markDirty();
}
}
return index;
}