use of mod.azure.doom.entity.tierboss.IconofsinEntity in project MCDoom by AzureDoom.
the class BFGEntity method doDamage.
public void doDamage() {
float q = 24.0F;
int k = MathHelper.floor(this.getX() - (double) q - 1.0D);
int l = MathHelper.floor(this.getX() + (double) q + 1.0D);
int t = MathHelper.floor(this.getY() - (double) q - 1.0D);
int u = MathHelper.floor(this.getY() + (double) q + 1.0D);
int v = MathHelper.floor(this.getZ() - (double) q - 1.0D);
int w = MathHelper.floor(this.getZ() + (double) q + 1.0D);
List<Entity> list = this.world.getOtherEntities(this, new Box((double) k, (double) t, (double) v, (double) l, (double) u, (double) w));
Vec3d vec3d = new Vec3d(this.getX(), this.getY(), this.getZ());
for (int x = 0; x < list.size(); ++x) {
Entity entity = (Entity) list.get(x);
double y = (double) (MathHelper.sqrt((float) entity.squaredDistanceTo(vec3d)) / q);
if (!(entity instanceof PlayerEntity || entity instanceof EnderDragonEntity || entity instanceof GoreNestEntity || entity instanceof IconofsinEntity) && (entity instanceof HostileEntity || entity instanceof SlimeEntity || entity instanceof PhantomEntity || entity instanceof ShulkerEntity || entity instanceof HoglinEntity)) {
if (y <= 1.0D) {
entity.damage(DamageSource.player((PlayerEntity) this.shooter), DoomMod.config.weapons.bfgball_damage);
if (!this.world.isClient) {
List<LivingEntity> list1 = this.world.getNonSpectatingEntities(LivingEntity.class, this.getBoundingBox().expand(4.0D, 2.0D, 4.0D));
AreaEffectCloudEntity areaeffectcloudentity = new AreaEffectCloudEntity(entity.world, entity.getX(), entity.getY(), entity.getZ());
areaeffectcloudentity.setParticleType(ParticleTypes.TOTEM_OF_UNDYING);
areaeffectcloudentity.setRadius(3.0F);
areaeffectcloudentity.setDuration(10);
if (!list1.isEmpty()) {
for (LivingEntity livingentity : list1) {
double d0 = this.squaredDistanceTo(livingentity);
if (d0 < 16.0D) {
areaeffectcloudentity.updatePosition(entity.getX(), entity.getEyeY(), entity.getZ());
break;
}
}
}
this.world.spawnEntity(areaeffectcloudentity);
}
}
}
if (entity instanceof EnderDragonEntity) {
if (entity.isAlive()) {
((EnderDragonEntity) entity).head.damage(DamageSource.player((PlayerEntity) this.shooter), DoomMod.config.weapons.bfgball_damage_dragon);
}
}
if (entity instanceof IconofsinEntity) {
if (entity.isAlive()) {
entity.damage(DamageSource.player((PlayerEntity) this.shooter), DoomMod.config.weapons.bfgball_damage * 0.1F);
}
}
}
}
use of mod.azure.doom.entity.tierboss.IconofsinEntity in project MCDoom by AzureDoom.
the class BFGEntity method tick.
@Override
public void tick() {
int idleOpt = 100;
if (getVelocity().lengthSquared() < 0.01)
idleTicks++;
else
idleTicks = 0;
if (idleOpt <= 0 || idleTicks < idleOpt)
super.tick();
boolean isInsideWaterBlock = world.isWater(getBlockPos());
spawnLightSource(isInsideWaterBlock);
if (this.age >= 100) {
this.remove(Entity.RemovalReason.DISCARDED);
}
float q = 24.0F;
int k = MathHelper.floor(this.getX() - (double) q - 1.0D);
int l = MathHelper.floor(this.getX() + (double) q + 1.0D);
int t = MathHelper.floor(this.getY() - (double) q - 1.0D);
int u = MathHelper.floor(this.getY() + (double) q + 1.0D);
int v = MathHelper.floor(this.getZ() - (double) q - 1.0D);
int w = MathHelper.floor(this.getZ() + (double) q + 1.0D);
List<Entity> list = this.world.getOtherEntities(this, new Box((double) k, (double) t, (double) v, (double) l, (double) u, (double) w));
Vec3d vec3d1 = new Vec3d(this.getX(), this.getY(), this.getZ());
for (int x = 0; x < list.size(); ++x) {
Entity entity = (Entity) list.get(x);
double y = (double) (MathHelper.sqrt((float) entity.squaredDistanceTo(vec3d1)) / q);
if (!(entity instanceof PlayerEntity || entity instanceof EnderDragonEntity || entity instanceof GoreNestEntity || entity instanceof IconofsinEntity) && (entity instanceof HostileEntity || entity instanceof SlimeEntity || entity instanceof PhantomEntity || entity instanceof ShulkerEntity || entity instanceof HoglinEntity)) {
if (y <= 1.0D) {
if (entity.isAlive()) {
entity.damage(DamageSource.explosion(this.shooter), DoomMod.config.weapons.bfgball_damage_aoe);
setBeamTarget(entity.getId());
}
}
}
if (entity instanceof IconofsinEntity) {
if (entity.isAlive()) {
entity.damage(DamageSource.player((PlayerEntity) this.shooter), DoomMod.config.weapons.bfgball_damage_aoe * 0.1F);
}
}
if (!(entity instanceof PlayerEntity) && entity instanceof EnderDragonEntity) {
if (entity.isAlive()) {
((EnderDragonEntity) entity).head.damage(DamageSource.player((PlayerEntity) this.shooter), DoomMod.config.weapons.bfgball_damage_aoe);
setBeamTarget(entity.getId());
}
}
}
}
use of mod.azure.doom.entity.tierboss.IconofsinEntity in project MCDoom by AzureDoom.
the class DoomFireEntity method tick.
public void tick() {
super.tick();
if (--this.warmup < 0) {
if (!this.startedAttack) {
this.world.sendEntityStatus(this, (byte) 4);
this.startedAttack = true;
}
if (--this.ticksLeft < 0) {
this.remove(Entity.RemovalReason.DISCARDED);
}
}
if (this.isAlive() && world.getBlockState(this.getBlockPos().up()).isAir()) {
world.setBlockState(this.getBlockPos().up(), AbstractFireBlock.getState(world, this.getBlockPos().up()));
}
List<Entity> list = this.world.getOtherEntities(this, new Box(this.getBlockPos().up()).expand(1D, 1D, 1D));
for (int x = 0; x < list.size(); ++x) {
Entity entity = (Entity) list.get(x);
if (!(entity instanceof MancubusEntity) && !(entity instanceof ArchvileEntity) && !(entity instanceof IconofsinEntity) && !(entity instanceof DoomHunterEntity) && !(entity instanceof SummonerEntity) && !(entity instanceof MotherDemonEntity)) {
double y = (double) (MathHelper.sqrt(entity.distanceTo(this)));
if (y <= 1.0D) {
if (entity.isAlive()) {
entity.damage(DamageSource.mobProjectile(entity, this.getOwner()), damage);
entity.setFireTicks(60);
}
}
}
}
}
use of mod.azure.doom.entity.tierboss.IconofsinEntity in project MCDoom by AzureDoom.
the class DoomWallBlock method checkIconSpawn.
public static void checkIconSpawn(World world, BlockPos pos, IconBlockEntity blockEntity) {
if (!world.isClient()) {
BlockState block = blockEntity.getCachedState();
boolean flag = block.isOf(DoomBlocks.ICON_WALL1) || block.isOf(DoomBlocks.ICON_WALL2) || block.isOf(DoomBlocks.ICON_WALL3) || block.isOf(DoomBlocks.ICON_WALL4) || block.isOf(DoomBlocks.ICON_WALL5) || block.isOf(DoomBlocks.ICON_WALL6) || block.isOf(DoomBlocks.ICON_WALL7) || block.isOf(DoomBlocks.ICON_WALL8) || block.isOf(DoomBlocks.ICON_WALL9) || block.isOf(DoomBlocks.ICON_WALL10) || block.isOf(DoomBlocks.ICON_WALL11) || block.isOf(DoomBlocks.ICON_WALL12) || block.isOf(DoomBlocks.ICON_WALL13) || block.isOf(DoomBlocks.ICON_WALL14) || block.isOf(DoomBlocks.ICON_WALL15) || block.isOf(DoomBlocks.ICON_WALL16);
if (flag && pos.getY() >= 3 && world.getDifficulty() != Difficulty.PEACEFUL) {
BlockPattern blockPattern = getOrCreateIconFull();
BlockPattern.Result result = blockPattern.searchAround(world, pos);
if (result != null) {
for (int i = 0; i < blockPattern.getWidth(); ++i) {
for (int j = 0; j < blockPattern.getHeight(); ++j) {
CachedBlockPosition cachedBlockPosition = result.translate(i, j, 0);
world.setBlockState(cachedBlockPosition.getBlockPos(), Blocks.AIR.getDefaultState(), 2);
world.syncWorldEvent(2001, cachedBlockPosition.getBlockPos(), Block.getRawIdFromState(cachedBlockPosition.getBlockState()));
}
}
IconofsinEntity witherentity = ModEntityTypes.ICONOFSIN.create(world);
BlockPos blockPos = result.translate(1, 2, 0).getBlockPos();
witherentity.refreshPositionAndAngles((double) blockPos.getX() + 0.5D, (double) blockPos.getY() + 0.55D, (double) blockPos.getZ() + 0.5D, result.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F, 0.0F);
witherentity.bodyYaw = result.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F;
witherentity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 200, 4));
witherentity.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 200, 4));
world.spawnEntity(witherentity);
Iterator<ServerPlayerEntity> var13 = world.getNonSpectatingEntities(ServerPlayerEntity.class, witherentity.getBoundingBox().expand(50.0D)).iterator();
while (var13.hasNext()) {
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) var13.next();
Criteria.SUMMONED_ENTITY.trigger(serverPlayerEntity, witherentity);
}
for (int k = 0; k < blockPattern.getWidth(); ++k) {
for (int l = 0; l < blockPattern.getHeight(); ++l) {
world.updateNeighbors(result.translate(k, l, 0).getBlockPos(), Blocks.AIR);
}
}
}
}
}
}
Aggregations