本文整理匯總了Java中net.minecraft.entity.item.EntityItem.setEntityItemStack方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityItem.setEntityItemStack方法的具體用法?Java EntityItem.setEntityItemStack怎麽用?Java EntityItem.setEntityItemStack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.item.EntityItem
的用法示例。
在下文中一共展示了EntityItem.setEntityItemStack方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: canAdvance
import net.minecraft.entity.item.EntityItem; //導入方法依賴的package包/類
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
for (EntityItem item : items) {
if (!item.isDead && item.getEntityItem() != null) {
if (item.getEntityItem().getItem() == Items.WATER_BUCKET)
{
UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.WATER_DROP, pos.getX(), pos.getY(), pos.getZ(), 6));
item.setEntityItemStack(new ItemStack(Items.BUCKET, 1, 0));
return true;
}
}
}
return false;
}
示例2: putDropInInventoryAllSlots
import net.minecraft.entity.item.EntityItem; //導入方法依賴的package包/類
/**
* Attempts to place the passed EntityItem's stack into the inventory using as many slots as possible. Returns false
* if the stackSize of the drop was not depleted.
*/
public static boolean putDropInInventoryAllSlots(IInventory p_145898_0_, EntityItem itemIn)
{
boolean flag = false;
if (itemIn == null)
{
return false;
}
else
{
ItemStack itemstack = itemIn.getEntityItem().copy();
ItemStack itemstack1 = putStackInInventoryAllSlots(p_145898_0_, itemstack, (EnumFacing)null);
if (itemstack1 != null && itemstack1.stackSize != 0)
{
itemIn.setEntityItemStack(itemstack1);
}
else
{
flag = true;
itemIn.setDead();
}
return flag;
}
}
示例3: putDropInInventoryAllSlots
import net.minecraft.entity.item.EntityItem; //導入方法依賴的package包/類
/**
* Attempts to place the passed EntityItem's stack into the inventory using as many slots as possible. Returns false
* if the stackSize of the drop was not depleted.
*/
public static boolean putDropInInventoryAllSlots(IInventory p_145898_0_, IInventory itemIn, EntityItem p_145898_2_)
{
boolean flag = false;
if (p_145898_2_ == null)
{
return false;
}
else
{
ItemStack itemstack = p_145898_2_.getEntityItem().copy();
ItemStack itemstack1 = putStackInInventoryAllSlots(p_145898_0_, itemIn, itemstack, (EnumFacing)null);
if (itemstack1.func_190926_b())
{
flag = true;
p_145898_2_.setDead();
}
else
{
p_145898_2_.setEntityItemStack(itemstack1);
}
return flag;
}
}