本文整理汇总了Java中net.minecraft.entity.Entity.setDead方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.setDead方法的具体用法?Java Entity.setDead怎么用?Java Entity.setDead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.setDead方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Schedule the entity for removal during the next tick. Marks the entity dead in anticipation.
*/
public void removeEntity(Entity entityIn)
{
if (entityIn.isBeingRidden())
{
entityIn.removePassengers();
}
if (entityIn.isRiding())
{
entityIn.dismountRidingEntity();
}
entityIn.setDead();
if (entityIn instanceof EntityPlayer)
{
this.playerEntities.remove(entityIn);
this.updateAllPlayersSleepingFlag();
this.onEntityRemoved(entityIn);
}
}
示例2: removeEntityDangerously
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Do NOT use this method to remove normal entities- use normal removeEntity
*/
public void removeEntityDangerously(Entity entityIn)
{
entityIn.setDropItemsWhenDead(false);
entityIn.setDead();
if (entityIn instanceof EntityPlayer)
{
this.playerEntities.remove(entityIn);
this.updateAllPlayersSleepingFlag();
}
int i = entityIn.chunkCoordX;
int j = entityIn.chunkCoordZ;
if (entityIn.addedToChunk && this.isChunkLoaded(i, j, true))
{
this.getChunkFromChunkCoords(i, j).removeEntity(entityIn);
}
this.loadedEntityList.remove(entityIn);
this.onEntityRemoved(entityIn);
}
示例3: removePlayerEntityDangerously
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Do NOT use this method to remove normal entities- use normal removeEntity
*/
public void removePlayerEntityDangerously(Entity entityIn)
{
entityIn.setDead();
if (entityIn instanceof EntityPlayer)
{
this.playerEntities.remove(entityIn);
this.updateAllPlayersSleepingFlag();
}
int i = entityIn.chunkCoordX;
int j = entityIn.chunkCoordZ;
if (entityIn.addedToChunk && this.isChunkLoaded(i, j, true))
{
this.getChunkFromChunkCoords(i, j).removeEntity(entityIn);
}
this.loadedEntityList.remove(entityIn);
this.onEntityRemoved(entityIn);
}
示例4: removeEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Schedule the entity for removal during the next tick. Marks the entity dead in anticipation.
*/
public void removeEntity(Entity entityIn)
{
if (entityIn.riddenByEntity != null)
{
entityIn.riddenByEntity.mountEntity((Entity)null);
}
if (entityIn.ridingEntity != null)
{
entityIn.mountEntity((Entity)null);
}
entityIn.setDead();
if (entityIn instanceof EntityPlayer)
{
this.playerEntities.remove(entityIn);
this.updateAllPlayersSleepingFlag();
this.onEntityRemoved(entityIn);
}
}
示例5: onHackFinished
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public void onHackFinished(Entity entity, EntityPlayer player) {
if (!entity.world.isRemote) {
entity.setDead();
EntitySpider spider = new EntitySpider(entity.world);
spider.setPositionAndRotation(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
spider.setHealth(((EntitySpider) entity).getHealth());
spider.renderYawOffset = ((EntitySpider) entity).renderYawOffset;
entity.world.spawnEntity(spider);
}
}
示例6: onHackFinished
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public void onHackFinished(Entity entity, EntityPlayer player) {
if (!entity.world.isRemote) {
entity.setDead();
EntityMooshroom entitycow = new EntityMooshroom(entity.world);
entitycow.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
entitycow.setHealth(((EntityCow) entity).getHealth());
entitycow.renderYawOffset = ((EntityCow) entity).renderYawOffset;
entity.world.spawnEntity(entitycow);
entity.world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, entity.posX, entity.posY + entity.height / 2.0F, entity.posZ, 0.0D, 0.0D, 0.0D);
}
}
示例7: onHackFinished
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public void onHackFinished(Entity entity, EntityPlayer player) {
if (!entity.world.isRemote) {
entity.setDead();
entity.world.createExplosion(null, entity.posX, entity.posY, entity.posZ, 0, false);
}
}
示例8: pushEntities
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void pushEntities(World world, BlockPos pos, Vec3d tileVec) {
AxisAlignedBB bbBox = new AxisAlignedBB(pos.add(-grateRange, -grateRange, -grateRange), pos.add(grateRange + 1, grateRange + 1, grateRange + 1));
List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, bbBox, new StringFilterEntitySelector().setFilter(entityFilter));
double d0 = grateRange + 0.5D;
for (Entity entity : entities) {
if (!entity.world.isRemote && entity.getDistanceSq(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D) < 0.6D && entity instanceof EntityItem && !entity.isDead) {
ItemStack leftover = ((EntityItem) entity).getItem();
for (EnumFacing dir : EnumFacing.VALUES) {
TileEntity inv = pressureTube.world().getTileEntity(pos.offset(dir));
leftover = IOHelper.insert(inv, leftover, dir.getOpposite(), false);
if (leftover.isEmpty()) break;
}
if (leftover.isEmpty()) {
entity.setDead();
} else {
((EntityItem) entity).setItem(leftover);
}
} else {
if (!(entity instanceof EntityPlayer) || !((EntityPlayer) entity).capabilities.isCreativeMode) {
Vec3d entityVec = new Vec3d(entity.posX, entity.posY, entity.posZ);
RayTraceResult trace = world.rayTraceBlocks(entityVec, tileVec);
if (trace != null && trace.getBlockPos().equals(pos)) {
double d1 = (entity.posX - pos.getX() - 0.5D) / d0;
double d2 = (entity.posY - pos.getY() - 0.5D) / d0;
double d3 = (entity.posZ - pos.getZ() - 0.5D) / d0;
double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
double d5 = 1.0D - d4;
if (d5 > 0.0D) {
d5 *= d5;
if (!vacuum) d5 *= -1;
entity.motionX -= d1 / d4 * d5 * 0.1D;
entity.motionY -= d2 / d4 * d5 * 0.1D;
entity.motionZ -= d3 / d4 * d5 * 0.1D;
}
}
}
}
}
}
示例9: updateEntityWithOptionalForce
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Will update the entity in the world if the chunk the entity is in is currently loaded or its forced to update.
* Args: entity, forceUpdate
*/
public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate)
{
if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal || entityIn instanceof EntityWaterMob))
{
entityIn.setDead();
}
if (!this.canSpawnNPCs() && entityIn instanceof INpc)
{
entityIn.setDead();
}
super.updateEntityWithOptionalForce(entityIn, forceUpdate);
}
示例10: addEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Adds an entity to the chunk. Args: entity
*/
public void addEntity(Entity entityIn)
{
this.hasEntities = true;
int i = MathHelper.floor_double(entityIn.posX / 16.0D);
int j = MathHelper.floor_double(entityIn.posZ / 16.0D);
if (i != this.xPosition || j != this.zPosition)
{
logger.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.xPosition + ", " + this.zPosition + "), " + entityIn, new Object[] {entityIn});
entityIn.setDead();
}
int k = MathHelper.floor_double(entityIn.posY / 16.0D);
if (k < 0)
{
k = 0;
}
if (k >= this.entityLists.length)
{
k = this.entityLists.length - 1;
}
entityIn.addedToChunk = true;
entityIn.chunkCoordX = this.xPosition;
entityIn.chunkCoordY = k;
entityIn.chunkCoordZ = this.zPosition;
this.entityLists[k].add(entityIn);
}
示例11: updateEntityWithOptionalForce
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Updates the entity in the world if the chunk the entity is in is currently loaded or its forced to update.
*/
public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate)
{
if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal || entityIn instanceof EntityWaterMob))
{
entityIn.setDead();
}
if (!this.canSpawnNPCs() && entityIn instanceof INpc)
{
entityIn.setDead();
}
super.updateEntityWithOptionalForce(entityIn, forceUpdate);
}
示例12: addEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Adds an entity to the chunk.
*/
public void addEntity(Entity entityIn)
{
this.hasEntities = true;
int i = MathHelper.floor_double(entityIn.posX / 16.0D);
int j = MathHelper.floor_double(entityIn.posZ / 16.0D);
if (i != this.xPosition || j != this.zPosition)
{
LOGGER.warn("Wrong location! ({}, {}) should be ({}, {}), {}", new Object[] {Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(this.xPosition), Integer.valueOf(this.zPosition), entityIn, entityIn});
entityIn.setDead();
}
int k = MathHelper.floor_double(entityIn.posY / 16.0D);
if (k < 0)
{
k = 0;
}
if (k >= this.entityLists.length)
{
k = this.entityLists.length - 1;
}
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(entityIn, this.xPosition, this.zPosition, entityIn.chunkCoordX, entityIn.chunkCoordZ));
entityIn.addedToChunk = true;
entityIn.chunkCoordX = this.xPosition;
entityIn.chunkCoordY = k;
entityIn.chunkCoordZ = this.zPosition;
this.entityLists[k].add(entityIn);
}
示例13: onLeftClickEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
if(!player.isCreative()) return super.onLeftClickEntity(stack, player, entity);
if(entity instanceof EntityLivingBase) ((EntityLivingBase)entity).onDeath(DamageSource.causePlayerDamage(player));
entity.setDead(); // bypasses all invulerabilities
return false; // bypass the damaging mechanic
}
示例14: onEntityJoinWorld
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
if (!event.getWorld().isRemote)
{
ForgeChunkManager.loadEntity(event.getEntity());
}
Entity entity = event.getEntity();
if (entity.getClass().equals(EntityItem.class))
{
ItemStack stack = ((EntityItem)entity).getEntityItem();
if (stack == null)
{
//entity.setDead();
//event.setCanceled(true);
return;
}
Item item = stack.getItem();
if (item == null)
{
FMLLog.warning("Attempted to add a EntityItem to the world with a invalid item at " +
"(%2.2f, %2.2f, %2.2f), this is most likely a config issue between you and the server. Please double check your configs",
entity.posX, entity.posY, entity.posZ);
entity.setDead();
event.setCanceled(true);
return;
}
if (item.hasCustomEntity(stack))
{
Entity newEntity = item.createEntity(event.getWorld(), entity, stack);
if (newEntity != null)
{
entity.setDead();
event.setCanceled(true);
event.getWorld().spawnEntityInWorld(newEntity);
}
}
}
}
示例15: dieEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static void dieEntity(Entity ent) { ent.setDead(); }