Initial 1.11.2 update
This commit is contained in:
@@ -9,6 +9,7 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
/**
|
||||
* Same as {@link EntityMagicProjectile}, but with an additional blast multiplier field which is synced and saved to
|
||||
* allow for the spread of particles to be changed depending on the blast area.
|
||||
*
|
||||
* @author Electroblob
|
||||
* @since Wizardry 1.2
|
||||
*/
|
||||
@@ -16,38 +17,38 @@ public abstract class EntityBomb extends EntityMagicProjectile implements IEntit
|
||||
|
||||
/** The entity blast multiplier. This is now synced and saved centrally from {@link EntityBomb}. */
|
||||
public float blastMultiplier = 1.0f;
|
||||
|
||||
public EntityBomb(World world) {
|
||||
|
||||
public EntityBomb(World world){
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityBomb(World world, EntityLivingBase thrower) {
|
||||
public EntityBomb(World world, EntityLivingBase thrower){
|
||||
super(world, thrower);
|
||||
}
|
||||
|
||||
public EntityBomb(World world, EntityLivingBase thrower, float damageMultiplier, float blastMultiplier) {
|
||||
public EntityBomb(World world, EntityLivingBase thrower, float damageMultiplier, float blastMultiplier){
|
||||
super(world, thrower, damageMultiplier);
|
||||
this.blastMultiplier = blastMultiplier;
|
||||
this.blastMultiplier = blastMultiplier;
|
||||
}
|
||||
|
||||
public EntityBomb(World par1World, double par2, double par4, double par6) {
|
||||
public EntityBomb(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf buffer) {
|
||||
public void writeSpawnData(ByteBuf buffer){
|
||||
buffer.writeFloat(blastMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteBuf buffer) {
|
||||
public void readSpawnData(ByteBuf buffer){
|
||||
blastMultiplier = buffer.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
blastMultiplier = nbttagcompound.getFloat("blastMultiplier");
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
blastMultiplier = nbttagcompound.getFloat("blastMultiplier");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,77 +12,80 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityDarknessOrb extends EntityMagicProjectile
|
||||
{
|
||||
public EntityDarknessOrb(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
public class EntityDarknessOrb extends EntityMagicProjectile {
|
||||
public EntityDarknessOrb(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityDarknessOrb(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityDarknessOrb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
public EntityDarknessOrb(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityDarknessOrb(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getSpeed(){
|
||||
return 0.5F;
|
||||
}
|
||||
public EntityDarknessOrb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult RayTraceResult)
|
||||
{
|
||||
Entity target = RayTraceResult.entityHit;
|
||||
|
||||
if (target != null && !MagicDamage.isEntityImmune(DamageType.WITHER, target))
|
||||
{
|
||||
float damage = 8 * damageMultiplier;
|
||||
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.WITHER).setProjectile(), damage);
|
||||
|
||||
if(target instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.WITHER, target)) ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER, 150, 1));
|
||||
public EntityDarknessOrb(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_WITHER_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
@Override
|
||||
protected float getSpeed(){
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(worldObj.isRemote){
|
||||
float brightness = rand.nextFloat()*0.2f;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, worldObj, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0, 0, 0, 20 + rand.nextInt(10), brightness, 0.0f, brightness);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, worldObj, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0d, 0.0d, 0.0d, 0, 0.1f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 150){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
// Cancels out the slowdown effect in EntityThrowable
|
||||
this.motionX /= 0.99;
|
||||
this.motionY /= 0.99;
|
||||
this.motionZ /= 0.99;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of gravity to apply to the thrown entity with each tick.
|
||||
*/
|
||||
protected float getGravityVelocity()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult RayTraceResult){
|
||||
Entity target = RayTraceResult.entityHit;
|
||||
|
||||
if(target != null && !MagicDamage.isEntityImmune(DamageType.WITHER, target)){
|
||||
float damage = 8 * damageMultiplier;
|
||||
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.WITHER).setProjectile(),
|
||||
damage);
|
||||
|
||||
if(target instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.WITHER, target))
|
||||
((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER, 150, 1));
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_WITHER_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(world.isRemote){
|
||||
float brightness = rand.nextFloat() * 0.2f;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world,
|
||||
this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width,
|
||||
this.posY + this.rand.nextDouble() * (double)this.height,
|
||||
this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0, 0, 0, 20 + rand.nextInt(10),
|
||||
brightness, 0.0f, brightness);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
|
||||
this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width,
|
||||
this.posY + this.rand.nextDouble() * (double)this.height,
|
||||
this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0d, 0.0d, 0.0d, 0, 0.1f, 0.0f,
|
||||
0.0f);
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 150){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
// Cancels out the slowdown effect in EntityThrowable
|
||||
this.motionX /= 0.99;
|
||||
this.motionY /= 0.99;
|
||||
this.motionZ /= 0.99;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of gravity to apply to the thrown entity with each tick.
|
||||
*/
|
||||
protected float getGravityVelocity(){
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,86 +10,90 @@ import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityDart extends EntityMagicArrow
|
||||
{
|
||||
public class EntityDart extends EntityMagicArrow {
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityDart(World world) {
|
||||
public EntityDart(World world){
|
||||
super(world);
|
||||
}
|
||||
|
||||
/** Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this
|
||||
* constructor and then call setVelocity() as that method is, bizarrely, client-side only. */
|
||||
public EntityDart(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be altered
|
||||
* slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on easy, 6 on
|
||||
* normal and 2 on hard difficulty. */
|
||||
public EntityDart(World world, EntityLivingBase caster, Entity target, float speed, float aimingError, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this constructor
|
||||
* and then call setVelocity() as that method is, bizarrely, client-side only.
|
||||
*/
|
||||
public EntityDart(World world, double x, double y, double z){
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile pointing in the direction the caster is looking, with the given speed.
|
||||
* USE THIS CONSTRUCTOR FOR NORMAL SPELLS. */
|
||||
public EntityDart(World world, EntityLivingBase caster, float speed, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be
|
||||
* altered slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on
|
||||
* easy, 6 on normal and 2 on hard difficulty.
|
||||
*/
|
||||
public EntityDart(World world, EntityLivingBase caster, Entity target, float speed, float aimingError,
|
||||
float damageMultiplier){
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a projectile pointing in the direction the caster is looking, with the given speed. USE THIS CONSTRUCTOR
|
||||
* FOR NORMAL SPELLS.
|
||||
*/
|
||||
public EntityDart(World world, EntityLivingBase caster, float speed, float damageMultiplier){
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityHit(EntityLivingBase entityHit){
|
||||
//Adds a weakness effect to the target.
|
||||
entityHit.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 200, 1, false, false));
|
||||
// Adds a weakness effect to the target.
|
||||
entityHit.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 200, 1, false, false));
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockHit(){
|
||||
this.playSound(SoundEvents.ENTITY_ARROW_HIT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickInAir(){
|
||||
|
||||
if(this.worldObj.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.LEAF, worldObj, this.posX, this.posY, this.posZ, 0, -0.03, 0, 10 + rand.nextInt(5));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.world.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.LEAF, world, this.posX, this.posY, this.posZ, 0, -0.03, 0,
|
||||
10 + rand.nextInt(5));
|
||||
}
|
||||
}
|
||||
|
||||
// Replicates the original behaviour of staying stuck in block for a few seconds before disappearing.
|
||||
@Override
|
||||
public void tickInGround(){
|
||||
if(this.ticksInGround > 60){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDamage(){
|
||||
return 4.0d;
|
||||
}
|
||||
|
||||
public double getDamage(){
|
||||
return 4.0d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageType getDamageType(){
|
||||
return DamageType.MAGIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doGravity(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
public boolean doGravity(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,85 +9,82 @@ import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityFirebolt extends EntityMagicProjectile
|
||||
{
|
||||
public EntityFirebolt(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
public class EntityFirebolt extends EntityMagicProjectile {
|
||||
public EntityFirebolt(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityFirebolt(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityFirebolt(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
public EntityFirebolt(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityFirebolt(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
public EntityFirebolt(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult rayTrace)
|
||||
{
|
||||
Entity entityHit = rayTrace.entityHit;
|
||||
|
||||
if (entityHit != null)
|
||||
{
|
||||
float damage = 5 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FIRE).setProjectile(), damage);
|
||||
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FIRE, entityHit)) entityHit.setFire(5);
|
||||
}
|
||||
public EntityFirebolt(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
this.playSound(SoundEvents.BLOCK_LAVA_POP, 2, 0.8f + rand.nextFloat()*0.3f);
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult rayTrace){
|
||||
Entity entityHit = rayTrace.entityHit;
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
for(int i=0;i<8;i++){
|
||||
worldObj.spawnParticle(EnumParticleTypes.LAVA, this.posX + rand.nextFloat() - 0.5, this.posY + this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
|
||||
if(entityHit != null){
|
||||
float damage = 5 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FIRE).setProjectile(),
|
||||
damage);
|
||||
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FIRE, entityHit)) entityHit.setFire(5);
|
||||
}
|
||||
|
||||
this.playSound(SoundEvents.BLOCK_LAVA_POP, 2, 0.8f + rand.nextFloat() * 0.3f);
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 8; i++){
|
||||
world.spawnParticle(EnumParticleTypes.LAVA, this.posX + rand.nextFloat() - 0.5,
|
||||
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(worldObj.isRemote){
|
||||
for(int i=0; i<4; i++){
|
||||
worldObj.spawnParticle(EnumParticleTypes.FLAME, this.posX + rand.nextFloat()*0.2 - 0.1, this.posY + this.height/2 + rand.nextFloat()*0.2 - 0.1, this.posZ + rand.nextFloat()*0.2 - 0.1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 8){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of gravity to apply to the thrown entity with each tick.
|
||||
*/
|
||||
@Override
|
||||
protected float getGravityVelocity()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
@Override
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 4; i++){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, this.posX + rand.nextFloat() * 0.2 - 0.1,
|
||||
this.posY + this.height / 2 + rand.nextFloat() * 0.2 - 0.1,
|
||||
this.posZ + rand.nextFloat() * 0.2 - 0.1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 8){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of gravity to apply to the thrown entity with each tick.
|
||||
*/
|
||||
@Override
|
||||
protected float getGravityVelocity(){
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
@Override
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,73 +15,84 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityFirebomb extends EntityBomb {
|
||||
|
||||
public EntityFirebomb(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityFirebomb(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityFirebomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier, float blastMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
public EntityFirebomb(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityFirebomb(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
public EntityFirebomb(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult)
|
||||
{
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if (entityHit != null)
|
||||
{
|
||||
// This is if the firebomb gets a direct hit
|
||||
float damage = 5 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FIRE).setProjectile(), damage);
|
||||
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FIRE, entityHit)) entityHit.setFire(10);
|
||||
}
|
||||
public EntityFirebomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier,
|
||||
float blastMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
for(int i=0;i<60*blastMultiplier;i++){
|
||||
//this.worldObj.spawnParticle(EnumParticleTypes.FLAME, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0, 0, 0);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, worldObj, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0, 0, 0, 15 + rand.nextInt(5), 2 + rand.nextFloat(), 0, 0);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, worldObj, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0.0d, 0.0d, 0.0d, 0, 1.0f, 0.2f + rand.nextFloat()*0.4f, 0.0f);
|
||||
public EntityFirebomb(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if(entityHit != null){
|
||||
// This is if the firebomb gets a direct hit
|
||||
float damage = 5 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FIRE).setProjectile(),
|
||||
damage);
|
||||
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FIRE, entityHit)) entityHit.setFire(10);
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
for(int i = 0; i < 60 * blastMultiplier; i++){
|
||||
// this.world.spawnParticle(EnumParticleTypes.FLAME, this.posX + (this.rand.nextDouble()*4 -
|
||||
// 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ +
|
||||
// (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0, 0, 0);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, world,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0, 0, 0, 15 + rand.nextInt(5),
|
||||
2 + rand.nextFloat(), 0, 0);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 0, 1.0f,
|
||||
0.2f + rand.nextFloat() * 0.4f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.5F, rand.nextFloat() * 0.4F + 0.6F);
|
||||
this.playSound(SoundEvents.ENTITY_BLAZE_SHOOT, 1, 1);
|
||||
|
||||
double range = 3.0d * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.5F, rand.nextFloat() * 0.4F + 0.6F);
|
||||
this.playSound(SoundEvents.ENTITY_BLAZE_SHOOT, 1, 1);
|
||||
|
||||
double range = 3.0d*blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
if(target != entityHit && target != this.getThrower() && !MagicDamage.isEntityImmune(DamageType.FIRE, target)){
|
||||
if(target != entityHit && target != this.getThrower()
|
||||
&& !MagicDamage.isEntityImmune(DamageType.FIRE, target)){
|
||||
// Splash damage does not count as projectile damage
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FIRE), 4.0f * damageMultiplier);
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FIRE),
|
||||
4.0f * damageMultiplier);
|
||||
target.setFire(7);
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,79 +7,83 @@ import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityForceArrow extends EntityMagicArrow {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityForceArrow(World world) {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityForceArrow(World world){
|
||||
super(world);
|
||||
}
|
||||
|
||||
/** Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this
|
||||
* constructor and then call setVelocity() as that method is, bizarrely, client-side only. */
|
||||
public EntityForceArrow(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be altered
|
||||
* slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on easy, 6 on
|
||||
* normal and 2 on hard difficulty. */
|
||||
public EntityForceArrow(World world, EntityLivingBase caster, Entity target, float speed, float aimingError, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this constructor
|
||||
* and then call setVelocity() as that method is, bizarrely, client-side only.
|
||||
*/
|
||||
public EntityForceArrow(World world, double x, double y, double z){
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile pointing in the direction the caster is looking, with the given speed.
|
||||
* USE THIS CONSTRUCTOR FOR NORMAL SPELLS. */
|
||||
public EntityForceArrow(World world, EntityLivingBase caster, float speed, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be
|
||||
* altered slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on
|
||||
* easy, 6 on normal and 2 on hard difficulty.
|
||||
*/
|
||||
public EntityForceArrow(World world, EntityLivingBase caster, Entity target, float speed, float aimingError,
|
||||
float damageMultiplier){
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a projectile pointing in the direction the caster is looking, with the given speed. USE THIS CONSTRUCTOR
|
||||
* FOR NORMAL SPELLS.
|
||||
*/
|
||||
public EntityForceArrow(World world, EntityLivingBase caster, float speed, float damageMultiplier){
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityHit(EntityLivingBase entityHit){
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST, 1.0F, 1.0F);
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickInGround(){
|
||||
this.setDead();
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockHit(){
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST, 1.0F, 1.0F);
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickInAir(){
|
||||
if (this.ticksExisted > 20){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 20){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDamage(){
|
||||
return 7.0d;
|
||||
}
|
||||
|
||||
public double getDamage(){
|
||||
return 7.0d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageType getDamageType(){
|
||||
return DamageType.FORCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doGravity(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
public boolean doGravity(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,92 +15,95 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityForceOrb extends EntityMagicProjectile {
|
||||
|
||||
/** The entity blast multiplier. In this particular case, it doesn't need syncing, so this class doesn't extend
|
||||
* EntityBlastProjectile. */
|
||||
|
||||
/**
|
||||
* The entity blast multiplier. In this particular case, it doesn't need syncing, so this class doesn't extend
|
||||
* EntityBlastProjectile.
|
||||
*/
|
||||
public float blastMultiplier;
|
||||
|
||||
public EntityForceOrb(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityForceOrb(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityForceOrb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier, float blastMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
this.blastMultiplier = blastMultiplier;
|
||||
}
|
||||
public EntityForceOrb(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityForceOrb(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
public EntityForceOrb(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
|
||||
if (par1RayTraceResult.entityHit != null)
|
||||
{
|
||||
// This is if the force orb gets a direct hit
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(this.worldObj.isRemote){
|
||||
for(int j=0; j<20; j++){
|
||||
float brightness = 0.5f + (rand.nextFloat()/2);
|
||||
double x = this.posX - 0.25d + (rand.nextDouble()/2);
|
||||
double y = this.posY - 0.25d + (rand.nextDouble()/2);
|
||||
double z = this.posZ - 0.25d + (rand.nextDouble()/2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, worldObj, x, y, z, (x - this.posX)*2, (y - this.posY)*2, (z - this.posZ)*2, 6, brightness, 1.0f, brightness + 0.2f);
|
||||
}
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
}
|
||||
public EntityForceOrb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier,
|
||||
float blastMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
this.blastMultiplier = blastMultiplier;
|
||||
}
|
||||
|
||||
public EntityForceOrb(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
|
||||
if(par1RayTraceResult.entityHit != null){
|
||||
// This is if the force orb gets a direct hit
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(this.world.isRemote){
|
||||
for(int j = 0; j < 20; j++){
|
||||
float brightness = 0.5f + (rand.nextFloat() / 2);
|
||||
double x = this.posX - 0.25d + (rand.nextDouble() / 2);
|
||||
double y = this.posY - 0.25d + (rand.nextDouble() / 2);
|
||||
double z = this.posZ - 0.25d + (rand.nextDouble() / 2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x, y, z, (x - this.posX) * 2,
|
||||
(y - this.posY) * 2, (z - this.posZ) * 2, 6, brightness, 1.0f, brightness + 0.2f);
|
||||
}
|
||||
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
}
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
// 2 gives a cool flanging effect!
|
||||
float pitch = this.rand.nextFloat() * 0.2F + 0.3F;
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST, 1.5F, pitch);
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST, 1.5F, pitch - 0.01f);
|
||||
|
||||
double blastRadius = 4.0d * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(blastRadius, this.posX,
|
||||
this.posY, this.posZ, this.world);
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
// 2 gives a cool flanging effect!
|
||||
float pitch = this.rand.nextFloat() * 0.2F + 0.3F;
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST, 1.5F, pitch);
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST, 1.5F, pitch - 0.01f);
|
||||
|
||||
double blastRadius = 4.0d*blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(blastRadius, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
if(target != this.getThrower()){
|
||||
|
||||
double velY = target.motionY;
|
||||
|
||||
double dx = this.posX-target.posX > 0? -0.5 - (this.posX-target.posX)/8 : 0.5 - (this.posX-target.posX)/8;
|
||||
double dz = this.posZ-target.posZ > 0? -0.5 - (this.posZ-target.posZ)/8 : 0.5 - (this.posZ-target.posZ)/8;
|
||||
|
||||
float damage = 4*damageMultiplier;
|
||||
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.BLAST), damage);
|
||||
double velY = target.motionY;
|
||||
|
||||
double dx = this.posX - target.posX > 0 ? -0.5 - (this.posX - target.posX) / 8
|
||||
: 0.5 - (this.posX - target.posX) / 8;
|
||||
double dz = this.posZ - target.posZ > 0 ? -0.5 - (this.posZ - target.posZ) / 8
|
||||
: 0.5 - (this.posZ - target.posZ) / 8;
|
||||
|
||||
float damage = 4 * damageMultiplier;
|
||||
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.BLAST), damage);
|
||||
|
||||
target.motionX = dx;
|
||||
target.motionY = velY + 0.4;
|
||||
target.motionZ = dz;
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
blastMultiplier = nbttagcompound.getFloat("blastMultiplier");
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
blastMultiplier = nbttagcompound.getFloat("blastMultiplier");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,116 +20,122 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityIceCharge extends EntityBomb {
|
||||
|
||||
public EntityIceCharge(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityIceCharge(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityIceCharge(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier, float blastMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
public EntityIceCharge(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityIceCharge(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
public EntityIceCharge(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult)
|
||||
{
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if (entityHit != null)
|
||||
{
|
||||
// This is if the ice charge gets a direct hit
|
||||
float damage = 4 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FROST).setProjectile(), damage);
|
||||
|
||||
if(entityHit instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.FROST, entityHit))
|
||||
((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(WizardryPotions.frost, 120, 1));
|
||||
}
|
||||
public EntityIceCharge(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier,
|
||||
float blastMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
for(int i=0;i<30*blastMultiplier;i++){
|
||||
float brightness = 0.4f + rand.nextFloat()*0.5f;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, worldObj, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0.0d, 0.0d, 0.0d, 35);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, worldObj, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0.0d, 0.0d, 0.0d, 0, brightness, brightness+0.1f, 1.0f);
|
||||
public EntityIceCharge(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if(entityHit != null){
|
||||
// This is if the ice charge gets a direct hit
|
||||
float damage = 4 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FROST).setProjectile(),
|
||||
damage);
|
||||
|
||||
if(entityHit instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.FROST, entityHit))
|
||||
((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(WizardryPotions.frost, 120, 1));
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
for(int i = 0; i < 30 * blastMultiplier; i++){
|
||||
float brightness = 0.4f + rand.nextFloat() * 0.5f;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, world,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 35);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 0, brightness,
|
||||
brightness + 0.1f, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.5f, rand.nextFloat() * 0.4f + 0.6f);
|
||||
this.playSound(WizardrySounds.SPELL_ICE, 1.2f, rand.nextFloat() * 0.4f + 1.2f);
|
||||
|
||||
double radius = 3.0d * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.5f, rand.nextFloat() * 0.4f + 0.6f);
|
||||
this.playSound(WizardrySounds.SPELL_ICE, 1.2f, rand.nextFloat() * 0.4f + 1.2f);
|
||||
|
||||
double radius = 3.0d*blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
// Slows targets
|
||||
for(EntityLivingBase target : targets){
|
||||
if(target != entityHit && target != this.getThrower()){
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FROST, target)) target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 100, 0));
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FROST, target))
|
||||
target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 100, 0));
|
||||
}
|
||||
}
|
||||
|
||||
// Places snow and ice on ground.
|
||||
for(int i=-1; i<2; i++){
|
||||
for(int j=-1; j<2; j++){
|
||||
|
||||
|
||||
// Places snow and ice on ground.
|
||||
for(int i = -1; i < 2; i++){
|
||||
for(int j = -1; j < 2; j++){
|
||||
|
||||
BlockPos pos = new BlockPos(this.posX + i, this.posY, this.posZ + j);
|
||||
|
||||
int y = WizardryUtilities.getNearestFloorLevelB(worldObj, pos, 7);
|
||||
|
||||
|
||||
int y = WizardryUtilities.getNearestFloorLevelB(world, pos, 7);
|
||||
|
||||
pos = new BlockPos(pos.getX(), y, pos.getZ());
|
||||
|
||||
|
||||
double dist = this.getDistance(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
|
||||
// Randomised with weighting so that the nearer the block the more likely it is to be snowed.
|
||||
if(y != -1 && rand.nextInt((int)dist*2 + 1) < 1 && dist < 2){
|
||||
if(worldObj.getBlockState(pos.down()).getBlock() == Blocks.WATER){
|
||||
worldObj.setBlockState(pos.down(), Blocks.ICE.getDefaultState());
|
||||
if(y != -1 && rand.nextInt((int)dist * 2 + 1) < 1 && dist < 2){
|
||||
if(world.getBlockState(pos.down()).getBlock() == Blocks.WATER){
|
||||
world.setBlockState(pos.down(), Blocks.ICE.getDefaultState());
|
||||
}else{
|
||||
// Don't need to check whether the block at pos can be replaced since getNearestFloorLevelB
|
||||
// only ever returns floors with air above them.
|
||||
worldObj.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState());
|
||||
world.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Releases shards
|
||||
for(int i=0; i<10; i++){
|
||||
double dx = rand.nextDouble()-0.5;
|
||||
double dy = rand.nextDouble()-0.5;
|
||||
double dz = rand.nextDouble()-0.5;
|
||||
EntityIceShard iceshard = new EntityIceShard(worldObj, this.posX + dx, this.posY + dy, this.posZ + dz);
|
||||
|
||||
// Releases shards
|
||||
for(int i = 0; i < 10; i++){
|
||||
double dx = rand.nextDouble() - 0.5;
|
||||
double dy = rand.nextDouble() - 0.5;
|
||||
double dz = rand.nextDouble() - 0.5;
|
||||
EntityIceShard iceshard = new EntityIceShard(world, this.posX + dx, this.posY + dy, this.posZ + dz);
|
||||
iceshard.motionX = dx;
|
||||
iceshard.motionY = dy;
|
||||
iceshard.motionZ = dz;
|
||||
iceshard.setShootingEntity(this.getThrower());
|
||||
iceshard.damageMultiplier = this.damageMultiplier;
|
||||
worldObj.spawnEntityInWorld(iceshard);
|
||||
world.spawnEntity(iceshard);
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire() {
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,106 +12,112 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityIceLance extends EntityMagicArrow {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityIceLance(World world) {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityIceLance(World world){
|
||||
super(world);
|
||||
this.setKnockbackStrength(1);
|
||||
}
|
||||
|
||||
/** Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this
|
||||
* constructor and then call setVelocity() as that method is, bizarrely, client-side only. */
|
||||
public EntityIceLance(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
this.setKnockbackStrength(1);
|
||||
}
|
||||
|
||||
/** Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be altered
|
||||
* slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on easy, 6 on
|
||||
* normal and 2 on hard difficulty. */
|
||||
public EntityIceLance(World world, EntityLivingBase caster, Entity target, float speed, float aimingError, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
/**
|
||||
* Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this constructor
|
||||
* and then call setVelocity() as that method is, bizarrely, client-side only.
|
||||
*/
|
||||
public EntityIceLance(World world, double x, double y, double z){
|
||||
super(world, x, y, z);
|
||||
this.setKnockbackStrength(1);
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates a projectile pointing in the direction the caster is looking, with the given speed.
|
||||
* USE THIS CONSTRUCTOR FOR NORMAL SPELLS. */
|
||||
public EntityIceLance(World world, EntityLivingBase caster, float speed, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
/**
|
||||
* Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be
|
||||
* altered slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on
|
||||
* easy, 6 on normal and 2 on hard difficulty.
|
||||
*/
|
||||
public EntityIceLance(World world, EntityLivingBase caster, Entity target, float speed, float aimingError,
|
||||
float damageMultiplier){
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
this.setKnockbackStrength(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a projectile pointing in the direction the caster is looking, with the given speed. USE THIS CONSTRUCTOR
|
||||
* FOR NORMAL SPELLS.
|
||||
*/
|
||||
public EntityIceLance(World world, EntityLivingBase caster, float speed, float damageMultiplier){
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
this.setKnockbackStrength(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityHit(EntityLivingBase entityHit){
|
||||
|
||||
// Adds a freeze effect to the target.
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FROST, entityHit)) entityHit.addPotionEffect(new PotionEffect(WizardryPotions.frost, 300, 0));
|
||||
|
||||
|
||||
// Adds a freeze effect to the target.
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FROST, entityHit))
|
||||
entityHit.addPotionEffect(new PotionEffect(WizardryPotions.frost, 300, 0));
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickInAir(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHit(){
|
||||
// Adds a particle effect when the ice lance hits a block.
|
||||
if(this.worldObj.isRemote){
|
||||
for(int j=0; j<10; j++){
|
||||
double x = this.posX - 0.25d + (rand.nextDouble()/2);
|
||||
double y = this.posY - 0.25d + (rand.nextDouble()/2);
|
||||
double z = this.posZ - 0.25d + (rand.nextDouble()/2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, worldObj, x, y, z, x - this.posX, y - this.posY, z - this.posZ, 20 + rand.nextInt(10));
|
||||
}
|
||||
}
|
||||
// Parameters for sound: sound event name, volume, pitch.
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.0F, rand.nextFloat() * 0.4F + 1.2F);
|
||||
|
||||
if(this.world.isRemote){
|
||||
for(int j = 0; j < 10; j++){
|
||||
double x = this.posX - 0.25d + (rand.nextDouble() / 2);
|
||||
double y = this.posY - 0.25d + (rand.nextDouble() / 2);
|
||||
double z = this.posZ - 0.25d + (rand.nextDouble() / 2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, world, x, y, z, x - this.posX, y - this.posY,
|
||||
z - this.posZ, 20 + rand.nextInt(10));
|
||||
}
|
||||
}
|
||||
// Parameters for sound: sound event name, volume, pitch.
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.0F, rand.nextFloat() * 0.4F + 1.2F);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickInGround(){
|
||||
this.setDead();
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getDamage(){
|
||||
return 10.0d;
|
||||
}
|
||||
|
||||
public double getDamage(){
|
||||
return 10.0d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageType getDamageType(){
|
||||
return DamageType.FROST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doGravity(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doOverpenetration(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
public boolean doGravity(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire() {
|
||||
public boolean doDeceleration(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doOverpenetration(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -12,92 +12,98 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityIceShard extends EntityMagicArrow {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityIceShard(World world) {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityIceShard(World world){
|
||||
super(world);
|
||||
}
|
||||
|
||||
/** Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this
|
||||
* constructor and then call setVelocity() as that method is, bizarrely, client-side only. */
|
||||
public EntityIceShard(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be altered
|
||||
* slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on easy, 6 on
|
||||
* normal and 2 on hard difficulty. */
|
||||
public EntityIceShard(World world, EntityLivingBase caster, Entity target, float speed, float aimingError, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this constructor
|
||||
* and then call setVelocity() as that method is, bizarrely, client-side only.
|
||||
*/
|
||||
public EntityIceShard(World world, double x, double y, double z){
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile pointing in the direction the caster is looking, with the given speed.
|
||||
* USE THIS CONSTRUCTOR FOR NORMAL SPELLS. */
|
||||
public EntityIceShard(World world, EntityLivingBase caster, float speed, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be
|
||||
* altered slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on
|
||||
* easy, 6 on normal and 2 on hard difficulty.
|
||||
*/
|
||||
public EntityIceShard(World world, EntityLivingBase caster, Entity target, float speed, float aimingError,
|
||||
float damageMultiplier){
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a projectile pointing in the direction the caster is looking, with the given speed. USE THIS CONSTRUCTOR
|
||||
* FOR NORMAL SPELLS.
|
||||
*/
|
||||
public EntityIceShard(World world, EntityLivingBase caster, float speed, float damageMultiplier){
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityHit(EntityLivingBase entityHit){
|
||||
|
||||
// Adds a freeze effect to the target.
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FROST, entityHit)) entityHit.addPotionEffect(new PotionEffect(WizardryPotions.frost, 200, 0));
|
||||
|
||||
|
||||
// Adds a freeze effect to the target.
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FROST, entityHit))
|
||||
entityHit.addPotionEffect(new PotionEffect(WizardryPotions.frost, 200, 0));
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickInAir(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHit(){
|
||||
// Adds a particle effect when the ice shard hits a block.
|
||||
if(this.worldObj.isRemote){
|
||||
for(int j=0; j<10; j++){
|
||||
double x = this.posX - 0.25d + (rand.nextDouble()/2);
|
||||
double y = this.posY - 0.25d + (rand.nextDouble()/2);
|
||||
double z = this.posZ - 0.25d + (rand.nextDouble()/2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, worldObj, x, y, z, x - this.posX, y - this.posY, z - this.posZ, 20 + rand.nextInt(10));
|
||||
}
|
||||
}
|
||||
// Parameters for sound: sound event name, volume, pitch.
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.0F, rand.nextFloat() * 0.4F + 1.2F);
|
||||
|
||||
if(this.world.isRemote){
|
||||
for(int j = 0; j < 10; j++){
|
||||
double x = this.posX - 0.25d + (rand.nextDouble() / 2);
|
||||
double y = this.posY - 0.25d + (rand.nextDouble() / 2);
|
||||
double z = this.posZ - 0.25d + (rand.nextDouble() / 2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, world, x, y, z, x - this.posX, y - this.posY,
|
||||
z - this.posZ, 20 + rand.nextInt(10));
|
||||
}
|
||||
}
|
||||
// Parameters for sound: sound event name, volume, pitch.
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.0F, rand.nextFloat() * 0.4F + 1.2F);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getDamage(){
|
||||
return 6.0d;
|
||||
}
|
||||
|
||||
public double getDamage(){
|
||||
return 6.0d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageType getDamageType(){
|
||||
return DamageType.FROST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doGravity(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
public boolean doGravity(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire() {
|
||||
public boolean doDeceleration(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,86 +10,91 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityLightningArrow extends EntityMagicArrow {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityLightningArrow(World world) {
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityLightningArrow(World world){
|
||||
super(world);
|
||||
}
|
||||
|
||||
/** Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this
|
||||
* constructor and then call setVelocity() as that method is, bizarrely, client-side only. */
|
||||
public EntityLightningArrow(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be altered
|
||||
* slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on easy, 6 on
|
||||
* normal and 2 on hard difficulty. */
|
||||
public EntityLightningArrow(World world, EntityLivingBase caster, Entity target, float speed, float aimingError, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this constructor
|
||||
* and then call setVelocity() as that method is, bizarrely, client-side only.
|
||||
*/
|
||||
public EntityLightningArrow(World world, double x, double y, double z){
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile pointing in the direction the caster is looking, with the given speed.
|
||||
* USE THIS CONSTRUCTOR FOR NORMAL SPELLS. */
|
||||
public EntityLightningArrow(World world, EntityLivingBase caster, float speed, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be
|
||||
* altered slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on
|
||||
* easy, 6 on normal and 2 on hard difficulty.
|
||||
*/
|
||||
public EntityLightningArrow(World world, EntityLivingBase caster, Entity target, float speed, float aimingError,
|
||||
float damageMultiplier){
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a projectile pointing in the direction the caster is looking, with the given speed. USE THIS CONSTRUCTOR
|
||||
* FOR NORMAL SPELLS.
|
||||
*/
|
||||
public EntityLightningArrow(World world, EntityLivingBase caster, float speed, float damageMultiplier){
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityHit(EntityLivingBase entityHit){
|
||||
|
||||
if(worldObj.isRemote){
|
||||
for(int j=0;j<8;j++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX + rand.nextFloat() - 0.5, this.posY + this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
|
||||
if(world.isRemote){
|
||||
for(int j = 0; j < 8; j++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() - 0.5,
|
||||
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
|
||||
0, 3);
|
||||
}
|
||||
}
|
||||
/* Pretty sure this needn't be here, probably missed it when I implemented the damage type system.
|
||||
if(entityHit instanceof EntityCreeper && !((EntityCreeper)entityHit).getPowered()){
|
||||
entityHit.getDataWatcher().updateObject(17, Byte.valueOf((byte)1));
|
||||
if(this.getShootingEntity() instanceof EntityPlayer) ((EntityPlayer)this.getShootingEntity()).addStat(Wizardry.chargeCreeper);
|
||||
}
|
||||
*/
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.0F);
|
||||
/* Pretty sure this needn't be here, probably missed it when I implemented the damage type system. if(entityHit
|
||||
* instanceof EntityCreeper && !((EntityCreeper)entityHit).getPowered()){
|
||||
* entityHit.getDataWatcher().updateObject(17, Byte.valueOf((byte)1)); if(this.getShootingEntity() instanceof
|
||||
* EntityPlayer) ((EntityPlayer)this.getShootingEntity()).addStat(Wizardry.chargeCreeper); } */
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickInAir(){
|
||||
|
||||
if (this.ticksExisted > 20){
|
||||
this.setDead();
|
||||
}
|
||||
if(this.ticksExisted > 20){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
if(world.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX, this.posY, this.posZ, 0, 0, 0,
|
||||
3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(worldObj.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX, this.posY, this.posZ, 0, 0, 0, 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDamage(){
|
||||
return 7.0d;
|
||||
}
|
||||
|
||||
public double getDamage(){
|
||||
return 7.0d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageType getDamageType(){
|
||||
return DamageType.SHOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doGravity(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
public boolean doGravity(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,71 +13,67 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityLightningDisc extends EntityMagicProjectile
|
||||
{
|
||||
public EntityLightningDisc(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
public class EntityLightningDisc extends EntityMagicProjectile {
|
||||
public EntityLightningDisc(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityLightningDisc(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityLightningDisc(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
public EntityLightningDisc(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityLightningDisc(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
this.width = 2.0f;
|
||||
this.height = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getSpeed(){
|
||||
return 1.2f;
|
||||
}
|
||||
public EntityLightningDisc(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
|
||||
public EntityLightningDisc(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
this.width = 2.0f;
|
||||
this.height = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult mop)
|
||||
{
|
||||
Entity entityHit = mop.entityHit;
|
||||
|
||||
if (entityHit != null)
|
||||
{
|
||||
float damage = 12 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK), damage);
|
||||
}
|
||||
@Override
|
||||
protected float getSpeed(){
|
||||
return 1.2f;
|
||||
}
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult mop){
|
||||
Entity entityHit = mop.entityHit;
|
||||
|
||||
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) this.setDead();
|
||||
}
|
||||
if(entityHit != null){
|
||||
float damage = 12 * damageMultiplier;
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK),
|
||||
damage);
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
for(int i=0;i<8;i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX + rand.nextFloat()*2 - 1, this.posY, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
//worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + rand.nextFloat() - 0.5, this.posY + this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 8; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() * 2 - 1,
|
||||
this.posY, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
// world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + rand.nextFloat() - 0.5, this.posY +
|
||||
// this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.isCollided && !worldObj.isRemote){
|
||||
|
||||
double seekingRange = 5.0d;
|
||||
|
||||
List<EntityLivingBase> entities = WizardryUtilities.getEntitiesWithinRadius(seekingRange, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
}
|
||||
|
||||
if(!this.isCollided && !world.isRemote){
|
||||
|
||||
double seekingRange = 5.0d;
|
||||
|
||||
List<EntityLivingBase> entities = WizardryUtilities.getEntitiesWithinRadius(seekingRange, this.posX,
|
||||
this.posY, this.posZ, this.world);
|
||||
Entity target = null;
|
||||
|
||||
for(Entity possibleTarget : entities){
|
||||
@@ -89,33 +85,31 @@ public class EntityLightningDisc extends EntityMagicProjectile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(target != null && Math.abs(this.motionX) < 1 && Math.abs(this.motionY) < 1 && Math.abs(this.motionZ) < 1){
|
||||
this.addVelocity((target.posX - this.posX)/30, (target.posY + target.height/2 - this.posY)/30, (target.posZ - this.posZ)/30);
|
||||
|
||||
if(target != null && Math.abs(this.motionX) < 1 && Math.abs(this.motionY) < 1
|
||||
&& Math.abs(this.motionZ) < 1){
|
||||
this.addVelocity((target.posX - this.posX) / 30, (target.posY + target.height / 2 - this.posY) / 30,
|
||||
(target.posZ - this.posZ) / 30);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 50){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
// Cancels out the slowdown effect in EntityThrowable
|
||||
this.motionX /= 0.99;
|
||||
this.motionY /= 0.99;
|
||||
this.motionZ /= 0.99;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getGravityVelocity()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 50){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Cancels out the slowdown effect in EntityThrowable
|
||||
this.motionX /= 0.99;
|
||||
this.motionY /= 0.99;
|
||||
this.motionZ /= 0.99;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getGravityVelocity(){
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,75 +8,82 @@ import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityMagicMissile extends EntityMagicArrow {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityMagicMissile(World world) {
|
||||
|
||||
/** Basic shell constructor. Should only be used by the client. */
|
||||
public EntityMagicMissile(World world){
|
||||
super(world);
|
||||
}
|
||||
|
||||
/** Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this
|
||||
* constructor and then call setVelocity() as that method is, bizarrely, client-side only. */
|
||||
public EntityMagicMissile(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be altered
|
||||
* slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on easy, 6 on
|
||||
* normal and 2 on hard difficulty. */
|
||||
public EntityMagicMissile(World world, EntityLivingBase caster, Entity target, float speed, float aimingError, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at position xyz in world, with no motion. Do not create a projectile with this constructor
|
||||
* and then call setVelocity() as that method is, bizarrely, client-side only.
|
||||
*/
|
||||
public EntityMagicMissile(World world, double x, double y, double z){
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
/** Creates a projectile pointing in the direction the caster is looking, with the given speed.
|
||||
* USE THIS CONSTRUCTOR FOR NORMAL SPELLS. */
|
||||
public EntityMagicMissile(World world, EntityLivingBase caster, float speed, float damageMultiplier)
|
||||
{
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
/**
|
||||
* Creates a projectile at the position of the caster, pointing at the given target. The trajectory seems to be
|
||||
* altered slightly by a random amount determined by the last parameter. For reference, skeletons set this to 10 on
|
||||
* easy, 6 on normal and 2 on hard difficulty.
|
||||
*/
|
||||
public EntityMagicMissile(World world, EntityLivingBase caster, Entity target, float speed, float aimingError,
|
||||
float damageMultiplier){
|
||||
super(world, caster, target, speed, aimingError, damageMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a projectile pointing in the direction the caster is looking, with the given speed. USE THIS CONSTRUCTOR
|
||||
* FOR NORMAL SPELLS.
|
||||
*/
|
||||
public EntityMagicMissile(World world, EntityLivingBase caster, float speed, float damageMultiplier){
|
||||
super(world, caster, speed, damageMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityHit(EntityLivingBase entityHit){
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickInAir(){
|
||||
|
||||
if (this.ticksExisted > 20){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
if(this.worldObj.isRemote){
|
||||
|
||||
if(this.ticksExisted % 2 == 1){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, worldObj, this.posX, this.posY, this.posZ, 0, 0, 0, 20 + rand.nextInt(10), 0.5f + (rand.nextFloat()/2), 0.5f + (rand.nextFloat()/2), 0.5f + (rand.nextFloat()/2));
|
||||
}
|
||||
else{
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, worldObj, this.posX, this.posY, this.posZ, 0, 0, 0, 20 + rand.nextInt(10), 0.5f + (rand.nextFloat()/2), 0.5f + (rand.nextFloat()/2), 0.5f + (rand.nextFloat()/2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDamage(){
|
||||
return 4.0d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doGravity(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return false;
|
||||
}
|
||||
if(this.ticksExisted > 20){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
if(this.world.isRemote){
|
||||
|
||||
if(this.ticksExisted % 2 == 1){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX, this.posY, this.posZ, 0, 0,
|
||||
0, 20 + rand.nextInt(10), 0.5f + (rand.nextFloat() / 2), 0.5f + (rand.nextFloat() / 2),
|
||||
0.5f + (rand.nextFloat() / 2));
|
||||
}else{
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX, this.posY, this.posZ, 0, 0,
|
||||
0, 20 + rand.nextInt(10), 0.5f + (rand.nextFloat() / 2), 0.5f + (rand.nextFloat() / 2),
|
||||
0.5f + (rand.nextFloat() / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
public double getDamage(){
|
||||
return 4.0d;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean doGravity(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doDeceleration(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,15 +7,18 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
/** This class is a generic superclass for all <b>non-directed</b> projectiles, namely: darkness orb, firebolt, firebomb,
|
||||
* force orb, ice charge, lightning disc, poison bomb, spark, spark bomb and thunderbolt. Directed (arrow-like) projectiles
|
||||
* should instead extend {@link EntityMagicArrow}.
|
||||
/**
|
||||
* This class is a generic superclass for all <b>non-directed</b> projectiles, namely: darkness orb, firebolt, firebomb,
|
||||
* force orb, ice charge, lightning disc, poison bomb, spark, spark bomb and thunderbolt. Directed (arrow-like)
|
||||
* projectiles should instead extend {@link EntityMagicArrow}.
|
||||
* <p>
|
||||
* This class purely handles saving of the damage multiplier; EntityThrowable is pretty well suited to my purposes
|
||||
* as it is. Range is done via the velocity when the constructor is called. Caster is already handled by EntityThrowable.getThrower().
|
||||
* This class purely handles saving of the damage multiplier; EntityThrowable is pretty well suited to my purposes as it
|
||||
* is. Range is done via the velocity when the constructor is called. Caster is already handled by
|
||||
* EntityThrowable.getThrower().
|
||||
*
|
||||
* Note that this class does not implement {@link IEntityAdditionalSpawnData}; subclasses that need to transfer extra
|
||||
* data to the client should implement that interface themselves. See {@link EntityBomb} for an example.
|
||||
*
|
||||
* Note that this class does not implement {@link IEntityAdditionalSpawnData}; subclasses that need to transfer extra data
|
||||
* to the client should implement that interface themselves. See {@link EntityBomb} for an example.
|
||||
* @since Wizardry 1.0
|
||||
* @author Electroblob
|
||||
* @see EntityBomb
|
||||
@@ -23,51 +26,48 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
public abstract class EntityMagicProjectile extends EntityThrowable {
|
||||
|
||||
public float damageMultiplier = 1.0f;
|
||||
|
||||
public EntityMagicProjectile(World world)
|
||||
{
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityMagicProjectile(World world, EntityLivingBase thrower)
|
||||
{
|
||||
super(world, thrower);
|
||||
}
|
||||
|
||||
public EntityMagicProjectile(World world, EntityLivingBase thrower, float damageMultiplier)
|
||||
{
|
||||
super(world, thrower);
|
||||
// This is the standard set of parameters for this method, used by snowballs and ender pearls amongst others.
|
||||
this.setHeadingFromThrower(thrower, thrower.rotationPitch, thrower.rotationYaw, 0.0f, this.getSpeed(), 1.0f);
|
||||
this.damageMultiplier = damageMultiplier;
|
||||
}
|
||||
public EntityMagicProjectile(World world){
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityMagicProjectile(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
/** This got removed at some point since 1.7.10, but I liked it so I thought I'd add it back in again. */
|
||||
protected float getSpeed(){
|
||||
return 1.5f;
|
||||
}
|
||||
|
||||
/** Sets this projectile's velocity as a normalised vector towards the target. */
|
||||
public void directTowards(Entity target, float velocity){
|
||||
public EntityMagicProjectile(World world, EntityLivingBase thrower){
|
||||
super(world, thrower);
|
||||
}
|
||||
|
||||
double dx = target.posX - this.posX;
|
||||
double dy = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.posY + (double)(this.height / 2.0F));
|
||||
double dz = target.posZ - this.posZ;
|
||||
|
||||
this.motionX = dx/this.getDistanceToEntity(target) * velocity;
|
||||
this.motionY = dy/this.getDistanceToEntity(target) * velocity;
|
||||
this.motionZ = dz/this.getDistanceToEntity(target) * velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityMagicProjectile(World world, EntityLivingBase thrower, float damageMultiplier){
|
||||
super(world, thrower);
|
||||
// This is the standard set of parameters for this method, used by snowballs and ender pearls amongst others.
|
||||
this.setHeadingFromThrower(thrower, thrower.rotationPitch, thrower.rotationYaw, 0.0f, this.getSpeed(), 1.0f);
|
||||
this.damageMultiplier = damageMultiplier;
|
||||
}
|
||||
|
||||
public EntityMagicProjectile(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
/** This got removed at some point since 1.7.10, but I liked it so I thought I'd add it back in again. */
|
||||
protected float getSpeed(){
|
||||
return 1.5f;
|
||||
}
|
||||
|
||||
/** Sets this projectile's velocity as a normalised vector towards the target. */
|
||||
public void directTowards(Entity target, float velocity){
|
||||
|
||||
double dx = target.posX - this.posX;
|
||||
double dy = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F)
|
||||
- (this.posY + (double)(this.height / 2.0F));
|
||||
double dz = target.posZ - this.posZ;
|
||||
|
||||
this.motionX = dx / this.getDistanceToEntity(target) * velocity;
|
||||
this.motionY = dy / this.getDistanceToEntity(target) * velocity;
|
||||
this.motionZ = dz / this.getDistanceToEntity(target) * velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
damageMultiplier = nbttagcompound.getFloat("damageMultiplier");
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
damageMultiplier = nbttagcompound.getFloat("damageMultiplier");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,5 +75,5 @@ public abstract class EntityMagicProjectile extends EntityThrowable {
|
||||
super.writeEntityToNBT(nbttagcompound);
|
||||
nbttagcompound.setFloat("damageMultiplier", damageMultiplier);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,69 +17,80 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityPoisonBomb extends EntityBomb {
|
||||
|
||||
public EntityPoisonBomb(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityPoisonBomb(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityPoisonBomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier, float blastMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
public EntityPoisonBomb(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityPoisonBomb(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
public EntityPoisonBomb(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult)
|
||||
{
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if (entityHit != null)
|
||||
{
|
||||
// This is if the poison bomb gets a direct hit
|
||||
float damage = 5 * damageMultiplier;
|
||||
public EntityPoisonBomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier,
|
||||
float blastMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON).setProjectile(), damage);
|
||||
|
||||
if(entityHit instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.POISON, entityHit)) ((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(MobEffects.POISON, 120, 1));
|
||||
}
|
||||
public EntityPoisonBomb(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
for(int i=0;i<60*blastMultiplier;i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, worldObj, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0.0d, 0.0d, 0.0d, 35, 0.2f + rand.nextFloat()*0.3f, 0.6f, 0.0f);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, worldObj, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0.0d, 0.0d, 0.0d, 0, 0.2f + rand.nextFloat()*0.2f, 0.8f, 0.0f);
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if(entityHit != null){
|
||||
// This is if the poison bomb gets a direct hit
|
||||
float damage = 5 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON).setProjectile(),
|
||||
damage);
|
||||
|
||||
if(entityHit instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.POISON, entityHit))
|
||||
((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(MobEffects.POISON, 120, 1));
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 60 * blastMultiplier; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 35,
|
||||
0.2f + rand.nextFloat() * 0.3f, 0.6f, 0.0f);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 0,
|
||||
0.2f + rand.nextFloat() * 0.2f, 0.8f, 0.0f);
|
||||
}
|
||||
// Spawning this after the other particles fixes the rendering colour bug. It's a bit of a cheat, but it works pretty well.
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
}
|
||||
// Spawning this after the other particles fixes the rendering colour bug. It's a bit of a cheat, but it
|
||||
// works pretty well.
|
||||
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.5F, rand.nextFloat() * 0.4F + 0.6F);
|
||||
this.playSound(SoundEvents.BLOCK_FIRE_EXTINGUISH, 1.2F, 1.0f);
|
||||
if(!this.world.isRemote){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.5F, rand.nextFloat() * 0.4F + 0.6F);
|
||||
this.playSound(SoundEvents.BLOCK_FIRE_EXTINGUISH, 1.2F, 1.0f);
|
||||
|
||||
double range = 3.0d * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
double range = 3.0d*blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
if(target != entityHit && target != this.getThrower() && !MagicDamage.isEntityImmune(DamageType.POISON, target)){
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON), 4.0f * damageMultiplier);
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.POISON, 100, 1));
|
||||
if(target != entityHit && target != this.getThrower()
|
||||
&& !MagicDamage.isEntityImmune(DamageType.POISON, target)){
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON),
|
||||
4.0f * damageMultiplier);
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.POISON, 100, 1));
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,49 +17,54 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntitySmokeBomb extends EntityBomb {
|
||||
|
||||
public EntitySmokeBomb(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntitySmokeBomb(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntitySmokeBomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier, float blastMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
public EntitySmokeBomb(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntitySmokeBomb(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
public EntitySmokeBomb(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
public EntitySmokeBomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier,
|
||||
float blastMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
for(int i=0;i<60*blastMultiplier;i++){
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0, 0, 0);
|
||||
public EntitySmokeBomb(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
for(int i = 0; i < 60 * blastMultiplier; i++){
|
||||
this.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0, 0, 0);
|
||||
float brightness = rand.nextFloat() * 0.3f;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, worldObj, this.posX + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ + (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0.0d, 0.0d, 0.0d, 0, brightness, brightness, brightness);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 0, brightness,
|
||||
brightness, brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.5F, rand.nextFloat() * 0.4F + 0.6F);
|
||||
this.playSound(SoundEvents.BLOCK_FIRE_EXTINGUISH, 1.2F, 1.0f);
|
||||
if(!this.world.isRemote){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_SPLASH_POTION_BREAK, 1.5F, rand.nextFloat() * 0.4F + 0.6F);
|
||||
this.playSound(SoundEvents.BLOCK_FIRE_EXTINGUISH, 1.2F, 1.0f);
|
||||
|
||||
double range = 3.0d * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
double range = 3.0d * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
if(target != this.getThrower()){
|
||||
// Gives the target blindness if it is a player, mind trick otherwise (since this has the desired
|
||||
@@ -69,13 +74,13 @@ public class EntitySmokeBomb extends EntityBomb {
|
||||
}else if(target instanceof EntityLiving){
|
||||
// New AI
|
||||
((EntityLiving)target).setAttackTarget(null);
|
||||
|
||||
|
||||
target.addPotionEffect(new PotionEffect(WizardryPotions.mind_trick, 120, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,68 +14,66 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntitySpark extends EntityMagicProjectile {
|
||||
|
||||
public EntitySpark(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntitySpark(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntitySpark(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
public EntitySpark(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntitySpark(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
/** This is the speed */
|
||||
protected float getSpeed()
|
||||
{
|
||||
return 0.5F;
|
||||
}
|
||||
public EntitySpark(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult)
|
||||
{
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if (entityHit != null){
|
||||
|
||||
float damage = 6 * damageMultiplier;
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK), damage);
|
||||
|
||||
}
|
||||
public EntitySpark(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
public EntitySpark(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
for(int i=0;i<8;i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX + rand.nextFloat() - 0.5, this.posY + this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
/** This is the speed */
|
||||
protected float getSpeed(){
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if(entityHit != null){
|
||||
|
||||
float damage = 6 * damageMultiplier;
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK),
|
||||
damage);
|
||||
|
||||
}
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 8; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() - 0.5,
|
||||
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
|
||||
0, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.isCollided && !worldObj.isRemote){
|
||||
|
||||
double seekingRange = 5.0d;
|
||||
|
||||
List<EntityLivingBase> entities = WizardryUtilities.getEntitiesWithinRadius(seekingRange, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.isCollided && !world.isRemote){
|
||||
|
||||
double seekingRange = 5.0d;
|
||||
|
||||
List<EntityLivingBase> entities = WizardryUtilities.getEntitiesWithinRadius(seekingRange, this.posX,
|
||||
this.posY, this.posZ, this.world);
|
||||
Entity target = null;
|
||||
|
||||
for(Entity possibleTarget : entities){
|
||||
@@ -87,30 +85,30 @@ public class EntitySpark extends EntityMagicProjectile {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(target != null && Math.abs(this.motionX) < 1 && Math.abs(this.motionY) < 1 && Math.abs(this.motionZ) < 1){
|
||||
this.addVelocity((target.posX - this.posX)/30, (target.posY + target.height/2 - this.posY)/30, (target.posZ - this.posZ)/30);
|
||||
|
||||
if(target != null && Math.abs(this.motionX) < 1 && Math.abs(this.motionY) < 1
|
||||
&& Math.abs(this.motionZ) < 1){
|
||||
this.addVelocity((target.posX - this.posX) / 30, (target.posY + target.height / 2 - this.posY) / 30,
|
||||
(target.posZ - this.posZ) / 30);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 100){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of gravity to apply to the thrown entity with each tick.
|
||||
*/
|
||||
protected float getGravityVelocity()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 100){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of gravity to apply to the thrown entity with each tick.
|
||||
*/
|
||||
protected float getGravityVelocity(){
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,96 +19,107 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntitySparkBomb extends EntityBomb {
|
||||
|
||||
/** For client use, because thrower field is not visible. */
|
||||
|
||||
/** For client use, because thrower field is not visible. */
|
||||
private int casterID;
|
||||
|
||||
public EntitySparkBomb(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntitySparkBomb(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntitySparkBomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier, float blastMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
public EntitySparkBomb(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntitySparkBomb(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
public EntitySparkBomb(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult)
|
||||
{
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST_FAR, 0.5f, 0.5f);
|
||||
public EntitySparkBomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier,
|
||||
float blastMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
|
||||
}
|
||||
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if (entityHit != null)
|
||||
{
|
||||
// This is if the spark bomb gets a direct hit
|
||||
float damage = 6 * damageMultiplier;
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
public EntitySparkBomb(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK).setProjectile(), damage);
|
||||
|
||||
}
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST_FAR, 0.5f, 0.5f);
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
for(int i=0;i<8;i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX + rand.nextFloat() - 0.5, this.posY + this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + rand.nextFloat() - 0.5, this.posY + this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if(entityHit != null){
|
||||
// This is if the spark bomb gets a direct hit
|
||||
float damage = 6 * damageMultiplier;
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
entityHit.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK).setProjectile(),
|
||||
damage);
|
||||
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 8; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() - 0.5,
|
||||
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
|
||||
0, 3);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + rand.nextFloat() - 0.5,
|
||||
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
double seekerRange = 5.0d * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
for(int i=0; i<Math.min(targets.size(), 4); i++){
|
||||
|
||||
boolean flag = targets.get(i) != entityHit && targets.get(i) != this.getThrower() && !(targets.get(i) instanceof EntityPlayer && ((EntityPlayer)targets.get(i)).capabilities.isCreativeMode);
|
||||
|
||||
}
|
||||
|
||||
double seekerRange = 5.0d * blastMultiplier;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(int i = 0; i < Math.min(targets.size(), 4); i++){
|
||||
|
||||
boolean flag = targets.get(i) != entityHit && targets.get(i) != this.getThrower()
|
||||
&& !(targets.get(i) instanceof EntityPlayer
|
||||
&& ((EntityPlayer)targets.get(i)).capabilities.isCreativeMode);
|
||||
|
||||
// Detects (client side) if target is the thrower, to stop particles being spawned around them.
|
||||
if(flag && worldObj.isRemote && targets.get(i).getEntityId() == this.casterID) flag = false;
|
||||
|
||||
if(flag && world.isRemote && targets.get(i).getEntityId() == this.casterID) flag = false;
|
||||
|
||||
if(flag){
|
||||
|
||||
|
||||
EntityLivingBase target = targets.get(i);
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
EntityArc arc = new EntityArc(this.worldObj);
|
||||
arc.setEndpointCoords(this.posX, this.posY, this.posZ,
|
||||
target.posX, target.posY + target.height/2, target.posZ);
|
||||
this.worldObj.spawnEntityInWorld(arc);
|
||||
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
EntityArc arc = new EntityArc(this.world);
|
||||
arc.setEndpointCoords(this.posX, this.posY, this.posZ, target.posX, target.posY + target.height / 2,
|
||||
target.posZ);
|
||||
this.world.spawnEntity(arc);
|
||||
|
||||
target.playSound(WizardrySounds.SPELL_SPARK, 1.0F, rand.nextFloat() * 0.4F + 1.5F);
|
||||
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK), 5.0f * damageMultiplier);
|
||||
|
||||
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK),
|
||||
5.0f * damageMultiplier);
|
||||
|
||||
}else{
|
||||
// Particle effect
|
||||
for(int j=0;j<8;j++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, target.posX + rand.nextFloat() - 0.5, target.getEntityBoundingBox().minY + target.height*rand.nextFloat(), target.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, target.posX + rand.nextFloat() - 0.5, target.getEntityBoundingBox().minY + target.height*rand.nextFloat(), target.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
|
||||
for(int j = 0; j < 8; j++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world,
|
||||
target.posX + rand.nextFloat() - 0.5,
|
||||
target.getEntityBoundingBox().minY + target.height * rand.nextFloat(),
|
||||
target.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, target.posX + rand.nextFloat() - 0.5,
|
||||
target.getEntityBoundingBox().minY + target.height * rand.nextFloat(),
|
||||
target.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf data){
|
||||
|
||||
@@ -12,89 +12,87 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityThunderbolt extends EntityMagicProjectile {
|
||||
|
||||
public EntityThunderbolt(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityThunderbolt(World par1World, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
public EntityThunderbolt(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier)
|
||||
{
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
public EntityThunderbolt(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityThunderbolt(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
/** This is the speed */
|
||||
protected float getSpeed()
|
||||
{
|
||||
return 2.5F;
|
||||
}
|
||||
public EntityThunderbolt(World par1World, EntityLivingBase par2EntityLivingBase){
|
||||
super(par1World, par2EntityLivingBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult)
|
||||
{
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if(entityHit != null){
|
||||
|
||||
float damage = 3 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK).setProjectile(), damage);
|
||||
|
||||
// Knockback
|
||||
entityHit.addVelocity(this.motionX*0.2, this.motionY*0.2, this.motionZ*0.2);
|
||||
}
|
||||
public EntityThunderbolt(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier){
|
||||
super(par1World, par2EntityLivingBase, damageMultiplier);
|
||||
}
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_LARGE_BLAST, 1.4F, 0.5f + this.rand.nextFloat() * 0.1F);
|
||||
public EntityThunderbolt(World par1World, double par2, double par4, double par6){
|
||||
super(par1World, par2, par4, par6);
|
||||
}
|
||||
|
||||
// Particle effect
|
||||
if(worldObj.isRemote){
|
||||
worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
}
|
||||
/** This is the speed */
|
||||
protected float getSpeed(){
|
||||
return 2.5F;
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(worldObj.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX + rand.nextFloat()*0.2 - 0.1, this.posY + this.height/2 + rand.nextFloat()*0.2 - 0.1, this.posZ + rand.nextFloat()*0.2 - 0.1, 0, 0, 0, 3);
|
||||
for(int i=0; i<4; i++){
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX + rand.nextFloat()*0.2 - 0.1, this.posY + this.height/2 + rand.nextFloat()*0.2 - 0.1, this.posZ + rand.nextFloat()*0.2 - 0.1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 8){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of gravity to apply to the thrown entity with each tick.
|
||||
*/
|
||||
protected float getGravityVelocity()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
protected void onImpact(RayTraceResult par1RayTraceResult){
|
||||
Entity entityHit = par1RayTraceResult.entityHit;
|
||||
|
||||
if(entityHit != null){
|
||||
|
||||
float damage = 3 * damageMultiplier;
|
||||
|
||||
entityHit.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK).setProjectile(),
|
||||
damage);
|
||||
|
||||
// Knockback
|
||||
entityHit.addVelocity(this.motionX * 0.2, this.motionY * 0.2, this.motionZ * 0.2);
|
||||
}
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_FIREWORK_LARGE_BLAST, 1.4F, 0.5f + this.rand.nextFloat() * 0.1F);
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(world.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() * 0.2 - 0.1,
|
||||
this.posY + this.height / 2 + rand.nextFloat() * 0.2 - 0.1,
|
||||
this.posZ + rand.nextFloat() * 0.2 - 0.1, 0, 0, 0, 3);
|
||||
for(int i = 0; i < 4; i++){
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX + rand.nextFloat() * 0.2 - 0.1,
|
||||
this.posY + this.height / 2 + rand.nextFloat() * 0.2 - 0.1,
|
||||
this.posZ + rand.nextFloat() * 0.2 - 0.1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 8){
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of gravity to apply to the thrown entity with each tick.
|
||||
*/
|
||||
protected float getGravityVelocity(){
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user