use of net.minecraft.entity.projectile.EntityLargeFireball in project Minestuck by mraof.
the class EntityBishop method attackEntityWithRangedAttack.
@Override
public void attackEntityWithRangedAttack(EntityLivingBase entityliving, float f) {
double distanceX = entityliving.posX - this.posX;
double distanceY = entityliving.boundingBox.minY + (double) (entityliving.height / 2.0F) - (this.posY + (double) (this.height / 2.0F));
double distanceZ = entityliving.posZ - this.posZ;
EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, distanceX, distanceY, distanceZ);
entitylargefireball.field_92057_e = 1;
double d8 = (double) this.width;
Vec3 vec3 = this.getLook(1.0F);
entitylargefireball.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0F + vec3.xCoord * d8;
entitylargefireball.posY = this.posY + (double) (this.height / 2.0F);
entitylargefireball.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0F + vec3.zCoord * d8;
this.worldObj.spawnEntityInWorld(entitylargefireball);
}
use of net.minecraft.entity.projectile.EntityLargeFireball in project takumicraft by TNTModders.
the class EntityRoboCreeper method superJump.
protected void superJump() {
this.motionY = 75d;
if (this.isPotionActive(MobEffects.JUMP_BOOST)) {
this.motionY += (this.getActivePotionEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1) * 0.1F;
}
if (this.isSprinting()) {
float f = this.rotationYaw * 0.017453292F;
this.motionX -= MathHelper.sin(f) * 0.2F;
this.motionZ += MathHelper.cos(f) * 0.2F;
}
this.move(MoverType.SELF, motionX, motionY, motionZ);
this.isAirBorne = true;
ForgeHooks.onLivingJump(this);
for (int t = 0; t < (this.getPowered() ? 30 : 10); t++) {
Random rand = new Random();
int i = this.getPowered() ? 3 : 5;
EntityLargeFireball fireball = new EntityLargeFireball(this.world);
if (this.getAttackTarget() != null) {
double x = this.getAttackTarget().posX + this.rand.nextInt(i * 2) - i;
double y = this.posY + this.rand.nextInt(i) - i / 2;
double z = this.getAttackTarget().posZ + this.rand.nextInt(i * 2) - i;
fireball.setPosition(x, y, z);
} else {
double x = this.posX + this.rand.nextInt(i * 2) - i;
double y = this.posY + this.rand.nextInt(i) - i / 2;
double z = this.posZ + this.rand.nextInt(i * 2) - i;
fireball.setPosition(x, y, z);
}
fireball.motionX = 0;
fireball.motionY = -5;
fireball.motionZ = 0;
fireball.accelerationY = -5;
fireball.explosionPower = this.getPowered() ? 5 : 3;
if (!this.world.isRemote) {
this.world.spawnEntity(fireball);
}
}
}
use of net.minecraft.entity.projectile.EntityLargeFireball in project GTplusplus by GTNewHorizons.
the class EntityBatKing method updateEntityActionState.
@Override
protected void updateEntityActionState() {
if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) {
this.setDead();
}
this.despawnEntity();
this.prevAttackCounter = this.attackCounter;
double d0 = this.waypointX - this.posX;
double d1 = this.waypointY - this.posY;
double d2 = this.waypointZ - this.posZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 < 1.0D || d3 > 3600.0D) {
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
}
if (this.courseChangeCooldown-- <= 0) {
this.courseChangeCooldown += this.rand.nextInt(5) + 2;
d3 = (double) MathHelper.sqrt_double(d3);
if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3)) {
this.motionX += d0 / d3 * 0.1D;
this.motionY += d1 / d3 * 0.1D;
this.motionZ += d2 / d3 * 0.1D;
} else {
this.waypointX = this.posX;
this.waypointY = this.posY;
this.waypointZ = this.posZ;
}
}
if (this.targetedEntity != null && this.targetedEntity.isDead) {
this.targetedEntity = null;
}
if (this.targetedEntity == null || this.aggroCooldown-- <= 0) {
this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D);
if (this.targetedEntity != null) {
this.aggroCooldown = 20;
}
}
double d4 = 64.0D;
if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4) {
double d5 = this.targetedEntity.posX - this.posX;
double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - (this.posY + (double) (this.height / 2.0F));
double d7 = this.targetedEntity.posZ - this.posZ;
this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI;
if (this.canEntityBeSeen(this.targetedEntity)) {
if (this.attackCounter == 10) {
this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1007, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
}
++this.attackCounter;
if (this.attackCounter == 20) {
this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1008, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, d5, d6, d7);
entitylargefireball.field_92057_e = this.explosionStrength;
double d8 = 4.0D;
Vec3 vec3 = this.getLook(1.0F);
entitylargefireball.posX = this.posX + vec3.xCoord * d8;
entitylargefireball.posY = this.posY + (double) (this.height / 2.0F) + 0.5D;
entitylargefireball.posZ = this.posZ + vec3.zCoord * d8;
this.worldObj.spawnEntityInWorld(entitylargefireball);
this.attackCounter = -40;
}
} else if (this.attackCounter > 0) {
--this.attackCounter;
}
} else {
this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float) Math.PI;
if (this.attackCounter > 0) {
--this.attackCounter;
}
}
if (!this.worldObj.isRemote) {
byte b1 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = (byte) (this.attackCounter > 10 ? 1 : 0);
if (b1 != b0) {
this.dataWatcher.updateObject(16, Byte.valueOf(b0));
}
}
}
use of net.minecraft.entity.projectile.EntityLargeFireball in project Magma by magmafoundation.
the class CraftBlockProjectileSource method launchProjectile.
@Override
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
Validate.isTrue(getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
// Copied from BlockDispenser.dispense()
IBlockSource isourceblock = new BlockSourceImpl(dispenserBlock.getWorld(), dispenserBlock.getPos());
// Copied from DispenseBehaviorProjectile
IPosition iposition = BlockDispenser.getDispensePosition(isourceblock);
EnumFacing enumdirection = (EnumFacing) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
net.minecraft.world.World world = dispenserBlock.getWorld();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new EntitySnowball(world, iposition.getX(), iposition.getY(), iposition.getZ());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new EntityEgg(world, iposition.getX(), iposition.getY(), iposition.getZ());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new EntityEnderPearl(world, null);
launch.setPosition(iposition.getX(), iposition.getY(), iposition.getZ());
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new EntityExpBottle(world, iposition.getX(), iposition.getY(), iposition.getZ());
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
if (LingeringPotion.class.isAssignableFrom(projectile)) {
launch = new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), CraftItemStack.asNMSCopy(new ItemStack(Material.LINGERING_POTION, 1)));
} else {
launch = new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), CraftItemStack.asNMSCopy(new ItemStack(Material.SPLASH_POTION, 1)));
}
} else if (Arrow.class.isAssignableFrom(projectile)) {
if (TippedArrow.class.isAssignableFrom(projectile)) {
launch = new EntityTippedArrow(world, iposition.getX(), iposition.getY(), iposition.getZ());
((EntityTippedArrow) launch).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
launch = new EntitySpectralArrow(world, iposition.getX(), iposition.getY(), iposition.getZ());
} else {
launch = new EntityTippedArrow(world, iposition.getX(), iposition.getY(), iposition.getZ());
}
((EntityArrow) launch).pickupStatus = EntityArrow.PickupStatus.ALLOWED;
((EntityArrow) launch).projectileSource = this;
} else if (Fireball.class.isAssignableFrom(projectile)) {
double d0 = iposition.getX() + (double) ((float) enumdirection.getFrontOffsetX() * 0.3F);
double d1 = iposition.getY() + (double) ((float) enumdirection.getFrontOffsetY() * 0.3F);
double d2 = iposition.getZ() + (double) ((float) enumdirection.getFrontOffsetZ() * 0.3F);
Random random = world.rand;
double d3 = random.nextGaussian() * 0.05D + (double) enumdirection.getFrontOffsetX();
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getFrontOffsetY();
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getFrontOffsetZ();
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new EntitySmallFireball(world, null, d0, d1, d2);
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new EntityWitherSkull(world);
launch.setPosition(d0, d1, d2);
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
((EntityFireball) launch).accelerationX = d3 / d6 * 0.1D;
((EntityFireball) launch).accelerationY = d4 / d6 * 0.1D;
((EntityFireball) launch).accelerationZ = d5 / d6 * 0.1D;
} else {
launch = new EntityLargeFireball(world);
launch.setPosition(d0, d1, d2);
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
((EntityFireball) launch).accelerationX = d3 / d6 * 0.1D;
((EntityFireball) launch).accelerationY = d4 / d6 * 0.1D;
((EntityFireball) launch).accelerationZ = d5 / d6 * 0.1D;
}
((EntityFireball) launch).projectileSource = this;
}
Validate.notNull(launch, "Projectile not supported");
if (launch instanceof IProjectile) {
if (launch instanceof EntityThrowable) {
((EntityThrowable) launch).projectileSource = this;
}
// Values from DispenseBehaviorProjectile
float a = 6.0F;
float b = 1.1F;
if (launch instanceof EntityPotion || launch instanceof ThrownExpBottle) {
// Values from respective DispenseBehavior classes
a *= 0.5F;
b *= 1.25F;
}
// Copied from DispenseBehaviorProjectile
((IProjectile) launch).shoot((double) enumdirection.getFrontOffsetX(), (double) ((float) enumdirection.getFrontOffsetY() + 0.1F), (double) enumdirection.getFrontOffsetZ(), b, a);
}
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntity(launch);
return (T) launch.getBukkitEntity();
}
use of net.minecraft.entity.projectile.EntityLargeFireball in project takumicraft by TNTModders.
the class EntityKingCreeper method takumiExplode.
@Override
public void takumiExplode() {
if (this.lastSource != null && this.lastSource.isProjectile() && this.lastSource.getTrueSource() != null) {
this.projectileCounter();
}
int maxID = 14;
int always = 0;
float power = this.getPowered() ? 10 : 6;
if (!this.world.isRemote) {
this.setAttackID(this.rand.nextInt(maxID + 1));
TakumiCraftCore.LOGGER.info(this.getAttackID());
// debug only
if (always != 0) {
this.setAttackID(always);
}
}
switch(this.getAttackID()) {
// ランダム爆発1
case 1:
if (!this.world.isRemote) {
for (int i = 0; i < (this.getPowered() ? 20 : 10); i++) {
BlockPos pos = this.createRandomPos(this.getPosition(), 2.5);
this.world.createExplosion(this, pos.getX() + 0.5, pos.getY() - 0.5, pos.getZ() + 0.5, power / 2, true);
}
}
break;
// ファイアボール
case 2:
this.motionY = 75d;
if (this.isPotionActive(MobEffects.JUMP_BOOST)) {
this.motionY += (this.getActivePotionEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1) * 0.1F;
}
if (this.isSprinting()) {
float f = this.rotationYaw * 0.017453292F;
this.motionX -= MathHelper.sin(f) * 0.2F;
this.motionZ += MathHelper.cos(f) * 0.2F;
}
this.move(MoverType.SELF, motionX, motionY, motionZ);
this.isAirBorne = true;
ForgeHooks.onLivingJump(this);
for (int t = 0; t < (this.getPowered() ? 20 : 10); t++) {
Random rand = new Random();
int i = this.getPowered() ? 10 : 5;
double x = this.posX + this.rand.nextInt(i * 2) - i;
double y = this.posY + this.rand.nextInt(i) - i / 2;
double z = this.posZ + this.rand.nextInt(i * 2) - i;
EntityLargeFireball fireball = new EntityLargeFireball(this.world, x, y, z, 0, -0.5, 0);
fireball.motionX = 0;
fireball.motionY = -1;
fireball.motionZ = 0;
fireball.explosionPower = this.getPowered() ? 5 : 3;
if (!this.world.isRemote) {
this.world.spawnEntity(fireball);
}
}
break;
// ランダム落雷
case 3:
for (int i = 0; i < 10 * (this.getPowered() ? 3 : 1); i++) {
BlockPos pos = this.createRandomPos(this.getPosition(), 1.5);
EntityLightningBolt bolt = new EntityLightningBolt(this.world, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, false);
this.world.addWeatherEffect(bolt);
this.world.spawnEntity(bolt);
if (!this.world.isRemote) {
this.world.newExplosion(this, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, power / 2.5f, true, true);
}
}
break;
// 火薬岩
case 4:
for (int t = 0; t < power * 1.25; t++) {
EntityLivingBase entity = this.getAttackTarget();
if (entity != null) {
int MpX = (int) (entity.posX + MathHelper.getInt(this.rand, -2, -5));
int MpY = (int) entity.posY;
int MpZ = (int) (entity.posZ + MathHelper.getInt(this.rand, -2, -5));
int PpX = (int) (entity.posX + MathHelper.getInt(this.rand, 2, 5));
int PpY = (int) entity.posY;
int PpZ = (int) (entity.posZ + MathHelper.getInt(this.rand, 2, 5));
IBlockState state = this.rand.nextInt(10) == 0 ? TakumiBlockCore.DUMMY_GUNORE.getDefaultState() : TakumiBlockCore.GUNORE.getDefaultState();
this.world.setBlockState(new BlockPos(MpX, MpY, MpZ), state);
this.world.setBlockState(new BlockPos(PpX, PpY, PpZ), state);
this.world.createExplosion(this, MpX, MpY, MpZ, 0, false);
this.world.createExplosion(this, PpX, PpY, PpZ, 0, false);
} else if (!this.world.isRemote) {
this.world.createExplosion(this, this.posX + MathHelper.getInt(this.rand, -4, 4), this.posY + MathHelper.getInt(this.rand, -4, 4), this.posZ + MathHelper.getInt(this.rand, -4, 4), power, true);
}
}
break;
// 爆破突進
case 5:
// 巨匠召喚
case 6:
if (!this.world.isRemote) {
for (int i = 0; i < power / 2 + 1; i++) {
EntityCreeper creeper = new EntityCreeper(this.world);
creeper.copyLocationAndAnglesFrom(this);
TakumiUtils.takumiSetPowered(creeper, true);
this.world.spawnEntity(creeper);
}
}
break;
// 十字爆発
case 7:
if (!this.world.isRemote) {
for (int x = -4; x <= 4; x++) {
this.world.createExplosion(this, this.posX + x, this.posY, this.posZ, power / 3 * 2, true);
}
for (int z = -4; z <= 4; z++) {
this.world.createExplosion(this, this.posX, this.posY, this.posZ + z, power / 3 * 2, true);
}
}
break;
// ランダム爆発2
case 8:
for (int t = 0; t <= 2 + rand.nextInt(3) * power / 5; t++) {
int x = rand.nextInt(11) - 5;
int y = rand.nextInt(11) - 5;
int z = rand.nextInt(11) - 5;
if (!this.world.isRemote) {
this.world.createExplosion(this, this.posX + x, this.posY + y, this.posZ + z, power / 3, true);
}
}
break;
// 火薬岩の塔
case 9:
if (!this.world.isRemote) {
int x = (int) this.posX;
int y = (int) this.posY;
int z = (int) this.posZ;
for (int t = 0; t <= 10; t++) {
int v = MathHelper.getInt(this.rand, -4, 4);
int w = MathHelper.getInt(this.rand, -4, 4);
for (int ty = 0; ty < 6; ty++) {
if (this.world.getBlockState(new BlockPos((int) (this.posX + v), (int) (this.posY + ty), (int) (this.posZ + w))).getBlock() == Blocks.AIR) {
this.world.setBlockState(new BlockPos((int) (this.posX + v), (int) (this.posY + ty), (int) (this.posZ + w)), this.rand.nextInt(20) == 0 ? TakumiBlockCore.DUMMY_GUNORE.getDefaultState() : TakumiBlockCore.GUNORE.getDefaultState());
}
}
}
}
break;
// 回復爆発
case 10:
if (!world.isRemote) {
this.world.createExplosion(this, this.posX, this.posY, this.posZ, power, true);
}
this.heal(25);
break;
// 多重爆発
case 11:
if (!this.world.isRemote) {
for (int t = 0; t < power; t++) {
this.world.createExplosion(this, this.posX, this.posY, this.posZ, power / 1.5f, true);
}
}
break;
// 全方位火球
case 12:
Entity var1 = this.getAttackTarget();
if (var1 != null) {
for (int t = -18; t < 18; t++) {
float f1 = MathHelper.sqrt(this.getDistanceToEntity(var1)) * 0.5F;
double d0 = var1.posX - this.posX;
double d1 = var1.getEntityBoundingBox().minY + var1.height / 2.0F - (this.posY + this.height / 2.0F);
double d2 = var1.posZ - this.posZ;
EntityLargeFireball entityLargefireball = new EntityLargeFireball(this.world, this, d0 + this.rand.nextGaussian() * f1, d1, d2 + this.rand.nextGaussian() * f1);
entityLargefireball.rotationYaw += t * 10;
entityLargefireball.posY = this.posY + this.height / 2.0F + 0.5D;
entityLargefireball.explosionPower = 2;
this.world.spawnEntity(entityLargefireball);
}
} else if (!this.world.isRemote) {
this.world.createExplosion(this, this.posX, this.posY, this.posZ, power / 2.5f, true);
}
break;
// 匠化爆発
case 13:
// 煙幕
case 14:
default:
if (!this.world.isRemote) {
this.world.createExplosion(this, this.posX, this.posY, this.posZ, power, true);
}
break;
}
if (this.getHealth() > this.getMaxHealth() / 2 && !this.world.isThundering()) {
TakumiUtils.takumiSetPowered(this, false);
}
}
Aggregations