本文整理匯總了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(); }