use of net.minecraft.entity.player.EntityPlayer in project ArsMagica2 by Mithion.
the class SimpleBlockRenderHandler method RenderBrokenPowerLink.
private void RenderBrokenPowerLink(RenderBlocks renderer, int x, int y, int z) {
EntityPlayer player = AMCore.proxy.getLocalPlayer();
if ((x == 0 && y == 0 && z == 0) || (player != null && player.getCurrentArmor(3) != null && player.getCurrentArmor(3).getItem() == ItemsCommonProxy.magitechGoggles)) {
Block block = BlocksCommonProxy.brokenLinkBlock;
renderer.overrideBlockTexture = block.getIcon(0, 0);
renderer.renderStandardBlock(block, x, y, z);
renderer.overrideBlockTexture = null;
}
}
use of net.minecraft.entity.player.EntityPlayer in project ArsMagica2 by Mithion.
the class TileEntityBlackAurem method updateEntity.
@Override
public void updateEntity() {
if (worldObj.isRemote) {
this.rotation += this.rotationIncrement;
} else {
surroundingCheckTicks++;
}
if (worldObj.isRemote || ticksSinceLastEntityScan++ > 25) {
updateNearbyEntities();
ticksSinceLastEntityScan = 0;
}
Iterator<EntityLivingBase> it = cachedEntities.iterator();
while (it.hasNext()) {
EntityLivingBase ent = it.next();
if (ent.isDead) {
it.remove();
continue;
}
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(Vec3.createVectorHelper(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5), Vec3.createVectorHelper(ent.posX, ent.posY + ent.getEyeHeight(), ent.posZ), false);
if (EntityUtilities.isSummon(ent) || mop != null) {
continue;
}
ent.motionY = 0;
ent.motionX = 0;
ent.motionZ = 0;
double deltaX = this.xCoord + 0.5f - ent.posX;
double deltaZ = this.zCoord + 0.5f - ent.posZ;
double deltaY = this.yCoord - ent.posY;
double angle = Math.atan2(deltaZ, deltaX);
double offsetX = Math.cos(angle) * 0.1;
double offsetZ = Math.sin(angle) * 0.1;
double offsetY = 0.05f;
double distanceHorizontal = deltaX * deltaX + deltaZ * deltaZ;
double distanceVertical = this.yCoord - ent.posY;
boolean spawnedParticles = false;
if (distanceHorizontal < 1.3) {
if (distanceVertical < -1.5) {
if (worldObj.isRemote && worldObj.rand.nextInt(10) < 3) {
AMCore.proxy.particleManager.BoltFromPointToPoint(worldObj, xCoord + 0.5, yCoord + 1.3, zCoord + 0.5, ent.posX, ent.posY, ent.posZ, 4, 0x000000);
}
}
if (distanceVertical < -2) {
offsetY = 0;
if (!worldObj.isRemote) {
if (ent.attackEntityFrom(DamageSources.darkNexus, 4)) {
if (ent.getHealth() <= 0) {
ent.setDead();
float power = ((int) Math.ceil((ent.getMaxHealth() * (ent.ticksExisted / 20)) % 5000)) * this.powerMultiplier;
PowerNodeRegistry.For(this.worldObj).insertPower(this, PowerTypes.DARK, power);
}
}
}
}
}
if (worldObj.isRemote) {
if (!arcs.containsKey(ent)) {
AMLineArc arc = (AMLineArc) AMCore.proxy.particleManager.spawn(worldObj, "textures/blocks/oreblocksunstone.png", xCoord + 0.5, yCoord + 1.3, zCoord + 0.5, ent);
if (arc != null) {
arc.setExtendToTarget();
arc.setRBGColorF(1, 1, 1);
}
arcs.put(ent, arc);
}
Iterator arcIterator = arcs.keySet().iterator();
ArrayList<Entity> toRemove = new ArrayList<Entity>();
while (arcIterator.hasNext()) {
Entity arcEnt = (Entity) arcIterator.next();
AMLineArc arc = (AMLineArc) arcs.get(arcEnt);
if (arcEnt == null || arcEnt.isDead || arc == null || arc.isDead || new AMVector3(ent).distanceSqTo(new AMVector3(xCoord, yCoord, zCoord)) > 100)
toRemove.add(arcEnt);
}
for (Entity e : toRemove) {
arcs.remove(e);
}
}
if (!worldObj.isRemote)
ent.moveEntity(offsetX, offsetY, offsetZ);
}
if (surroundingCheckTicks % 100 == 0) {
checkNearbyBlockState();
surroundingCheckTicks = 1;
if (!worldObj.isRemote && PowerNodeRegistry.For(this.worldObj).checkPower(this, this.capacity * 0.1f)) {
List<EntityPlayer> nearbyPlayers = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.xCoord - 2, this.yCoord, this.zCoord - 2, this.xCoord + 2, this.yCoord + 3, this.zCoord + 2));
for (EntityPlayer p : nearbyPlayers) {
if (p.isPotionActive(BuffList.manaRegen.id))
continue;
p.addPotionEffect(new BuffEffectManaRegen(600, 3));
}
}
//TODO:
/*if (rand.nextDouble() < (this.getCharge() / this.getCapacity()) * 0.01){
int maxSev = (int)Math.ceil((this.getCharge() / this.getCapacity()) * 2) + rand.nextInt(2);
IllEffectsManager.instance.ApplyRandomBadThing(this, IllEffectSeverity.values()[maxSev], BadThingTypes.DARKNEXUS);
}*/
}
super.callSuperUpdate();
}
use of net.minecraft.entity.player.EntityPlayer in project ArsMagica2 by Mithion.
the class EntityAILightningBolt method doStrike.
private void doStrike() {
EntityLightningGuardian guardian = getEntity();
if (guardian.getAttackTarget() != null && guardian.getEntitySenses().canSee(guardian.getAttackTarget())) {
if (guardian.getDistanceSqToEntity(guardian.getAttackTarget()) > 400) {
guardian.getNavigator().tryMoveToEntityLiving(guardian.getAttackTarget(), 0.5f);
return;
}
guardian.getNavigator().clearPathEntity();
if (guardian.getRNG().nextDouble() > 0.2f) {
AMCore.proxy.particleManager.BoltFromEntityToEntity(guardian.worldObj, guardian, guardian, guardian.getAttackTarget(), 0);
guardian.getAttackTarget().attackEntityFrom(DamageSources.causeEntityLightningDamage(guardian), 3);
if (guardian.getAttackTarget() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) guardian.getAttackTarget();
if (player.capabilities.isFlying)
player.capabilities.isFlying = false;
if (player.isRiding())
player.dismountEntity(player.ridingEntity);
}
} else {
AMCore.proxy.particleManager.BoltFromEntityToPoint(guardian.worldObj, guardian, guardian.getAttackTarget().posX - 0.5 + guardian.getRNG().nextDouble(), guardian.getAttackTarget().posY - 0.5 + guardian.getRNG().nextDouble() + guardian.getAttackTarget().getEyeHeight(), guardian.getAttackTarget().posZ - 0.5 + guardian.getRNG().nextDouble());
}
}
}
use of net.minecraft.entity.player.EntityPlayer in project ArsMagica2 by Mithion.
the class EntityAISmash method updateTask.
@Override
public void updateTask() {
host.getLookHelper().setLookPositionWithEntity(host.getAttackTarget(), 30, 30);
host.getNavigator().tryMoveToEntityLiving(target, moveSpeed);
if (host.getDistanceSqToEntity(target) < 16)
if (((IArsMagicaBoss) host).getCurrentAction() != BossActions.SMASH)
((IArsMagicaBoss) host).setCurrentAction(BossActions.SMASH);
if (((IArsMagicaBoss) host).getCurrentAction() == BossActions.SMASH && ((IArsMagicaBoss) host).getTicksInCurrentAction() == 18) {
if (!host.worldObj.isRemote)
host.worldObj.playSoundAtEntity(host, ((IArsMagicaBoss) host).getAttackSound(), 1.0f, 1.0f);
List<EntityLivingBase> aoeEntities = host.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, host.boundingBox.expand(4, 2, 4));
for (EntityLivingBase ent : aoeEntities) {
if (ent == host)
continue;
ent.attackEntityFrom(DamageSources.causeDamage(damageType, host, true), 8);
if (ent instanceof EntityPlayer) {
AMNetHandler.INSTANCE.sendVelocityAddPacket(host.worldObj, ent, 0, 1.3f, 0);
} else {
ent.addVelocity(0, 1.4f, 0);
}
}
if (!host.worldObj.isRemote) {
for (int i = 0; i < 4; ++i) {
EntityShockwave shockwave = new EntityShockwave(host.worldObj);
shockwave.setPosition(host.posX, host.posY, host.posZ);
shockwave.setMoveSpeedAndAngle(0.5f, MathHelper.wrapAngleTo180_float(host.rotationYaw + (90 * i)));
host.worldObj.spawnEntityInWorld(shockwave);
}
}
}
}
use of net.minecraft.entity.player.EntityPlayer in project ArsMagica2 by Mithion.
the class EntityAIHurricane method continueExecuting.
@Override
public boolean continueExecuting() {
EntityLivingBase AITarget = ((EntityLiving) host).getAttackTarget();
if (host.hitCount >= 10) {
((IArsMagicaBoss) host).setCurrentAction(BossActions.IDLE);
cooldownTicks = 20;
return false;
}
if (AITarget == null || AITarget.isDead || ((IArsMagicaBoss) host).getTicksInCurrentAction() > BossActions.SPINNING.getMaxActionTime()) {
if (!host.worldObj.isRemote) {
int y = (int) host.posY + 1;
for (int x = -1; x <= 1; ++x) {
for (int z = -1; z <= 1; ++z) {
while (!host.worldObj.canBlockSeeTheSky((int) host.posX + x, y, (int) host.posZ + z) && host.worldObj.getBlock((int) host.posX + x, y, (int) host.posZ + z) != Blocks.bedrock) {
host.worldObj.func_147478_e((int) host.posX + x, y++, (int) host.posZ + z, true);
}
y = (int) host.posY + 2;
}
}
}
List<EntityLivingBase> nearbyEntities = host.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, host.boundingBox.expand(2, 2, 2));
for (EntityLivingBase ent : nearbyEntities) {
if (ent == host)
continue;
AMVector3 movement = MathUtilities.GetMovementVectorBetweenPoints(new AMVector3(host), new AMVector3(ent));
float factor = 2.15f;
double x = -(movement.x * factor);
double y = 2.5f;
double z = -(movement.z * factor);
ent.attackEntityFrom(DamageSources.causeEntityWindDamage(host), 12);
ent.addVelocity(x, y, z);
if (ent instanceof EntityPlayer) {
AMNetHandler.INSTANCE.sendVelocityAddPacket(host.worldObj, ent, x, y, z);
}
ent.fallDistance = 0f;
}
((IArsMagicaBoss) host).setCurrentAction(BossActions.IDLE);
cooldownTicks = 20;
return false;
}
return true;
}
Aggregations