本文整理汇总了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;
}
}