本文整理汇总了Java中net.minecraft.entity.item.EntityItem.setDead方法的典型用法代码示例。如果您正苦于以下问题:Java EntityItem.setDead方法的具体用法?Java EntityItem.setDead怎么用?Java EntityItem.setDead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.item.EntityItem
的用法示例。
在下文中一共展示了EntityItem.setDead方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: work
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Override
public float work() {
if (WorkUtils.isDisabled(this.getBlockType())) return 0;
AxisAlignedBB area = getWorkingArea();
List<EntityLiving> mobs = this.getWorld().getEntitiesWithinAABB(EntityLiving.class, area);
if (mobs.size() == 0) return 0;
FakePlayer player = IndustrialForegoing.getFakePlayer(world);
AtomicBoolean hasWorked = new AtomicBoolean(false);
mobs.stream().filter(entityLiving -> !hasAddon() || (!(entityLiving instanceof EntityAgeable) || !entityLiving.isChild())).forEach(entityLiving -> {
entityLiving.attackEntityFrom(DamageSource.causePlayerDamage(player), Integer.MAX_VALUE);
hasWorked.set(true);
});
List<EntityItem> items = this.getWorld().getEntitiesWithinAABB(EntityItem.class, area);
for (EntityItem item : items) {
if (!item.getItem().isEmpty()) {
ItemHandlerHelper.insertItem(outItems, item.getItem(), false);
item.setDead();
}
}
return hasWorked.get() ? 1 : 0;
}
示例2: updateEquipmentIfNeeded
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
* Tests if this entity should pickup a weapon or an armor. Entity drops current weapon or armor if the new one is
* better.
*/
protected void updateEquipmentIfNeeded(EntityItem itemEntity)
{
ItemStack itemstack = itemEntity.getEntityItem();
Item item = itemstack.getItem();
if (this.canVillagerPickupItem(item))
{
ItemStack itemstack1 = this.villagerInventory.addItem(itemstack);
if (itemstack1.func_190926_b())
{
itemEntity.setDead();
}
else
{
itemstack.func_190920_e(itemstack1.func_190916_E());
}
}
}
示例3: plantAll
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private void plantAll(List<EntityItem> items, World world, BlockPos pos, int amplifier) {
int box = 1 + (int) ((float) amplifier / 2F);
BlockPos posI = pos.add(box, 1, box);
BlockPos posF = pos.add(-box, -1, -box);
Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
for (EntityItem item : items) {
ItemStack stack = item.getItem();
for (BlockPos spot : spots) {
if (stack.isEmpty()) {
item.setDead();
break;
}
IBlockState state = world.getBlockState(spot);
IPlantable seed = (IPlantable) stack.getItem();
if (world.isAirBlock(spot.up()) && state.getBlock().canSustainPlant(state, world, spot, EnumFacing.UP, seed)) {
world.setBlockState(spot.up(), seed.getPlant(world, spot.up()));
stack.shrink(1);
}
}
}
}
示例4: 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() instanceof ItemFood)
{
UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.CLOUD, pos.getX(), pos.getY(), pos.getZ(), 6));
item.getEntityItem().stackSize--;
if (item.getEntityItem().stackSize <= 0)
item.setDead();
return true;
}
}
}
return false;
}
示例5: updateEquipmentIfNeeded
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Override
protected void updateEquipmentIfNeeded(EntityItem itemEntity) {
ItemStack stack = itemEntity.getItem();
if (canFriendermanPickupItem(stack)) {
if (lidClosed) {
lidClosed = false;
lidOpening = true;
}
ItemStack itemstack1 = ItemStack.EMPTY;
if (!lidClosed && !lidOpening) {
itemstack1 = InventoryUtils.addItem(getHeldChestInventory(), stack);
if (itemstack1.isEmpty()) {
if (movingTowardItem != null) {
movingTowardItem = null;
}
itemEntity.setDead();
}
else {
stack.setCount(itemstack1.getCount());
}
}
}
}
示例6: pickupItem
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
protected void pickupItem(EntityItem itemEntity) {
ItemStack stack = itemEntity.getItem();
if (thePet.canFriendermanPickupItem(stack)) {
if (thePet.lidClosed) {
thePet.lidClosed = false;
thePet.lidOpening = true;
}
ItemStack itemstack1 = ItemStack.EMPTY;
if (!thePet.lidClosed && !thePet.lidOpening) {
itemstack1 = InventoryUtils.addItem(thePet.getHeldChestInventory(), stack);
if (itemstack1.isEmpty()) {
if (currentTargetItem != null) {
currentTargetItem = null;
}
itemEntity.setDead();
}
else {
stack.setCount(itemstack1.getCount());
}
}
}
}
示例7: updateEquipmentIfNeeded
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
/**
* Tests if this entity should pickup a weapon or an armor. Entity drops current weapon or armor if the new one is
* better.
*/
protected void updateEquipmentIfNeeded(EntityItem itemEntity)
{
ItemStack itemstack = itemEntity.getEntityItem();
Item item = itemstack.getItem();
if (this.canVillagerPickupItem(item))
{
ItemStack itemstack1 = this.villagerInventory.func_174894_a(itemstack);
if (itemstack1 == null)
{
itemEntity.setDead();
}
else
{
itemstack.stackSize = itemstack1.stackSize;
}
}
}
示例8: doImport
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
protected boolean doImport(int maxItems) {
boolean success = false;
// Suck from input inventory
IItemHandler handler = IOHelper.getInventoryForTE(IOHelper.getNeighbor(this, inputDir));
if (handler != null) {
for (int i = 0; i < maxItems; i++) {
LocatedItemStack extracted = IOHelper.extractOneItem(handler, true);
if (!extracted.stack.isEmpty()) {
ItemStack excess = ItemHandlerHelper.insertItem(inventory, extracted.stack, false);
if (excess.isEmpty()) {
handler.extractItem(extracted.slot, 1, false);
success = true;
} else {
break;
}
} else {
break;
}
}
}
// Suck in item entities
for (EntityItem entity : getNeighborItems(this, inputDir)) {
if (!entity.isDead) {
ItemStack remainder = IOHelper.insert(this, entity.getItem(), null, false);
if (remainder.isEmpty()) {
entity.setDead();
success = true;
}
}
}
return success;
}
示例9: captureEntityItemsInChamber
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private void captureEntityItemsInChamber(){
AxisAlignedBB bbBox = getChamberAABB();
List<EntityItem> items = getWorld().getEntitiesWithinAABB(EntityItem.class, bbBox);
for(EntityItem item : items){
if(!item.isDead){
ItemStack stack = item.getItem();
ItemStack leftover = ItemHandlerHelper.insertItem(itemsInChamber, stack, false);
if(leftover.isEmpty()) item.setDead();
else item.setItem(stack);
}
}
}
示例10: makeQuantum
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private void makeQuantum(EntityItem entity) {
if(entity.isEntityAlive() && entity.getClass().equals(EntityItem.class)) {
EntityCrystalQuartzItem item = new EntityCrystalQuartzItem(entity);
item.setMotion(entity.motionX, entity.motionY, entity.motionZ);
item.setNoGravity(true);
entity.world.spawnEntity(item);
entity.setDead();
}
}
示例11: 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;
}
}
示例12: buildSupportBlock
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private void buildSupportBlock(EntityItem entityItem) {
ItemStack blockStack = entityItem.getItem();
ItemStack actual = blockStack.splitStack(1);
if (blockStack.isEmpty()) {
entityItem.setDead();
}
IMeeCreep entity = helper.getMeeCreep();
World world = entity.getWorld();
Block block = ((ItemBlock) actual.getItem()).getBlock();
IBlockState stateForPlacement = block.getStateForPlacement(world, supportPosTodo.south(), EnumFacing.DOWN, 0, 0, 0, actual.getItem().getMetadata(actual), GeneralTools.getHarvester(), EnumHand.MAIN_HAND);
world.setBlockState(supportPosTodo.south(), stateForPlacement, 3);
placeLadder(supportPosTodo);
supportPosTodo = null;
}
示例13: map
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
private void map(EntityItem entity) {
if(entity instanceof EntityTemporalItem) {
((EntityTemporalItem) entity).lifeTime = 10;
return;
}
EntityTemporalItem item = new EntityTemporalItem(entity);
item.setMotion(entity.motionX, entity.motionY, entity.motionZ);
item.setMotionRest(0.85F);
world.spawnEntity(item);
entity.setDead();
}
示例14: doExport
import net.minecraft.entity.item.EntityItem; //导入方法依赖的package包/类
@Override
protected boolean doExport(int maxItems) {
EnumFacing dir = getRotation();
if (tank.getFluid() != null) {
TileEntity neighbor = IOHelper.getNeighbor(this, dir);
if (neighbor != null && neighbor.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, dir.getOpposite())) {
IFluidHandler fluidHandler = neighbor.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, dir.getOpposite());
int amount = Math.min(maxItems * 100, tank.getFluid().amount - (leaveMaterial ? 1000 : 0));
FluidStack transferred = FluidUtil.tryFluidTransfer(fluidHandler, tank, amount, true);
return transferred != null && transferred.amount > 0;
}
}
if (getWorld().isAirBlock(getPos().offset(dir))) {
for (EntityItem entity : getNeighborItems(this, dir)) {
if (!entity.isDead) {
NonNullList<ItemStack> returnedItems = NonNullList.create();
if (FluidUtils.tryFluidExtraction(tank, entity.getItem(), returnedItems)) {
if (entity.getItem().getCount() <= 0) entity.setDead();
for (ItemStack stack : returnedItems) {
EntityItem item = new EntityItem(getWorld(), entity.posX, entity.posY, entity.posZ, stack);
item.motionX = entity.motionX;
item.motionY = entity.motionY;
item.motionZ = entity.motionZ;
getWorld().spawnEntity(item);
}
return true;
}
}
}
}
if (getUpgrades(EnumUpgrade.DISPENSER) > 0) {
if (getWorld().isAirBlock(getPos().offset(dir))) {
FluidStack extractedFluid = tank.drain(1000, false);
if (extractedFluid != null && extractedFluid.amount == 1000) {
Block fluidBlock = extractedFluid.getFluid().getBlock();
if (fluidBlock != null) {
tank.drain(1000, true);
getWorld().setBlockState(getPos().offset(dir), fluidBlock.getDefaultState());
}
}
}
}
return false;
}