本文整理了Java中net.minecraft.world.World.removeEntity()
方法的一些代码示例,展示了World.removeEntity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.removeEntity()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:removeEntity
暂无
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public void removeEntity(@Nonnull Entity entityIn) {
wrapped.removeEntity(entityIn);
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public void removeEntity(Entity entityIn) {
getActualWorld().removeEntity(entityIn);
}
代码示例来源:origin: TeamWizardry/Wizardry
@Override
public void onUpdate() {
super.onUpdate();
if (world == null || infuserPos == null) return;
TileEntity tile = world.getTileEntity(infuserPos);
if (!(tile instanceof TileHaloInfuser)) {
world.removeEntity(this);
}
}
代码示例来源:origin: TeamWizardry/Wizardry
@Override
public void finish(World world, BlockPos pos, List<EntityItem> items) {
EntityItem item = items.stream().filter(entity -> entity.getItem().getItem() instanceof IExplodable).findFirst().orElse(null);
if (item != null) {
((IExplodable) item.getItem().getItem()).explode(item);
world.setBlockToAir(pos);
world.removeEntity(item);
world.playSound(null, item.posX, item.posY, item.posZ, ModSounds.GLASS_BREAK, SoundCategory.AMBIENT, 0.5F, (RandUtil.nextFloat() * 0.4F) + 0.8F);
}
}
}
代码示例来源:origin: TeamWizardry/Wizardry
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
if (entity instanceof EntityFairy) {
EntityFairy fairy = (EntityFairy) entity;
ItemNBTHelper.setBoolean(stack, Constants.NBT.FAIRY_INSIDE, true);
ItemNBTHelper.setInt(stack, Constants.NBT.FAIRY_COLOR, fairy.getColor().getRGB());
ItemNBTHelper.setInt(stack, Constants.NBT.FAIRY_AGE, fairy.getAge());
entity.world.removeEntity(entity);
return true;
}
return false;
}
代码示例来源:origin: CyclopsMC/EvilCraft
private static void replaceEntity(EntityLiving old, EntityLiving neww, World world) {
// TODO: A nice update effect?
// Maybe something like this: https://github.com/iChun/Morph/blob/master/morph/client/model/ModelMorphAcquisition.java
neww.copyLocationAndAnglesFrom(old);
world.removeEntity(old);
world.spawnEntity(neww);
world.playEvent(null, 1016, old.getPosition(), 0);
}
代码示例来源:origin: TeamWizardry/Wizardry
public void refreshEntities() {
entities.forEach(entityHaloInfusionItem -> world.removeEntity(entityHaloInfusionItem));
entities.clear();
int count = HaloInfusionItemRegistry.getItems().size();
double radius = 3;
for (int i = 0; i < count; i++) {
float angle = (float) (i * Math.PI * 2.0 / count);
double x = (pos.getX() + 0.5 + MathHelper.cos(angle) * radius);
double z = (pos.getZ() + 0.5 + MathHelper.sin(angle) * radius);
EntityHaloInfusionItem entity = new EntityHaloInfusionItem(world, HaloInfusionItemRegistry.EMPTY, getPos(), i);
entity.setPosition(x, pos.getY() + 2, z);
entity.forceSpawn = true;
world.spawnEntity(entity);
entities.add(entity);
}
}
代码示例来源:origin: ldtteam/minecolonies
colony.getWorld().removeEntity(list.get(i));
代码示例来源:origin: TeamWizardry/Wizardry
@Override
public void onLivingUpdate() {
super.onLivingUpdate();
if (world.isRemote) return;
if (isAIDisabled()) return;
if (ticksExisted >= getDataManager().get(TIMER)) {
world.removeEntity(this);
}
UUID uuid = null;
if (getRevengeTarget() != null) uuid = getRevengeTarget().getUniqueID();
if (uuid != null && getDataManager().get(OWNER).isPresent() && uuid.equals(getDataManager().get(OWNER).get())) {
setRevengeTarget(null);
}
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
private boolean consumeLivingEntity(EntityLivingBase entity, float strength) {
try {
mass = Math.addExact(mass, (long) Math.min(entity.getHealth(), strength));
markDirty();
} catch (ArithmeticException e) {
return false;
}
if (entity.getHealth() <= strength && !(entity instanceof EntityPlayer)) {
entity.setDead();
world.removeEntity(entity);
}
DamageSource damageSource = new DamageSource("blackHole");
entity.attackEntityFrom(damageSource, strength);
return true;
}
代码示例来源:origin: CyclopsMC/EvilCraft
private void captureSpirit(VengeanceSpirit targetSpirit) {
for (EntityPlayerMP player : targetSpirit.getEntanglingPlayers()) {
Advancements.BOX_OF_ETERNAL_CLOSURE_CAPTURE.trigger(player, targetSpirit.getInnerEntity());
}
world.removeEntity(targetSpirit);
this.playerId = targetSpirit.getPlayerId();
this.playerName = targetSpirit.getPlayerName();
setSpirit(targetSpirit);
setTargetSpirit(null);
close();
}
代码示例来源:origin: CyclopsMC/EvilCraft
this.world.removeEntity(this);
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
private boolean consumeEntityItem(EntityItem entityItem) {
ItemStack itemStack = entityItem.getItem();
if (!itemStack.isEmpty()) {
try {
mass = Math.addExact(mass, (long) MatterHelper.getMatterAmountFromItem(itemStack) * (long) itemStack.getCount());
markDirty();
} catch (ArithmeticException e) {
return false;
}
entityItem.setDead();
world.removeEntity(entityItem);
if (entityItem.getItem().getItem() instanceof MatterItem && MatterItem.getType(entityItem.getItem()) == MatterItem.MatterType.ANTIMATTER) {
collapse();
}
return true;
}
return false;
}
代码示例来源:origin: PrinceOfAmber/Cyclic
/**
* incoming: convert EXP to fluid
*/
private void updateCollection() {
//expand only goes ONE direction. so expand(3...) goes 3 in + x, but not both ways. for full boc centered at this..!! we go + and -
AxisAlignedBB region = new AxisAlignedBB(this.getPos().up()).expand(RADIUS, VRADIUS, RADIUS).expand(-1 * RADIUS, -1 * VRADIUS, -1 * RADIUS);//expandXyz
List<EntityXPOrb> orbs = getWorld().getEntitiesWithinAABB(EntityXPOrb.class, region);
if (orbs != null) { //no timer just EAT
for (EntityXPOrb orb : orbs) {
if (orb.isDead || orb.delayBeforeCanPickup > 0) {
continue;
}
this.tank.fill(new FluidStack(FluidRegistry.getFluid("xpjuice"), orb.getXpValue() * FLUID_PER_EXP), true);
//we have no "set exp value" function so this is workaround to set value to zero
orb.delayBeforeCanPickup = 9999;//set delay because it will be isDead=true for a little while until actually removed. prevent other mods getting dead orbs
orb.xpValue = 0;
getWorld().removeEntity(orb);//calls orb.setDead(); for me
}
}
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
private boolean consumeFallingBlock(EntityFallingBlock fallingBlock) {
ItemStack itemStack = new ItemStack(fallingBlock.getBlock().getBlock(), 1, fallingBlock.getBlock().getBlock().damageDropped(fallingBlock.getBlock()));
if (!itemStack.isEmpty()) {
try {
mass = Math.addExact(mass, (long) MatterHelper.getMatterAmountFromItem(itemStack) * (long) itemStack.getCount());
markDirty();
} catch (ArithmeticException e) {
return false;
}
fallingBlock.setDead();
world.removeEntity(fallingBlock);
return true;
}
return false;
}
代码示例来源:origin: TeamWizardry/Wizardry
/**
* Called when the projectile entity hits another block or entity, or reaches the end of its path.
*
* @param data The {@link SpellData} attached to the spell.
*/
protected void goBoom(SpellRing spellRing, SpellData data) {
motionX = 0;
motionY = 0;
motionZ = 0;
if (spellRing.getChildRing() != null)
spellRing.getChildRing().runSpellRing(data);
if (doesRender())
PacketHandler.NETWORK.sendToAllAround(new PacketExplode(getPositionVector(), spellRing.getPrimaryColor(), spellRing.getSecondaryColor(), 0.3, 0.3, RandUtil.nextInt(30, 50), 10, 25, true),
new NetworkRegistry.TargetPoint(world.provider.getDimension(), posX, posY, posZ, 512));
setDead();
world.removeEntity(this);
}
代码示例来源:origin: TeamWizardry/Wizardry
@Override
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) {
TileEntity tile = world.getTileEntity(infuserPos);
if (!(tile instanceof TileHaloInfuser)) {
world.removeEntity(this);
return false;
}
ItemStack heldItem = player.getHeldItem(hand);
if (heldItem.isEmpty()) {
ItemStack slotted = getHaloInfusionItem().getStack();
if (!slotted.isEmpty()) {
player.setHeldItem(hand, slotted);
setHaloInfusionItem(HaloInfusionItemRegistry.EMPTY, false);
return true;
} else return true;
}
for (HaloInfusionItem haloInfusionItem : HaloInfusionItemRegistry.getItems()) {
if (haloInfusionItem.getStack().isItemEqual(heldItem)) {
setHaloInfusionItem(haloInfusionItem, false);
// todo: remove from hand
return true;
}
}
return true;
}
代码示例来源:origin: CyclopsMC/EvilCraft
@Override
public boolean attackEntityAsMob(Entity entity) {
if(getBuildupDuration() > 0) return false; // Don't attack anything when still building up.
this.setDead();
this.world.removeEntity(this);
if(entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
if(Loader.isModLoaded(Reference.MOD_THAUMCRAFT)) {
addWarp((EntityPlayer) entity);
}
if(!Configs.isEnabled(BurningGemStoneConfig.class)
|| BurningGemStone.damageForPlayer(player, isSwarm() ? getSwarmTier() : 0, false)) {
entity.addVelocity(
(double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * 0.01F),
0.025D,
(double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * 0.01F));
entity.attackEntityFrom(DamageSource.causeMobDamage(this), 0.1F);
return false;
}
}
return super.attackEntityAsMob(entity);
}
代码示例来源:origin: CoFH/CoFHCore
public static List<ItemStack> breakBlock(World worldObj, EntityPlayer player, BlockPos pos, IBlockState state, int fortune, boolean doBreak, boolean silkTouch) {
if (state.getBlockHardness(worldObj, pos) == -1) {
return new LinkedList<>();
}
NonNullList<ItemStack> ret = NonNullList.create();
if (silkTouch && state.getBlock().canSilkHarvest(worldObj, pos, state, player)) {
ret.add(createStackedBlock(state));
} else {
state.getBlock().getDrops(ret, worldObj, pos, state, fortune);
}
if (!doBreak) {
return ret;
}
worldObj.playEvent(2001, pos, Block.getStateId(state));
worldObj.setBlockToAir(pos);
List<EntityItem> result = worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos.getX() - 2, pos.getY() - 2, pos.getZ() - 2, pos.getX() + 3, pos.getY() + 3, pos.getZ() + 3));
for (EntityItem entity : result) {
if (entity.isDead || entity.getItem().getCount() <= 0) {
continue;
}
ret.add(entity.getItem());
entity.world.removeEntity(entity);
}
return ret;
}
代码示例来源:origin: CyclopsMC/EvilCraft
if(getRemainingLife() <= 0) {
this.setDead();
world.removeEntity(this);
内容来源于网络,如有侵权,请联系作者删除!