use of net.minecraft.entity.EntityLiving in project ArsMagica2 by Mithion.
the class TileEntitySummoner method updateEntity.
@Override
public void updateEntity() {
super.updateEntity();
prevSummonCooldown = summonCooldown;
summonCooldown--;
if (summonCooldown < 0)
summonCooldown = 0;
if (!worldObj.isRemote && summonCooldown == 0 && prevSummonCooldown > 0) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
if (!worldObj.isRemote) {
EntityLiving ent = getSummonedCreature();
if (ent == null) {
summonEntityID = -1;
}
if (isRedstonePowered() && inventory[SUMMON_SLOT] != null) {
if (PowerNodeRegistry.For(this.worldObj).checkPower(this, maintainCost)) {
if (ent == null && canSummon()) {
summonCreature();
} else {
if (ent != null) {
PowerNodeRegistry.For(this.worldObj).consumePower(this, PowerNodeRegistry.For(this.worldObj).getHighestPowerType(this), maintainCost);
}
}
} else {
unsummonCreature();
}
} else {
if (ent != null) {
unsummonCreature();
PowerNodeRegistry.For(this.worldObj).insertPower(this, PowerTypes.NEUTRAL, summonCost / 2);
}
}
}
}
use of net.minecraft.entity.EntityLiving in project ArsMagica2 by Mithion.
the class TileEntitySummoner method unsummonCreature.
private void unsummonCreature() {
if (worldObj.isRemote)
return;
EntityLiving ent = getSummonedCreature();
if (ent == null)
return;
ent.attackEntityFrom(DamageSources.unsummon, 1000000);
this.summonEntityID = -1;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
use of net.minecraft.entity.EntityLiving in project SecurityCraft by Geforce132.
the class BlockSecurityCamera method mountCamera.
public void mountCamera(World world, int par2, int par3, int par4, int par5, EntityPlayer player) {
if (!world.isRemote && player.getRidingEntity() == null) {
PlayerUtils.sendMessageToPlayer(player, I18n.translateToLocal("tile.securityCamera.name"), I18n.translateToLocal("messages.securityCamera.mounted"), TextFormatting.GREEN);
}
if (player.getRidingEntity() != null && player.getRidingEntity() instanceof EntitySecurityCamera) {
EntitySecurityCamera dummyEntity = new EntitySecurityCamera(world, par2, par3, par4, par5, (EntitySecurityCamera) player.getRidingEntity());
world.spawnEntityInWorld(dummyEntity);
player.startRiding(dummyEntity);
return;
}
EntitySecurityCamera dummyEntity = new EntitySecurityCamera(world, par2, par3, par4, par5, player);
world.spawnEntityInWorld(dummyEntity);
player.startRiding(dummyEntity);
for (Object e : world.loadedEntityList) {
if (e instanceof EntityLiving) {
if (((EntityLiving) e).getAttackTarget() == player)
((EntityLiving) e).setAttackTarget(null);
}
}
}
use of net.minecraft.entity.EntityLiving in project Realistic-Terrain-Generation by Team-RTG.
the class NecronomiconSummonRitual method completeRitualServer.
@Override
protected void completeRitualServer(World world, BlockPos pos, EntityPlayer player) {
EntityLivingBase entityliving = null;
try {
entityliving = entity.getConstructor(World.class).newInstance(world);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
if (entityliving != null) {
entityliving.setLocationAndAngles(pos.getX(), pos.getY() + 1, pos.getZ(), entityliving.rotationYaw, entityliving.rotationPitch);
((EntityLiving) entityliving).onInitialSpawn(world.getDifficultyForLocation(pos.up()), (IEntityLivingData) null);
world.spawnEntity(entityliving);
}
}
Aggregations