Initial 1.11.2 update
This commit is contained in:
@@ -7,32 +7,34 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityArrowRain extends EntityMagicConstruct {
|
||||
|
||||
public EntityArrowRain(World par1World) {
|
||||
|
||||
public EntityArrowRain(World par1World){
|
||||
super(par1World);
|
||||
this.height = 3.0f;
|
||||
this.width = 5.0f;
|
||||
}
|
||||
|
||||
public EntityArrowRain(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier) {
|
||||
|
||||
public EntityArrowRain(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.height = 3.0f;
|
||||
this.width = 5.0f;
|
||||
}
|
||||
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
EntityTippedArrow arrow = new EntityTippedArrow(worldObj, this.posX + rand.nextDouble()*6 - 3, this.posY + rand.nextDouble()*4 - 2, this.posZ + rand.nextDouble()*6 - 3);
|
||||
|
||||
if(!this.world.isRemote){
|
||||
EntityTippedArrow arrow = new EntityTippedArrow(world, this.posX + rand.nextDouble() * 6 - 3,
|
||||
this.posY + rand.nextDouble() * 4 - 2, this.posZ + rand.nextDouble() * 6 - 3);
|
||||
arrow.motionX = Math.cos(Math.toRadians(this.rotationYaw + 90));
|
||||
arrow.motionY = -0.6;
|
||||
arrow.motionZ = Math.sin(Math.toRadians(this.rotationYaw + 90));
|
||||
arrow.shootingEntity = this.getCaster();
|
||||
arrow.setDamage(7.0d*damageMultiplier);
|
||||
arrow.setDamage(7.0d * damageMultiplier);
|
||||
arrow.setPotionEffect(new ItemStack(Items.ARROW));
|
||||
this.worldObj.spawnEntityInWorld(arrow);
|
||||
this.world.spawnEntity(arrow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,38 +25,39 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
this.width = 6.0f;
|
||||
this.height = 3.0f;
|
||||
randomiser = new int[30];
|
||||
for(int i=0; i<randomiser.length; i++){
|
||||
for(int i = 0; i < randomiser.length; i++){
|
||||
randomiser[i] = this.rand.nextInt(10);
|
||||
}
|
||||
randomiser2 = new int[30];
|
||||
for(int i=0; i<randomiser2.length; i++){
|
||||
for(int i = 0; i < randomiser2.length; i++){
|
||||
randomiser2[i] = this.rand.nextInt(10);
|
||||
}
|
||||
}
|
||||
|
||||
public EntityBlackHole(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier) {
|
||||
public EntityBlackHole(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.width = 6.0f;
|
||||
this.height = 3.0f;
|
||||
randomiser = new int[30];
|
||||
for(int i=0; i<randomiser.length; i++){
|
||||
for(int i = 0; i < randomiser.length; i++){
|
||||
randomiser[i] = this.rand.nextInt(10);
|
||||
}
|
||||
randomiser2 = new int[30];
|
||||
for(int i=0; i<randomiser2.length; i++){
|
||||
for(int i = 0; i < randomiser2.length; i++){
|
||||
randomiser2[i] = this.rand.nextInt(10);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
randomiser = nbttagcompound.getIntArray("randomiser");
|
||||
randomiser2 = nbttagcompound.getIntArray("randomiser2");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound){
|
||||
super.writeEntityToNBT(nbttagcompound);
|
||||
nbttagcompound.setIntArray("randomiser", randomiser);
|
||||
nbttagcompound.setIntArray("randomiser2", randomiser2);
|
||||
@@ -66,13 +67,18 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
//System.out.println("Client side: " + this.worldObj.isRemote + ", Caster: " + this.caster);
|
||||
// System.out.println("Client side: " + this.world.isRemote + ", Caster: " + this.caster);
|
||||
|
||||
// Particle effect. Finishes 40 ticks before the end so the particles disappear at the same time.
|
||||
if(this.ticksExisted + 40 < this.lifetime){
|
||||
for (int i=0; i<5; i++){
|
||||
//this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.75D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX, this.posY, this.posZ, (this.rand.nextDouble() - 0.5D) * 4.0D, (this.rand.nextDouble() - 0.5D) * 4.0D - 1, (this.rand.nextDouble() - 0.5D) * 4.0D);
|
||||
for(int i = 0; i < 5; i++){
|
||||
// this.world.spawnParticle(EnumParticleTypes.PORTAL, this.posX + (this.rand.nextDouble() - 0.5D) *
|
||||
// (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.75D, this.posZ +
|
||||
// (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D,
|
||||
// -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
|
||||
this.world.spawnParticle(EnumParticleTypes.PORTAL, this.posX, this.posY, this.posZ,
|
||||
(this.rand.nextDouble() - 0.5D) * 4.0D, (this.rand.nextDouble() - 0.5D) * 4.0D - 1,
|
||||
(this.rand.nextDouble() - 0.5D) * 4.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +88,10 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
this.playSound(SoundEvents.BLOCK_PORTAL_AMBIENT, 1.5f, 1.0f);
|
||||
}
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(6.0d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(6.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.world.isRemote){
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -92,21 +99,21 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
|
||||
// Sucks the target in
|
||||
if(this.posX > target.posX && target.motionX < 1){
|
||||
target.motionX+=0.1;
|
||||
target.motionX += 0.1;
|
||||
}else if(this.posX < target.posX && target.motionX > -1){
|
||||
target.motionX-=0.1;
|
||||
target.motionX -= 0.1;
|
||||
}
|
||||
|
||||
if(this.posY > target.posY && target.motionY < 1){
|
||||
target.motionY+=0.1;
|
||||
target.motionY += 0.1;
|
||||
}else if(this.posY < target.posY && target.motionY > -1){
|
||||
target.motionY-=0.1;
|
||||
target.motionY -= 0.1;
|
||||
}
|
||||
|
||||
if(this.posZ > target.posZ && target.motionZ < 1){
|
||||
target.motionZ+=0.1;
|
||||
target.motionZ += 0.1;
|
||||
}else if(this.posZ < target.posZ && target.motionZ > -1){
|
||||
target.motionZ-=0.1;
|
||||
target.motionZ -= 0.1;
|
||||
}
|
||||
|
||||
// Player motion is handled on that player's client so needs packets
|
||||
@@ -117,9 +124,11 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
if(this.getDistanceToEntity(target) <= 2){
|
||||
// Damages the target if it is close enough
|
||||
if(this.getCaster() != null){
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC), 2*damageMultiplier);
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC),
|
||||
2 * damageMultiplier);
|
||||
}else{
|
||||
target.attackEntityFrom(DamageSource.magic, 2*damageMultiplier);
|
||||
target.attackEntityFrom(DamageSource.MAGIC, 2 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,8 +139,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
/**
|
||||
* Checks using a Vec3dd to determine if this entity is within range of that vector to be rendered. Args: Vec3dD
|
||||
*/
|
||||
public boolean isInRangeToRenderVec3dD(Vec3d par1Vec3d)
|
||||
{
|
||||
public boolean isInRangeToRenderVec3dD(Vec3d par1Vec3d){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,14 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityBlizzard extends EntityMagicConstruct {
|
||||
|
||||
public EntityBlizzard(World par1World) {
|
||||
public EntityBlizzard(World par1World){
|
||||
super(par1World);
|
||||
this.height = 1.0f;
|
||||
this.width = 1.0f;
|
||||
}
|
||||
|
||||
public EntityBlizzard(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier) {
|
||||
public EntityBlizzard(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.height = 1.0f;
|
||||
this.width = 1.0f;
|
||||
@@ -36,21 +37,25 @@ public class EntityBlizzard extends EntityMagicConstruct {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(3.0d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(3.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.FROST), 1*damageMultiplier);
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target,
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.FROST),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, DamageSource.magic, 1*damageMultiplier);
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, DamageSource.MAGIC,
|
||||
1 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// All entities are slowed, even the caster (except those immune to frost effects)
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FROST, target))
|
||||
target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 20, 0));
|
||||
@@ -58,10 +63,14 @@ public class EntityBlizzard extends EntityMagicConstruct {
|
||||
}else{
|
||||
// For some reason this number of particles now causes the game to lag significantly, despite it being fine
|
||||
// in 1.7.10. I thought particles were supposed to be LESS laggy now...
|
||||
for(int i=1; i<6; i++){
|
||||
float brightness = 0.5f + (rand.nextFloat()/2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.BLIZZARD, worldObj, this.posX, this.posY + rand.nextDouble()*3, this.posZ, 0, 0, 0, 100, brightness, brightness + 0.1f, 1.0f, false, rand.nextDouble() * 2.5d + 0.5d);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.BLIZZARD, worldObj, this.posX, this.posY + rand.nextDouble()*3, this.posZ, 0, 0, 0, 100, 1.0f, 1.0f, 1.0f, false, rand.nextDouble() * 2.5d + 0.5d);
|
||||
for(int i = 1; i < 6; i++){
|
||||
float brightness = 0.5f + (rand.nextFloat() / 2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.BLIZZARD, world, this.posX,
|
||||
this.posY + rand.nextDouble() * 3, this.posZ, 0, 0, 0, 100, brightness, brightness + 0.1f, 1.0f,
|
||||
false, rand.nextDouble() * 2.5d + 0.5d);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.BLIZZARD, world, this.posX,
|
||||
this.posY + rand.nextDouble() * 3, this.posZ, 0, 0, 0, 100, 1.0f, 1.0f, 1.0f, false,
|
||||
rand.nextDouble() * 2.5d + 0.5d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -18,79 +19,89 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class EntityBubble extends EntityMagicConstruct {
|
||||
|
||||
|
||||
public boolean isDarkOrb;
|
||||
|
||||
|
||||
private WeakReference<EntityLivingBase> rider;
|
||||
|
||||
|
||||
public EntityBubble(World world){
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityBubble(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, boolean isDarkOrb, float damageMultiplier) {
|
||||
public EntityBubble(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
boolean isDarkOrb, float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
//this.setSize(0.1f, 0.1f);
|
||||
// this.setSize(0.1f, 0.1f);
|
||||
this.isDarkOrb = isDarkOrb;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getMountedYOffset()
|
||||
{
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
public double getMountedYOffset(){
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRiderSit(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
|
||||
// Synchronises the rider field
|
||||
if((this.rider == null || this.rider.get() == null) && WizardryUtilities.getRider(this) instanceof EntityLivingBase
|
||||
if((this.rider == null || this.rider.get() == null)
|
||||
&& WizardryUtilities.getRider(this) instanceof EntityLivingBase
|
||||
&& !WizardryUtilities.getRider(this).isDead){
|
||||
this.rider = new WeakReference<EntityLivingBase>((EntityLivingBase) WizardryUtilities.getRider(this));
|
||||
this.rider = new WeakReference<EntityLivingBase>((EntityLivingBase)WizardryUtilities.getRider(this));
|
||||
}
|
||||
|
||||
|
||||
// Prevents dismounting
|
||||
if(WizardryUtilities.getRider(this) == null && this.rider != null && this.rider.get() != null && !this.rider.get().isDead){
|
||||
if(WizardryUtilities.getRider(this) == null && this.rider != null && this.rider.get() != null
|
||||
&& !this.rider.get().isDead){
|
||||
this.rider.get().startRiding(this);
|
||||
}
|
||||
|
||||
|
||||
// Stops the bubble bursting instantly.
|
||||
if(this.ticksExisted < 1 && !isDarkOrb) ((EntityLivingBase)WizardryUtilities.getRider(this)).hurtTime = 0;
|
||||
|
||||
this.moveEntity(0, 0.03, 0);
|
||||
|
||||
|
||||
this.move(MoverType.SELF, 0, 0.03, 0);
|
||||
|
||||
if(isDarkOrb){
|
||||
|
||||
|
||||
if(WizardryUtilities.getRider(this) != null && this.ticksExisted % 30 == 0){
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.getRider(this).attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC), 1*damageMultiplier);
|
||||
WizardryUtilities.getRider(this).attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
WizardryUtilities.getRider(this).attackEntityFrom(DamageSource.magic, 1*damageMultiplier);
|
||||
WizardryUtilities.getRider(this).attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<5; i++){
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height + 0.5d, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 5; i++){
|
||||
this.world.spawnParticle(EnumParticleTypes.PORTAL,
|
||||
this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width,
|
||||
this.posY + this.rand.nextDouble() * (double)this.height + 0.5d,
|
||||
this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width,
|
||||
(this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(),
|
||||
(this.rand.nextDouble() - 0.5D) * 2.0D);
|
||||
}
|
||||
if(lifetime - this.ticksExisted == 75){
|
||||
this.playSound(SoundEvents.BLOCK_PORTAL_TRIGGER, 1.5f, 1.0f);
|
||||
}else if(this.ticksExisted % 100 == 1 && this.ticksExisted < 150){
|
||||
this.playSound(SoundEvents.BLOCK_PORTAL_AMBIENT, 1.5f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
// Bubble bursts if the entity is hurt (see event handler) or killed, or if the bubble has existed for more than 10 seconds.
|
||||
|
||||
// Bubble bursts if the entity is hurt (see event handler) or killed, or if the bubble has existed for more than
|
||||
// 10 seconds.
|
||||
if(WizardryUtilities.getRider(this) == null && this.ticksExisted > 1){
|
||||
if(!this.isDarkOrb) this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 1.5f, 1.0f);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void despawn(){
|
||||
if(WizardryUtilities.getRider(this) != null){
|
||||
@@ -101,34 +112,34 @@ public class EntityBubble extends EntityMagicConstruct {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
isDarkOrb = nbttagcompound.getBoolean("isDarkOrb");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound){
|
||||
super.writeEntityToNBT(nbttagcompound);
|
||||
nbttagcompound.setBoolean("isDarkOrb", isDarkOrb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf data) {
|
||||
public void writeSpawnData(ByteBuf data){
|
||||
super.writeSpawnData(data);
|
||||
data.writeBoolean(this.isDarkOrb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteBuf data) {
|
||||
public void readSpawnData(ByteBuf data){
|
||||
super.readSpawnData(data);
|
||||
this.isDarkOrb = data.readBoolean();
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLivingAttackEvent(LivingAttackEvent event){
|
||||
// Bursts bubble when the creature inside takes damage
|
||||
if(event.getEntityLiving().getRidingEntity() instanceof EntityBubble &&
|
||||
!((EntityBubble)event.getEntityLiving().getRidingEntity()).isDarkOrb){
|
||||
if(event.getEntityLiving().getRidingEntity() instanceof EntityBubble
|
||||
&& !((EntityBubble)event.getEntityLiving().getRidingEntity()).isDarkOrb){
|
||||
event.getEntityLiving().getRidingEntity().playSound(SoundEvents.ENTITY_ITEM_PICKUP, 1.5f, 1.0f);
|
||||
event.getEntityLiving().getRidingEntity().setDead();
|
||||
}
|
||||
|
||||
@@ -14,18 +14,18 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityDecay extends EntityMagicConstruct {
|
||||
|
||||
|
||||
public int textureIndex = 0;
|
||||
public static final int LIFETIME = 400;
|
||||
|
||||
public EntityDecay(World par1World) {
|
||||
|
||||
public EntityDecay(World par1World){
|
||||
super(par1World);
|
||||
textureIndex = this.rand.nextInt(10);
|
||||
this.height = 0.2f;
|
||||
this.width = 2.0f;
|
||||
}
|
||||
|
||||
public EntityDecay(World par1World, double x, double y, double z, EntityLivingBase caster) {
|
||||
|
||||
public EntityDecay(World par1World, double x, double y, double z, EntityLivingBase caster){
|
||||
super(par1World, x, y, z, caster, LIFETIME, 1);
|
||||
textureIndex = this.rand.nextInt(10);
|
||||
this.height = 0.2f;
|
||||
@@ -34,45 +34,51 @@ public class EntityDecay extends EntityMagicConstruct {
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(this.rand.nextInt(700) == 0 && this.ticksExisted+100 < LIFETIME) this.playSound(SoundEvents.BLOCK_LAVA_AMBIENT, 0.2F + rand.nextFloat() * 0.2F, 0.6F + rand.nextFloat() * 0.15F);
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
if(this.rand.nextInt(700) == 0 && this.ticksExisted + 100 < LIFETIME)
|
||||
this.playSound(SoundEvents.BLOCK_LAVA_AMBIENT, 0.2F + rand.nextFloat() * 0.2F,
|
||||
0.6F + rand.nextFloat() * 0.15F);
|
||||
|
||||
if(!this.world.isRemote){
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
for(EntityLivingBase target : targets){
|
||||
if(target != this.getCaster()){
|
||||
// If this check wasn't here the potion would be reapplied every tick and hence the entity would be damaged each tick.
|
||||
// If this check wasn't here the potion would be reapplied every tick and hence the entity would be
|
||||
// damaged each tick.
|
||||
// In this case, we do want particles to be shown.
|
||||
if(!target.isPotionActive(WizardryPotions.decay)) target.addPotionEffect(new PotionEffect(WizardryPotions.decay, LIFETIME, 0));
|
||||
if(!target.isPotionActive(WizardryPotions.decay))
|
||||
target.addPotionEffect(new PotionEffect(WizardryPotions.decay, LIFETIME, 0));
|
||||
}
|
||||
}
|
||||
}else if(this.rand.nextInt(15) == 0){
|
||||
double radius = rand.nextDouble()*0.8;
|
||||
double angle = rand.nextDouble()*Math.PI*2;
|
||||
float brightness = rand.nextFloat()*0.4f;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, worldObj, this.posX + radius*Math.cos(angle), this.posY, this.posZ + radius*Math.sin(angle), 0, 0, 0, 0, brightness, 0, brightness+0.1f);
|
||||
double radius = rand.nextDouble() * 0.8;
|
||||
double angle = rand.nextDouble() * Math.PI * 2;
|
||||
float brightness = rand.nextFloat() * 0.4f;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, this.posX + radius * Math.cos(angle),
|
||||
this.posY, this.posZ + radius * Math.sin(angle), 0, 0, 0, 0, brightness, 0, brightness + 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
protected void entityInit(){}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||
|
||||
protected void entityInit(){
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks using a Vec3dd to determine if this entity is within range of that vector to be rendered. Args: Vec3dD
|
||||
*/
|
||||
public boolean isInRangeToRenderVec3dD(Vec3d par1Vec3d)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
* Checks using a Vec3dd to determine if this entity is within range of that vector to be rendered. Args: Vec3dD
|
||||
*/
|
||||
public boolean isInRangeToRenderVec3dD(Vec3d par1Vec3d){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class EntityEarthquake extends EntityMagicConstruct {
|
||||
}
|
||||
|
||||
public EntityEarthquake(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier) {
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.height = 1.0f;
|
||||
this.width = 1.0f;
|
||||
@@ -33,48 +33,58 @@ public class EntityEarthquake extends EntityMagicConstruct {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote){
|
||||
if(!world.isRemote){
|
||||
|
||||
double speed = 0.4;
|
||||
|
||||
// The further the earthquake is going to spread, the finer the angle increments.
|
||||
for(double angle=0; angle < 2*Math.PI; angle+=Math.PI/(lifetime*1.5)){
|
||||
for(double angle = 0; angle < 2 * Math.PI; angle += Math.PI / (lifetime * 1.5)){
|
||||
|
||||
// Calculates coordinates for the block to be moved. The radius increases with time. The +1.5 is to leave
|
||||
// Calculates coordinates for the block to be moved. The radius increases with time. The +1.5 is to
|
||||
// leave
|
||||
// blocks in the centre untouched.
|
||||
int x = this.posX < 0 ? (int)(this.posX + ((this.ticksExisted*speed)+1.5)*Math.sin(angle) - 1) : (int)(this.posX + ((this.ticksExisted*speed)+1.5)*Math.sin(angle));
|
||||
int x = this.posX < 0 ? (int)(this.posX + ((this.ticksExisted * speed) + 1.5) * Math.sin(angle) - 1)
|
||||
: (int)(this.posX + ((this.ticksExisted * speed) + 1.5) * Math.sin(angle));
|
||||
int y = (int)(this.posY - 0.5);
|
||||
int z = this.posZ < 0 ? (int)(this.posZ + ((this.ticksExisted*speed)+1.5)*Math.cos(angle) - 1) : (int)(this.posZ + ((this.ticksExisted*speed)+1.5)*Math.cos(angle));
|
||||
int z = this.posZ < 0 ? (int)(this.posZ + ((this.ticksExisted * speed) + 1.5) * Math.cos(angle) - 1)
|
||||
: (int)(this.posZ + ((this.ticksExisted * speed) + 1.5) * Math.cos(angle));
|
||||
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
if(!WizardryUtilities.isBlockUnbreakable(worldObj, pos) && !worldObj.isAirBlock(pos) && worldObj.isBlockNormalCube(pos, false)
|
||||
if(!WizardryUtilities.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
&& world.isBlockNormalCube(pos, false)
|
||||
// Checks that the block above is not solid, since this causes the falling sand to vanish.
|
||||
&& !worldObj.isBlockNormalCube(pos.up(), false)){
|
||||
&& !world.isBlockNormalCube(pos.up(), false)){
|
||||
|
||||
// Falling blocks do the setting block to air themselves.
|
||||
EntityFallingBlock fallingblock = new EntityFallingBlock(worldObj, x+0.5, y+0.5, z+0.5, worldObj.getBlockState(new BlockPos(x, y, z)));
|
||||
EntityFallingBlock fallingblock = new EntityFallingBlock(world, x + 0.5, y + 0.5, z + 0.5,
|
||||
world.getBlockState(new BlockPos(x, y, z)));
|
||||
fallingblock.motionY = 0.3;
|
||||
worldObj.spawnEntityInWorld(fallingblock);
|
||||
world.spawnEntity(fallingblock);
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius((this.ticksExisted*speed)+1.5, this.posX, this.posY, this.posZ, worldObj);
|
||||
List<EntityLivingBase> targets = WizardryUtilities
|
||||
.getEntitiesWithinRadius((this.ticksExisted * speed) + 1.5, this.posX, this.posY, this.posZ, world);
|
||||
|
||||
// In this particular instance, the caster is completely unaffected because they will always be in the centre.
|
||||
// In this particular instance, the caster is completely unaffected because they will always be in the
|
||||
// centre.
|
||||
targets.remove(this.getCaster());
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
// Searches in a 1 wide ring.
|
||||
if(this.getDistanceToEntity(target) > (this.ticksExisted*speed)+0.5 && target.posY < this.posY + 1 && target.posY > this.posY - 1){
|
||||
if(this.getDistanceToEntity(target) > (this.ticksExisted * speed) + 0.5 && target.posY < this.posY + 1
|
||||
&& target.posY > this.posY - 1){
|
||||
|
||||
// Knockback must be removed in this instance, or the target will fall into the floor.
|
||||
double motionX = target.motionX;
|
||||
double motionZ = target.motionZ;
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.BLAST), 10*this.damageMultiplier);
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.BLAST),
|
||||
10 * this.damageMultiplier);
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 400, 1));
|
||||
}
|
||||
|
||||
@@ -89,18 +99,19 @@ public class EntityEarthquake extends EntityMagicConstruct {
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Uncomment once 2.1.0 is released
|
||||
// }else{
|
||||
//
|
||||
// // Constant 15 blocks for now
|
||||
// List<EntityPlayer> targets = WizardryUtilities.getEntitiesWithinRadius(15, this.posX, this.posY, this.posZ, worldObj, EntityPlayer.class);
|
||||
//
|
||||
// float magnitude = 6f * ((float)(this.lifetime - this.ticksExisted))/(float)this.lifetime;
|
||||
//
|
||||
// // Makes the screen shake
|
||||
// for(EntityLivingBase target : targets){
|
||||
// target.setAngles(0, this.ticksExisted % 4 < 2 ? magnitude : -magnitude);
|
||||
// }
|
||||
// TODO: Uncomment once 2.1.0 is released
|
||||
// }else{
|
||||
//
|
||||
// // Constant 15 blocks for now
|
||||
// List<EntityPlayer> targets = WizardryUtilities.getEntitiesWithinRadius(15, this.posX, this.posY,
|
||||
// this.posZ, world, EntityPlayer.class);
|
||||
//
|
||||
// float magnitude = 6f * ((float)(this.lifetime - this.ticksExisted))/(float)this.lifetime;
|
||||
//
|
||||
// // Makes the screen shake
|
||||
// for(EntityLivingBase target : targets){
|
||||
// target.setAngles(0, this.ticksExisted % 4 < 2 ? magnitude : -magnitude);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,50 +11,54 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityFireRing extends EntityMagicConstruct {
|
||||
|
||||
public EntityFireRing(World par1World) {
|
||||
|
||||
public EntityFireRing(World par1World){
|
||||
super(par1World);
|
||||
this.height = 1.0f;
|
||||
this.width = 5.0f;
|
||||
}
|
||||
|
||||
public EntityFireRing(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier) {
|
||||
|
||||
public EntityFireRing(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.height = 1.0f;
|
||||
this.width = 5.0f;
|
||||
}
|
||||
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
if(this.ticksExisted % 40 == 1){
|
||||
this.playSound(SoundEvents.BLOCK_FIRE_AMBIENT, 4.0f, 0.7f);
|
||||
}
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
double velX = target.motionX;
|
||||
double velY = target.motionY;
|
||||
double velZ = target.motionZ;
|
||||
|
||||
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FIRE, target)){
|
||||
|
||||
|
||||
target.setFire(10);
|
||||
|
||||
|
||||
if(this.getCaster() != null){
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.FIRE), 1*damageMultiplier);
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.FIRE),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
target.attackEntityFrom(DamageSource.magic, 1*damageMultiplier);
|
||||
target.attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Removes knockback
|
||||
target.motionX = velX;
|
||||
target.motionY = velY;
|
||||
|
||||
@@ -13,13 +13,14 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityFireSigil extends EntityMagicConstruct {
|
||||
|
||||
public EntityFireSigil(World par1World) {
|
||||
public EntityFireSigil(World par1World){
|
||||
super(par1World);
|
||||
this.height = 0.2f;
|
||||
this.width = 2.0f;
|
||||
}
|
||||
|
||||
public EntityFireSigil(World par1World, double x, double y, double z, EntityLivingBase caster, float damageMultiplier) {
|
||||
public EntityFireSigil(World par1World, double x, double y, double z, EntityLivingBase caster,
|
||||
float damageMultiplier){
|
||||
super(par1World, x, y, z, caster, -1, damageMultiplier);
|
||||
this.height = 0.2f;
|
||||
this.width = 2.0f;
|
||||
@@ -27,8 +28,7 @@ public class EntityFireSigil extends EntityMagicConstruct {
|
||||
|
||||
// Overrides the original to stop the entity moving when it intersects stuff. The default arrow does this to allow
|
||||
// it to stick in blocks.
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
|
||||
{
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9){
|
||||
this.setPosition(par1, par3, par5);
|
||||
this.setRotation(par7, par8);
|
||||
}
|
||||
@@ -37,9 +37,10 @@ public class EntityFireSigil extends EntityMagicConstruct {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -48,8 +49,10 @@ public class EntityFireSigil extends EntityMagicConstruct {
|
||||
double velX = target.motionX;
|
||||
double velY = target.motionY;
|
||||
double velZ = target.motionZ;
|
||||
|
||||
target.attackEntityFrom(this.getCaster() != null ? MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.FIRE) : DamageSource.magic, 6);
|
||||
|
||||
target.attackEntityFrom(this.getCaster() != null
|
||||
? MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.FIRE)
|
||||
: DamageSource.MAGIC, 6);
|
||||
|
||||
// Removes knockback
|
||||
target.motionX = velX;
|
||||
@@ -59,28 +62,28 @@ public class EntityFireSigil extends EntityMagicConstruct {
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FIRE, target)) target.setFire(10);
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_BLAZE_SHOOT, 1, 1);
|
||||
|
||||
|
||||
// The trap is destroyed once triggered.
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}else if(this.rand.nextInt(15) == 0){
|
||||
double radius = 0.5 + rand.nextDouble()*0.3;
|
||||
double angle = rand.nextDouble()*Math.PI*2;
|
||||
worldObj.spawnParticle(EnumParticleTypes.FLAME, this.posX + radius*Math.cos(angle), this.posY + 0.1, this.posZ + radius*Math.sin(angle), 0, 0, 0);
|
||||
double radius = 0.5 + rand.nextDouble() * 0.3;
|
||||
double angle = rand.nextDouble() * Math.PI * 2;
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, this.posX + radius * Math.cos(angle), this.posY + 0.1,
|
||||
this.posZ + radius * Math.sin(angle), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,42 +16,44 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityForcefield extends EntityMagicConstruct {
|
||||
|
||||
public EntityForcefield(World world) {
|
||||
public EntityForcefield(World world){
|
||||
super(world);
|
||||
this.height = 6;
|
||||
this.width = 6;
|
||||
this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 3, this.posY - 3, this.posZ - 3, this.posX + 3, this.posY + 3, this.posZ + 3));
|
||||
this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 3, this.posY - 3, this.posZ - 3, this.posX + 3,
|
||||
this.posY + 3, this.posZ + 3));
|
||||
}
|
||||
|
||||
public EntityForcefield(World world, double x, double y, double z, EntityLivingBase caster, int lifetime) {
|
||||
|
||||
public EntityForcefield(World world, double x, double y, double z, EntityLivingBase caster, int lifetime){
|
||||
// y-3 because it needs to be centred on the given position
|
||||
// Damage multiplier is 1 because forcefields do no damage!
|
||||
super(world, x, y-3, z, caster, lifetime, 1.0f);
|
||||
super(world, x, y - 3, z, caster, lifetime, 1.0f);
|
||||
this.height = 6;
|
||||
this.width = 6;
|
||||
this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 3, this.posY - 3, this.posZ - 3, this.posX + 3, this.posY + 3, this.posZ + 3));
|
||||
this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 3, this.posY - 3, this.posZ - 3, this.posX + 3,
|
||||
this.posY + 3, this.posZ + 3));
|
||||
}
|
||||
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
return !this.isDead;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBox(Entity par1Entity)
|
||||
{
|
||||
return par1Entity.getEntityBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
public boolean canBeCollidedWith(){
|
||||
return !this.isDead;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBox(Entity par1Entity){
|
||||
return par1Entity.getEntityBoundingBox();
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(3.5, this.posX, this.posY + 3, this.posZ, this.worldObj);
|
||||
|
||||
if(!this.world.isRemote){
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(3.5, this.posX, this.posY + 3,
|
||||
this.posZ, this.world);
|
||||
for(EntityLivingBase target : targets){
|
||||
if(this.isValidTarget(target)){
|
||||
double multiplier = (3.5 - target.getDistance(this.posX, this.posY+3, this.posZ))*0.1;
|
||||
target.addVelocity((target.posX - this.posX)*multiplier, (target.posY - (this.posY + 3))*multiplier, (target.posZ - this.posZ)*multiplier);
|
||||
double multiplier = (3.5 - target.getDistance(this.posX, this.posY + 3, this.posZ)) * 0.1;
|
||||
target.addVelocity((target.posX - this.posX) * multiplier,
|
||||
(target.posY - (this.posY + 3)) * multiplier, (target.posZ - this.posZ) * multiplier);
|
||||
// Player motion is handled on that player's client so needs packets
|
||||
if(target instanceof EntityPlayerMP){
|
||||
((EntityPlayerMP)target).connection.sendPacket(new SPacketEntityVelocity(target));
|
||||
@@ -59,33 +61,35 @@ public class EntityForcefield extends EntityMagicConstruct {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(int i=1; i<40; i++){
|
||||
float brightness = 0.5f + (rand.nextFloat()*0.5f);
|
||||
double radius = 3;
|
||||
double yaw = rand.nextDouble()*Math.PI*2;
|
||||
double pitch = (rand.nextDouble()-0.5)*Math.PI;
|
||||
// Generates a spherical pattern of particles
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.BRIGHT_DUST, worldObj, this.posX + radius*Math.cos(yaw)*Math.cos(pitch), this.posY + 3 + radius*Math.sin(pitch), this.posZ + radius*Math.sin(yaw)*Math.cos(pitch), 0, 0, 0, 48 + this.rand.nextInt(12), brightness, brightness, 1.0f);
|
||||
for(int i = 1; i < 40; i++){
|
||||
float brightness = 0.5f + (rand.nextFloat() * 0.5f);
|
||||
double radius = 3;
|
||||
double yaw = rand.nextDouble() * Math.PI * 2;
|
||||
double pitch = (rand.nextDouble() - 0.5) * Math.PI;
|
||||
// Generates a spherical pattern of particles
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.BRIGHT_DUST, world,
|
||||
this.posX + radius * Math.cos(yaw) * Math.cos(pitch), this.posY + 3 + radius * Math.sin(pitch),
|
||||
this.posZ + radius * Math.sin(yaw) * Math.cos(pitch), 0, 0, 0, 48 + this.rand.nextInt(12),
|
||||
brightness, brightness, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean attackEntityFrom(DamageSource source, float par2){
|
||||
|
||||
|
||||
if(source != null && source.getSourceOfDamage() != null){
|
||||
// Now works for any source of damage.
|
||||
source.getSourceOfDamage().playSound(WizardrySounds.SPELL_DEFLECTION, 0.3f, 1.3f);
|
||||
}
|
||||
super.attackEntityFrom(source, par2);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,77 +15,80 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityFrostSigil extends EntityMagicConstruct {
|
||||
|
||||
public EntityFrostSigil(World par1World) {
|
||||
|
||||
public EntityFrostSigil(World par1World){
|
||||
super(par1World);
|
||||
this.height = 0.2f;
|
||||
this.width = 2.0f;
|
||||
}
|
||||
|
||||
public EntityFrostSigil(World par1World, double x, double y, double z, EntityLivingBase caster, float damageMultiplier) {
|
||||
|
||||
public EntityFrostSigil(World par1World, double x, double y, double z, EntityLivingBase caster,
|
||||
float damageMultiplier){
|
||||
super(par1World, x, y, z, caster, -1, damageMultiplier);
|
||||
this.height = 0.2f;
|
||||
this.width = 2.0f;
|
||||
}
|
||||
|
||||
|
||||
// Overrides the original to stop the entity moving when it intersects stuff. The default arrow does this to allow
|
||||
// it to stick in blocks.
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
|
||||
{
|
||||
this.setPosition(par1, par3, par5);
|
||||
this.setRotation(par7, par8);
|
||||
}
|
||||
|
||||
// it to stick in blocks.
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9){
|
||||
this.setPosition(par1, par3, par5);
|
||||
this.setRotation(par7, par8);
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
double velX = target.motionX;
|
||||
double velY = target.motionY;
|
||||
double velZ = target.motionZ;
|
||||
|
||||
target.attackEntityFrom(this.getCaster() != null ? MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.FROST) : DamageSource.magic, 8);
|
||||
|
||||
|
||||
target.attackEntityFrom(this.getCaster() != null
|
||||
? MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.FROST)
|
||||
: DamageSource.MAGIC, 8);
|
||||
|
||||
// Removes knockback
|
||||
target.motionX = velX;
|
||||
target.motionY = velY;
|
||||
target.motionZ = velZ;
|
||||
|
||||
|
||||
if(!MagicDamage.isEntityImmune(DamageType.FROST, target))
|
||||
target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 200, 1));
|
||||
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_FREEZE, 1.0f, 1.0f);
|
||||
|
||||
|
||||
// The trap is destroyed once triggered.
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}else if(this.rand.nextInt(15) == 0){
|
||||
double radius = 0.5 + rand.nextDouble()*0.3;
|
||||
double angle = rand.nextDouble()*Math.PI*2;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SNOW, worldObj, this.posX + radius*Math.cos(angle), this.posY + 0.1, this.posZ + radius*Math.sin(angle), 0, 0, 0, 40 + rand.nextInt(10));
|
||||
double radius = 0.5 + rand.nextDouble() * 0.3;
|
||||
double angle = rand.nextDouble() * Math.PI * 2;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SNOW, world, this.posX + radius * Math.cos(angle),
|
||||
this.posY + 0.1, this.posZ + radius * Math.sin(angle), 0, 0, 0, 40 + rand.nextInt(10));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,32 +5,34 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityHailstorm extends EntityMagicConstruct {
|
||||
|
||||
public EntityHailstorm(World par1World) {
|
||||
|
||||
public EntityHailstorm(World par1World){
|
||||
super(par1World);
|
||||
this.height = 3.0f;
|
||||
this.width = 5.0f;
|
||||
}
|
||||
|
||||
public EntityHailstorm(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier) {
|
||||
|
||||
public EntityHailstorm(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.height = 3.0f;
|
||||
this.width = 5.0f;
|
||||
}
|
||||
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
//System.out.println(this.rotationYaw);
|
||||
EntityIceShard iceshard = new EntityIceShard(worldObj, this.posX + rand.nextDouble()*6 - 3, this.posY + rand.nextDouble()*4 - 2, this.posZ + rand.nextDouble()*6 - 3);
|
||||
|
||||
if(!this.world.isRemote){
|
||||
// System.out.println(this.rotationYaw);
|
||||
EntityIceShard iceshard = new EntityIceShard(world, this.posX + rand.nextDouble() * 6 - 3,
|
||||
this.posY + rand.nextDouble() * 4 - 2, this.posZ + rand.nextDouble() * 6 - 3);
|
||||
iceshard.motionX = Math.cos(Math.toRadians(this.rotationYaw + 90));
|
||||
iceshard.motionY = -0.6;
|
||||
iceshard.motionZ = Math.sin(Math.toRadians(this.rotationYaw + 90));
|
||||
iceshard.setShootingEntity(this.getCaster());
|
||||
iceshard.damageMultiplier = this.damageMultiplier;
|
||||
this.worldObj.spawnEntityInWorld(iceshard);
|
||||
this.world.spawnEntity(iceshard);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -23,161 +24,171 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityHammer extends EntityMagicConstruct {
|
||||
|
||||
/** How long the hammer has been falling for. */
|
||||
public int fallTime;
|
||||
/** How long the hammer has been falling for. */
|
||||
public int fallTime;
|
||||
|
||||
public EntityHammer(World par1World){
|
||||
super(par1World);
|
||||
this.setSize(1.0f, 1.9F);
|
||||
this.noClip = false;
|
||||
}
|
||||
public EntityHammer(World par1World){
|
||||
super(par1World);
|
||||
this.setSize(1.0f, 1.9F);
|
||||
this.noClip = false;
|
||||
}
|
||||
|
||||
public EntityHammer(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.setSize(1.0f, 1.9F);
|
||||
this.motionX = 0.0D;
|
||||
this.motionY = 0.0D;
|
||||
this.motionZ = 0.0D;
|
||||
this.noClip = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBurning(){
|
||||
return false;
|
||||
}
|
||||
public EntityHammer(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.setSize(1.0f, 1.9F);
|
||||
this.motionX = 0.0D;
|
||||
this.motionY = 0.0D;
|
||||
this.motionZ = 0.0D;
|
||||
this.noClip = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(){
|
||||
return this.getEntityBoundingBox();
|
||||
}
|
||||
@Override
|
||||
public boolean isBurning(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(this.ticksExisted % 20 == 1 && !this.onGround && worldObj.isRemote){
|
||||
// Though this sound does repeat, it stops when it hits the ground.
|
||||
Wizardry.proxy.playMovingSound(this, WizardrySounds.SPELL_LOOP_LIGHTNING, 3.0f, 1.0f, false);
|
||||
@Override
|
||||
public boolean canBeCollidedWith(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(){
|
||||
return this.getEntityBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(this.ticksExisted % 20 == 1 && !this.onGround && world.isRemote){
|
||||
// Though this sound does repeat, it stops when it hits the ground.
|
||||
Wizardry.proxy.playMovingSound(this, WizardrySounds.SPELL_LOOP_LIGHTNING, 3.0f, 1.0f, false);
|
||||
}
|
||||
|
||||
if(this.worldObj.isRemote && this.ticksExisted % 3 == 0){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX - 0.5d + rand.nextDouble(), this.posY + 2*rand.nextDouble(), this.posZ - 0.5d + rand.nextDouble(), 0, 0, 0, 3);
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
++this.fallTime;
|
||||
this.motionY -= 0.03999999910593033D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.9800000190734863D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
|
||||
if(this.onGround){
|
||||
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -0.5D;
|
||||
|
||||
if(this.ticksExisted % 40 == 0){
|
||||
|
||||
double seekerRange = 10.0d;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX, this.posY+1, this.posZ, worldObj);
|
||||
|
||||
if(this.world.isRemote && this.ticksExisted % 3 == 0){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX - 0.5d + rand.nextDouble(),
|
||||
this.posY + 2 * rand.nextDouble(), this.posZ - 0.5d + rand.nextDouble(), 0, 0, 0, 3);
|
||||
}
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
++this.fallTime;
|
||||
this.motionY -= 0.03999999910593033D;
|
||||
this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.9800000190734863D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
|
||||
if(this.onGround){
|
||||
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -0.5D;
|
||||
|
||||
if(this.ticksExisted % 40 == 0){
|
||||
|
||||
double seekerRange = 10.0d;
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX,
|
||||
this.posY + 1, this.posZ, world);
|
||||
|
||||
// For this spell there is no limit to the amount of secondary targets!
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
if(!worldObj.isRemote){
|
||||
EntityArc arc = new EntityArc(worldObj);
|
||||
arc.setEndpointCoords(this.posX, this.posY + this.height - 0.1, this.posZ,
|
||||
target.posX, target.posY + target.height/2, target.posZ);
|
||||
worldObj.spawnEntityInWorld(arc);
|
||||
|
||||
if(!world.isRemote){
|
||||
EntityArc arc = new EntityArc(world);
|
||||
arc.setEndpointCoords(this.posX, this.posY + this.height - 0.1, this.posZ, target.posX,
|
||||
target.posY + target.height / 2, target.posZ);
|
||||
world.spawnEntity(arc);
|
||||
}else{
|
||||
for(int j=0;j<8;j++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, target.posX + worldObj.rand.nextFloat() - 0.5, target.getEntityBoundingBox().minY + target.height/2 + worldObj.rand.nextFloat()*2 - 1, target.posZ + worldObj.rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, target.posX + rand.nextFloat(), target.getEntityBoundingBox().minY + target.height/2 + rand.nextFloat(), target.posZ + rand.nextFloat(), 0, 0, 0);
|
||||
}
|
||||
for(int j = 0; j < 8; j++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world,
|
||||
target.posX + world.rand.nextFloat() - 0.5,
|
||||
target.getEntityBoundingBox().minY + target.height / 2
|
||||
+ world.rand.nextFloat() * 2 - 1,
|
||||
target.posZ + world.rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, target.posX + rand.nextFloat(),
|
||||
target.getEntityBoundingBox().minY + target.height / 2 + rand.nextFloat(),
|
||||
target.posZ + rand.nextFloat(), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
target.playSound(WizardrySounds.SPELL_SPARK, 1.0F, rand.nextFloat() * 0.4F + 1.5F);
|
||||
|
||||
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.SHOCK), 6*damageMultiplier);
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target,
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.SHOCK),
|
||||
6 * damageMultiplier);
|
||||
WizardryUtilities.applyStandardKnockback(this, target);
|
||||
}else{
|
||||
target.attackEntityFrom(DamageSource.magic, 6*damageMultiplier);
|
||||
target.attackEntityFrom(DamageSource.MAGIC, 6 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void despawn(){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 1.0F, 1.0f);
|
||||
|
||||
if(this.worldObj.isRemote){
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void despawn(){
|
||||
|
||||
this.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 1.0F, 1.0f);
|
||||
|
||||
if(this.world.isRemote){
|
||||
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
}
|
||||
|
||||
super.despawn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fall(float distance, float damageMultiplier) {
|
||||
|
||||
if(worldObj.isRemote){
|
||||
for(int i=0; i<40; i++){
|
||||
double particleX = this.posX - 1.0d + 2*rand.nextDouble();
|
||||
double particleZ = this.posZ - 1.0d + 2*rand.nextDouble();
|
||||
// Roundabout way of getting a block instance for the block the hammer is standing on (if any).
|
||||
IBlockState block = worldObj.getBlockState(new BlockPos(this.posX, this.posY-2, this.posZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fall(float distance, float damageMultiplier){
|
||||
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 40; i++){
|
||||
double particleX = this.posX - 1.0d + 2 * rand.nextDouble();
|
||||
double particleZ = this.posZ - 1.0d + 2 * rand.nextDouble();
|
||||
// Roundabout way of getting a block instance for the block the hammer is standing on (if any).
|
||||
IBlockState block = world.getBlockState(new BlockPos(this.posX, this.posY - 2, this.posZ));
|
||||
|
||||
if(block != null){
|
||||
worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, particleX, this.posY, particleZ,
|
||||
world.spawnParticle(EnumParticleTypes.BLOCK_DUST, particleX, this.posY, particleZ,
|
||||
particleX - this.posX, 0, particleZ - this.posZ, Block.getStateId(block));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}
|
||||
}else{
|
||||
// Just to check the hammer has actually fallen from the sky, rather than the block under it being broken.
|
||||
if(this.fallDistance > 10){
|
||||
EntityLightningBolt entitylightning = new EntityLightningBolt(worldObj, this.posX, this.posY, this.posZ, false);
|
||||
worldObj.addWeatherEffect(entitylightning);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.fallDistance > 10){
|
||||
EntityLightningBolt entitylightning = new EntityLightningBolt(world, this.posX, this.posY, this.posZ,
|
||||
false);
|
||||
world.addWeatherEffect(entitylightning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.writeEntityToNBT(nbttagcompound);
|
||||
nbttagcompound.setByte("Time", (byte)this.fallTime);
|
||||
}
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound){
|
||||
super.writeEntityToNBT(nbttagcompound);
|
||||
nbttagcompound.setByte("Time", (byte)this.fallTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
this.fallTime = nbttagcompound.getByte("Time") & 255;
|
||||
}
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
this.fallTime = nbttagcompound.getByte("Time") & 255;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isInRangeToRenderDist(double distance){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,14 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityHealAura extends EntityMagicConstruct {
|
||||
|
||||
public EntityHealAura(World world) {
|
||||
public EntityHealAura(World world){
|
||||
super(world);
|
||||
this.height = 1.0f;
|
||||
this.width = 5.0f;
|
||||
}
|
||||
|
||||
public EntityHealAura(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier) {
|
||||
public EntityHealAura(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.height = 1.0f;
|
||||
this.width = 5.0f;
|
||||
@@ -34,9 +35,10 @@ public class EntityHealAura extends EntityMagicConstruct {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -49,9 +51,11 @@ public class EntityHealAura extends EntityMagicConstruct {
|
||||
double velZ = target.motionZ;
|
||||
|
||||
if(this.getCaster() != null){
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.RADIANT), 1*damageMultiplier);
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.RADIANT),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
target.attackEntityFrom(DamageSource.magic, 1*damageMultiplier);
|
||||
target.attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
|
||||
}
|
||||
|
||||
// Removes knockback
|
||||
@@ -61,15 +65,17 @@ public class EntityHealAura extends EntityMagicConstruct {
|
||||
}
|
||||
|
||||
}else if(target.getHealth() < target.getMaxHealth() && this.ticksExisted % 5 == 0){
|
||||
target.heal(1*damageMultiplier);
|
||||
target.heal(1 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(int i=1; i<3; i++){
|
||||
float brightness = 0.5f + (rand.nextFloat()*0.5f);
|
||||
double radius = rand.nextDouble()*2.0;
|
||||
double angle = rand.nextDouble()*Math.PI*2;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, worldObj, this.posX + radius*Math.cos(angle), this.posY, this.posZ + radius*Math.sin(angle), 0, 0.05f, 0, 48 + this.rand.nextInt(12), 1.0f, 1.0f, brightness);
|
||||
for(int i = 1; i < 3; i++){
|
||||
float brightness = 0.5f + (rand.nextFloat() * 0.5f);
|
||||
double radius = rand.nextDouble() * 2.0;
|
||||
double angle = rand.nextDouble() * Math.PI * 2;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX + radius * Math.cos(angle),
|
||||
this.posY, this.posZ + radius * Math.sin(angle), 0, 0.05f, 0, 48 + this.rand.nextInt(12), 1.0f,
|
||||
1.0f, brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,8 +83,7 @@ public class EntityHealAura extends EntityMagicConstruct {
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,45 +5,49 @@ import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityIceSpike extends EntityMagicConstruct {
|
||||
|
||||
public EntityIceSpike(World world) {
|
||||
public EntityIceSpike(World world){
|
||||
super(world);
|
||||
this.setSize(0.5f, 1.0f);
|
||||
}
|
||||
|
||||
public EntityIceSpike(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier){
|
||||
|
||||
public EntityIceSpike(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.setSize(0.5f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
if(lifetime - this.ticksExisted < 15){
|
||||
this.motionY = -0.01*(this.ticksExisted-(lifetime-15));
|
||||
this.motionY = -0.01 * (this.ticksExisted - (lifetime - 15));
|
||||
}else if(lifetime - this.ticksExisted < 25){
|
||||
this.motionY = 0;
|
||||
}else if(lifetime - this.ticksExisted < 28){
|
||||
this.motionY = 0.25;
|
||||
}
|
||||
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
|
||||
this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if(lifetime - this.ticksExisted == 30) this.playSound(WizardrySounds.SPELL_ICE, 1, 2);
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
for(Object entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox())){
|
||||
|
||||
if(!this.world.isRemote){
|
||||
for(Object entity : this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox())){
|
||||
if(entity instanceof EntityLivingBase && this.isValidTarget((EntityLivingBase)entity)){
|
||||
// Potion effect only gets added if the damage succeeded.
|
||||
if(((EntityLivingBase)entity).attackEntityFrom(MagicDamage.causeDirectMagicDamage(this.getCaster(), DamageType.FROST), 5*this.damageMultiplier))
|
||||
if(((EntityLivingBase)entity).attackEntityFrom(
|
||||
MagicDamage.causeDirectMagicDamage(this.getCaster(), DamageType.FROST),
|
||||
5 * this.damageMultiplier))
|
||||
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(WizardryPotions.frost, 100, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,13 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityLightningPulse extends EntityMagicConstruct {
|
||||
|
||||
public EntityLightningPulse(World world) {
|
||||
public EntityLightningPulse(World world){
|
||||
super(world);
|
||||
this.setSize(6, 0.2f);
|
||||
}
|
||||
|
||||
public EntityLightningPulse(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier) {
|
||||
public EntityLightningPulse(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.setSize(6, 0.2f);
|
||||
}
|
||||
@@ -18,8 +19,7 @@ public class EntityLightningPulse extends EntityMagicConstruct {
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,111 +15,127 @@ import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityLightningSigil extends EntityMagicConstruct {
|
||||
|
||||
public EntityLightningSigil(World par1World) {
|
||||
|
||||
public EntityLightningSigil(World par1World){
|
||||
super(par1World);
|
||||
this.height = 0.2f;
|
||||
this.width = 2.0f;
|
||||
}
|
||||
|
||||
public EntityLightningSigil(World par1World, double x, double y, double z, EntityLivingBase caster, float damageMultiplier) {
|
||||
|
||||
public EntityLightningSigil(World par1World, double x, double y, double z, EntityLivingBase caster,
|
||||
float damageMultiplier){
|
||||
super(par1World, x, y, z, caster, -1, damageMultiplier);
|
||||
this.height = 0.2f;
|
||||
this.width = 2.0f;
|
||||
}
|
||||
|
||||
|
||||
// Overrides the original to stop the entity moving when it intersects stuff. The default arrow does this to allow
|
||||
// it to stick in blocks.
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
|
||||
{
|
||||
this.setPosition(par1, par3, par5);
|
||||
this.setRotation(par7, par8);
|
||||
}
|
||||
|
||||
// it to stick in blocks.
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9){
|
||||
this.setPosition(par1, par3, par5);
|
||||
this.setRotation(par7, par8);
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(this.ticksExisted > 600 && this.getCaster() == null && !this.worldObj.isRemote){
|
||||
|
||||
if(this.ticksExisted > 600 && this.getCaster() == null && !this.world.isRemote){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
//if(!this.worldObj.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
double velX = target.motionX;
|
||||
double velY = target.motionY;
|
||||
double velZ = target.motionZ;
|
||||
|
||||
// Only works if target is actually damaged to account for hurtResistantTime
|
||||
if(target.attackEntityFrom(getCaster() != null ? MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.SHOCK) : DamageSource.magic, 6)){
|
||||
|
||||
// Removes knockback
|
||||
target.motionX = velX;
|
||||
target.motionY = velY;
|
||||
target.motionZ = velZ;
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0f, 1.0f);
|
||||
|
||||
// Secondary chaining effect
|
||||
double seekerRange = 5.0d;
|
||||
|
||||
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, target.posX, target.posY + target.height/2, target.posZ, worldObj);
|
||||
// if(!this.world.isRemote){
|
||||
|
||||
for(int j=0;j<Math.min(secondaryTargets.size(), 3);j++){
|
||||
|
||||
EntityLivingBase secondaryTarget = secondaryTargets.get(j);
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
if(secondaryTarget != target && this.isValidTarget(secondaryTarget)){
|
||||
|
||||
if(!worldObj.isRemote){
|
||||
EntityArc arc = new EntityArc(worldObj);
|
||||
arc.setEndpointCoords(target.posX, target.posY + target.height/2, target.posZ,
|
||||
secondaryTarget.posX, secondaryTarget.posY + secondaryTarget.height/2, secondaryTarget.posZ);
|
||||
worldObj.spawnEntityInWorld(arc);
|
||||
}else{
|
||||
for(int k=0;k<8;k++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, secondaryTarget.posX + worldObj.rand.nextFloat() - 0.5, secondaryTarget.getEntityBoundingBox().minY + secondaryTarget.height/2 + worldObj.rand.nextFloat()*2 - 1, secondaryTarget.posZ + worldObj.rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, secondaryTarget.posX + worldObj.rand.nextFloat() - 0.5, secondaryTarget.getEntityBoundingBox().minY + secondaryTarget.height/2 + worldObj.rand.nextFloat()*2 - 1, secondaryTarget.posZ + worldObj.rand.nextFloat() - 0.5, 0, 0, 0);
|
||||
}
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
double velX = target.motionX;
|
||||
double velY = target.motionY;
|
||||
double velZ = target.motionZ;
|
||||
|
||||
// Only works if target is actually damaged to account for hurtResistantTime
|
||||
if(target.attackEntityFrom(
|
||||
getCaster() != null ? MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.SHOCK)
|
||||
: DamageSource.MAGIC,
|
||||
6)){
|
||||
|
||||
// Removes knockback
|
||||
target.motionX = velX;
|
||||
target.motionY = velY;
|
||||
target.motionZ = velZ;
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0f, 1.0f);
|
||||
|
||||
// Secondary chaining effect
|
||||
double seekerRange = 5.0d;
|
||||
|
||||
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange,
|
||||
target.posX, target.posY + target.height / 2, target.posZ, world);
|
||||
|
||||
for(int j = 0; j < Math.min(secondaryTargets.size(), 3); j++){
|
||||
|
||||
EntityLivingBase secondaryTarget = secondaryTargets.get(j);
|
||||
|
||||
if(secondaryTarget != target && this.isValidTarget(secondaryTarget)){
|
||||
|
||||
if(!world.isRemote){
|
||||
EntityArc arc = new EntityArc(world);
|
||||
arc.setEndpointCoords(target.posX, target.posY + target.height / 2, target.posZ,
|
||||
secondaryTarget.posX, secondaryTarget.posY + secondaryTarget.height / 2,
|
||||
secondaryTarget.posZ);
|
||||
world.spawnEntity(arc);
|
||||
}else{
|
||||
for(int k = 0; k < 8; k++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world,
|
||||
secondaryTarget.posX + world.rand.nextFloat() - 0.5,
|
||||
secondaryTarget.getEntityBoundingBox().minY + secondaryTarget.height / 2
|
||||
+ world.rand.nextFloat() * 2 - 1,
|
||||
secondaryTarget.posZ + world.rand.nextFloat() - 0.5, 0, 0, 0, 3);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE,
|
||||
secondaryTarget.posX + world.rand.nextFloat() - 0.5,
|
||||
secondaryTarget.getEntityBoundingBox().minY + secondaryTarget.height / 2
|
||||
+ world.rand.nextFloat() * 2 - 1,
|
||||
secondaryTarget.posZ + world.rand.nextFloat() - 0.5, 0, 0, 0);
|
||||
}
|
||||
|
||||
secondaryTarget.playSound(WizardrySounds.SPELL_SPARK, 1.0F, worldObj.rand.nextFloat() * 0.4F + 1.5F);
|
||||
|
||||
secondaryTarget.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.SHOCK), 4);
|
||||
}
|
||||
|
||||
|
||||
secondaryTarget.playSound(WizardrySounds.SPELL_SPARK, 1.0F,
|
||||
world.rand.nextFloat() * 0.4F + 1.5F);
|
||||
|
||||
secondaryTarget.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.SHOCK), 4);
|
||||
}
|
||||
// The trap is destroyed once triggered.
|
||||
this.setDead();
|
||||
|
||||
}
|
||||
// The trap is destroyed once triggered.
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
if(this.worldObj.isRemote && this.rand.nextInt(15) == 0){
|
||||
double radius = 0.5 + rand.nextDouble()*0.3;
|
||||
double angle = rand.nextDouble()*Math.PI*2;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX + radius*Math.cos(angle), this.posY + 0.1, this.posZ + radius*Math.sin(angle), 0, 0, 0, 3);
|
||||
}
|
||||
// }
|
||||
|
||||
if(this.world.isRemote && this.rand.nextInt(15) == 0){
|
||||
double radius = 0.5 + rand.nextDouble() * 0.3;
|
||||
double angle = rand.nextDouble() * Math.PI * 2;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + radius * Math.cos(angle),
|
||||
this.posY + 0.1, this.posZ + radius * Math.sin(angle), 0, 0, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
* Return whether this entity should be rendered as on fire.
|
||||
*/
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,40 +12,45 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
/**
|
||||
* This class is for all inanimate magical constructs which are not projectiles. It was made from scratch
|
||||
* to provide a unifying superclass for black hole, blizzard, tornado and a few others which all share some
|
||||
* characteristics. The EntityPlayer instance of the caster, the lifetime and the damage multiplier are stored
|
||||
* and synced here.
|
||||
* This class is for all inanimate magical constructs which are not projectiles. It was made from scratch to provide a
|
||||
* unifying superclass for black hole, blizzard, tornado and a few others which all share some characteristics. The
|
||||
* EntityPlayer instance of the caster, the lifetime and the damage multiplier are stored and synced here.
|
||||
* <p>
|
||||
* When extending this class, override both constructors. Generally speaking, subclasses of this class are areas
|
||||
* of effect which deal damage or apply effects over time.
|
||||
* When extending this class, override both constructors. Generally speaking, subclasses of this class are areas of
|
||||
* effect which deal damage or apply effects over time.
|
||||
*
|
||||
* @since Wizardry 1.0
|
||||
*/
|
||||
public abstract class EntityMagicConstruct extends Entity implements IEntityAdditionalSpawnData {
|
||||
|
||||
|
||||
/** The entity that created this construct */
|
||||
private WeakReference<EntityLivingBase> caster;
|
||||
|
||||
/** The UUID of the caster. Note that this is only for loading purposes; during normal updates
|
||||
* the actual entity instance is stored (so that getEntityByUUID is not called constantly),
|
||||
* so this will not always be synced (this is why it is private). */
|
||||
|
||||
/**
|
||||
* The UUID of the caster. Note that this is only for loading purposes; during normal updates the actual entity
|
||||
* instance is stored (so that getEntityByUUID is not called constantly), so this will not always be synced (this is
|
||||
* why it is private).
|
||||
*/
|
||||
private UUID casterUUID;
|
||||
|
||||
/** The time in ticks this magical construct lasts for; defaults to 600 (30 seconds). If this is -1 the construct
|
||||
* doesn't despawn. */
|
||||
|
||||
/**
|
||||
* The time in ticks this magical construct lasts for; defaults to 600 (30 seconds). If this is -1 the construct
|
||||
* doesn't despawn.
|
||||
*/
|
||||
public int lifetime = 600;
|
||||
|
||||
|
||||
/** The damage multiplier for this construct, determined by the wand with which it was cast. */
|
||||
public float damageMultiplier = 1.0f;
|
||||
|
||||
public EntityMagicConstruct(World par1World) {
|
||||
|
||||
public EntityMagicConstruct(World par1World){
|
||||
super(par1World);
|
||||
this.height = 1.0f;
|
||||
this.width = 1.0f;
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
public EntityMagicConstruct(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, float damageMultiplier) {
|
||||
|
||||
public EntityMagicConstruct(World world, double x, double y, double z, EntityLivingBase caster, int lifetime,
|
||||
float damageMultiplier){
|
||||
super(world);
|
||||
this.height = 1.0f;
|
||||
this.width = 1.0f;
|
||||
@@ -55,64 +60,64 @@ public abstract class EntityMagicConstruct extends Entity implements IEntityAddi
|
||||
this.lifetime = lifetime;
|
||||
this.damageMultiplier = damageMultiplier;
|
||||
}
|
||||
|
||||
|
||||
// Overrides the original to stop the entity moving when it intersects stuff. The default arrow does this to allow
|
||||
// it to stick in blocks.
|
||||
// it to stick in blocks.
|
||||
@Override
|
||||
public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean teleport)
|
||||
{
|
||||
this.setPosition(x, y, z);
|
||||
this.setRotation(yaw, pitch);
|
||||
}
|
||||
|
||||
public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch,
|
||||
int posRotationIncrements, boolean teleport){
|
||||
this.setPosition(x, y, z);
|
||||
this.setRotation(yaw, pitch);
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
|
||||
if(this.getCaster() == null && this.casterUUID != null){
|
||||
Entity entity = WizardryUtilities.getEntityByUUID(worldObj, casterUUID);
|
||||
Entity entity = WizardryUtilities.getEntityByUUID(world, casterUUID);
|
||||
if(entity instanceof EntityLivingBase){
|
||||
this.caster = new WeakReference<EntityLivingBase>((EntityLivingBase)entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.ticksExisted > lifetime && lifetime != -1){
|
||||
this.despawn();
|
||||
}
|
||||
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defaults to just setDead() in EntityMagicConstruct, but is provided to allow subclasses to override this
|
||||
* e.g. bubble uses it to dismount the entity inside it and play the 'pop' sound before calling super(). You
|
||||
* should always call super() when overriding this method, in case it changes. There is no need, therefore, to
|
||||
* call setDead() when overriding.
|
||||
* Defaults to just setDead() in EntityMagicConstruct, but is provided to allow subclasses to override this e.g.
|
||||
* bubble uses it to dismount the entity inside it and play the 'pop' sound before calling super(). You should
|
||||
* always call super() when overriding this method, in case it changes. There is no need, therefore, to call
|
||||
* setDead() when overriding.
|
||||
*/
|
||||
public void despawn(){
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
protected void entityInit(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
casterUUID = nbttagcompound.getUniqueId("casterUUID");
|
||||
lifetime = nbttagcompound.getInteger("lifetime");
|
||||
damageMultiplier = nbttagcompound.getFloat("damageMultiplier");
|
||||
lifetime = nbttagcompound.getInteger("lifetime");
|
||||
damageMultiplier = nbttagcompound.getFloat("damageMultiplier");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound){
|
||||
if(this.getCaster() != null){
|
||||
nbttagcompound.setUniqueId("casterUUID", this.getCaster().getUniqueID());
|
||||
}
|
||||
nbttagcompound.setUniqueId("casterUUID", this.getCaster().getUniqueID());
|
||||
}
|
||||
nbttagcompound.setInteger("lifetime", lifetime);
|
||||
nbttagcompound.setFloat("damageMultiplier", damageMultiplier);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf data){
|
||||
data.writeInt(lifetime);
|
||||
@@ -124,14 +129,14 @@ public abstract class EntityMagicConstruct extends Entity implements IEntityAddi
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the EntityLivingBase that created this construct, or null if it no longer exists. Cases where the
|
||||
* entity may no longer exist are: entity died or was deleted, mob despawned, player logged out, entity teleported
|
||||
* to another dimension, or this construct simply had no caster in the first place.
|
||||
* Returns the EntityLivingBase that created this construct, or null if it no longer exists. Cases where the entity
|
||||
* may no longer exist are: entity died or was deleted, mob despawned, player logged out, entity teleported to
|
||||
* another dimension, or this construct simply had no caster in the first place.
|
||||
*/
|
||||
public EntityLivingBase getCaster() {
|
||||
public EntityLivingBase getCaster(){
|
||||
return caster == null ? null : caster.get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shorthand for {@link WizardryUtilities#isValidTarget(Entity, Entity)}, with the owner of this construct as the
|
||||
* attacker. Also allows subclasses to override it if they wish to do so.
|
||||
@@ -139,15 +144,14 @@ public abstract class EntityMagicConstruct extends Entity implements IEntityAddi
|
||||
public boolean isValidTarget(Entity target){
|
||||
return WizardryUtilities.isValidTarget(this.getCaster(), target);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canRenderOnFire()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canRenderOnFire(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPushedByWater() {
|
||||
public boolean isPushedByWater(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.passive.EntityPig;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -26,14 +27,15 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
|
||||
private double velX, velZ;
|
||||
|
||||
public EntityTornado(World world) {
|
||||
public EntityTornado(World world){
|
||||
super(world);
|
||||
this.height = 8.0f;
|
||||
this.width = 5.0f;
|
||||
this.isImmuneToFire = false;
|
||||
}
|
||||
|
||||
public EntityTornado(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, double velX, double velZ, float damageMultiplier) {
|
||||
public EntityTornado(World world, double x, double y, double z, EntityLivingBase caster, int lifetime, double velX,
|
||||
double velZ, float damageMultiplier){
|
||||
super(world, x, y, z, caster, lifetime, damageMultiplier);
|
||||
this.height = 8.0f;
|
||||
this.width = 5.0f;
|
||||
@@ -46,25 +48,26 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(this.ticksExisted % 120 == 1 && worldObj.isRemote){
|
||||
if(this.ticksExisted % 120 == 1 && world.isRemote){
|
||||
// Repeat is false so that the sound fades out when the tornado does rather than stopping suddenly
|
||||
Wizardry.proxy.playMovingSound(this, WizardrySounds.SPELL_LOOP_WIND, 1.0f, 1.0f, false);
|
||||
}
|
||||
|
||||
this.moveEntity(velX, motionY, velZ);
|
||||
|
||||
|
||||
this.move(MoverType.SELF, velX, motionY, velZ);
|
||||
|
||||
BlockPos pos = new BlockPos(this);
|
||||
int y = WizardryUtilities.getNearestFloorLevelC(worldObj, pos.up(3), 5);
|
||||
int y = WizardryUtilities.getNearestFloorLevelC(world, pos.up(3), 5);
|
||||
pos = new BlockPos(pos.getX(), y, pos.getZ());
|
||||
|
||||
if(this.worldObj.getBlockState(pos).getMaterial() == Material.LAVA){
|
||||
|
||||
if(this.world.getBlockState(pos).getMaterial() == Material.LAVA){
|
||||
// Fire tornado!
|
||||
this.setFire(5);
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(4.0d, this.posX, this.posY, this.posZ, this.worldObj);
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(4.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -72,23 +75,27 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
if(this.isBurning()){
|
||||
target.setFire(4);
|
||||
}
|
||||
|
||||
|
||||
if(this.getCaster() != null){
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC), 1*damageMultiplier);
|
||||
target.attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
target.attackEntityFrom(DamageSource.magic, 1*damageMultiplier);
|
||||
target.attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
|
||||
}
|
||||
|
||||
target.motionX = dx;
|
||||
target.motionY = velY+0.2;
|
||||
target.motionY = velY + 0.2;
|
||||
target.motionZ = dz;
|
||||
|
||||
|
||||
// Player motion is handled on that player's client so needs packets
|
||||
if(target instanceof EntityPlayerMP){
|
||||
((EntityPlayerMP)target).connection.sendPacket(new SPacketEntityVelocity(target));
|
||||
@@ -101,81 +108,85 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(int i=1; i<10; i++){
|
||||
|
||||
double yPos = rand.nextDouble()*8;
|
||||
|
||||
for(int i = 1; i < 10; i++){
|
||||
|
||||
double yPos = rand.nextDouble() * 8;
|
||||
|
||||
int blockX = (int)this.posX - 2 + this.rand.nextInt(4);
|
||||
int blockZ = (int)this.posZ - 2 + this.rand.nextInt(4);
|
||||
|
||||
BlockPos pos1 = new BlockPos(blockX, this.posY+3, blockZ);
|
||||
|
||||
int blockY = WizardryUtilities.getNearestFloorLevelC(worldObj, pos1, 5) - 1;
|
||||
|
||||
|
||||
BlockPos pos1 = new BlockPos(blockX, this.posY + 3, blockZ);
|
||||
|
||||
int blockY = WizardryUtilities.getNearestFloorLevelC(world, pos1, 5) - 1;
|
||||
|
||||
pos1 = new BlockPos(pos1.getX(), blockY, pos1.getZ());
|
||||
|
||||
IBlockState block = this.worldObj.getBlockState(pos1);
|
||||
|
||||
// If the block it found was air or something it can't pick up, it makes a best guess based on the biome.
|
||||
|
||||
IBlockState block = this.world.getBlockState(pos1);
|
||||
|
||||
// If the block it found was air or something it can't pick up, it makes a best guess based on the
|
||||
// biome.
|
||||
if(!canTornadoPickUpBitsOf(block)){
|
||||
block = worldObj.getBiome(pos1).topBlock;
|
||||
block = world.getBiome(pos1).topBlock;
|
||||
}
|
||||
|
||||
Wizardry.proxy.spawnTornadoParticle(worldObj, this.posX, this.posY + yPos, this.posZ, this.velX, this.velZ, yPos/3 + 0.5d, 100, block, pos1);
|
||||
Wizardry.proxy.spawnTornadoParticle(worldObj, this.posX, this.posY + yPos, this.posZ, this.velX, this.velZ, yPos/3 + 0.5d, 100, block, pos1);
|
||||
|
||||
|
||||
Wizardry.proxy.spawnTornadoParticle(world, this.posX, this.posY + yPos, this.posZ, this.velX, this.velZ,
|
||||
yPos / 3 + 0.5d, 100, block, pos1);
|
||||
Wizardry.proxy.spawnTornadoParticle(world, this.posX, this.posY + yPos, this.posZ, this.velX, this.velZ,
|
||||
yPos / 3 + 0.5d, 100, block, pos1);
|
||||
|
||||
// Sometimes spawns leaf particles if the block is leaves
|
||||
if(block.getMaterial() == Material.LEAVES && this.rand.nextInt(3) == 0){
|
||||
double yPos1 = rand.nextDouble()*8;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.LEAF, worldObj, this.posX + (rand.nextDouble()*2-1)*(yPos1/3 + 0.5d), this.posY + yPos1, this.posZ + (rand.nextDouble()*2-1)*(yPos1/3 + 0.5d), 0, -0.05, 0, 40 + rand.nextInt(10));
|
||||
double yPos1 = rand.nextDouble() * 8;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.LEAF, world,
|
||||
this.posX + (rand.nextDouble() * 2 - 1) * (yPos1 / 3 + 0.5d), this.posY + yPos1,
|
||||
this.posZ + (rand.nextDouble() * 2 - 1) * (yPos1 / 3 + 0.5d), 0, -0.05, 0,
|
||||
40 + rand.nextInt(10));
|
||||
}
|
||||
|
||||
|
||||
// Sometimes spawns snow particles if the block is snow
|
||||
if(block.getMaterial() == Material.SNOW || block.getMaterial() == Material.CRAFTED_SNOW && this.rand.nextInt(3) == 0){
|
||||
double yPos1 = rand.nextDouble()*8;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SNOW, worldObj, this.posX + (rand.nextDouble()*2-1)*(yPos1/3 + 0.5d), this.posY + yPos1, this.posZ + (rand.nextDouble()*2-1)*(yPos1/3 + 0.5d), 0, -0.02, 0, 40 + rand.nextInt(10));
|
||||
if(block.getMaterial() == Material.SNOW
|
||||
|| block.getMaterial() == Material.CRAFTED_SNOW && this.rand.nextInt(3) == 0){
|
||||
double yPos1 = rand.nextDouble() * 8;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SNOW, world,
|
||||
this.posX + (rand.nextDouble() * 2 - 1) * (yPos1 / 3 + 0.5d), this.posY + yPos1,
|
||||
this.posZ + (rand.nextDouble() * 2 - 1) * (yPos1 / 3 + 0.5d), 0, -0.02, 0,
|
||||
40 + rand.nextInt(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean canTornadoPickUpBitsOf(IBlockState block){
|
||||
Material material = block.getMaterial();
|
||||
return material == Material.CRAFTED_SNOW
|
||||
|| material == Material.GROUND
|
||||
|| material == Material.GRASS
|
||||
|| material == Material.LAVA
|
||||
|| material == Material.SAND
|
||||
|| material == Material.SNOW
|
||||
|| material == Material.WATER
|
||||
|| material == Material.PLANTS
|
||||
|| material == Material.LEAVES
|
||||
return material == Material.CRAFTED_SNOW || material == Material.GROUND || material == Material.GRASS
|
||||
|| material == Material.LAVA || material == Material.SAND || material == Material.SNOW
|
||||
|| material == Material.WATER || material == Material.PLANTS || material == Material.LEAVES
|
||||
|| material == Material.VINE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
super.readEntityFromNBT(nbttagcompound);
|
||||
velX = nbttagcompound.getDouble("velX");
|
||||
velZ = nbttagcompound.getDouble("velZ");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound){
|
||||
super.writeEntityToNBT(nbttagcompound);
|
||||
nbttagcompound.setDouble("velX", velX);
|
||||
nbttagcompound.setDouble("velZ", velZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf data) {
|
||||
public void writeSpawnData(ByteBuf data){
|
||||
super.writeSpawnData(data);
|
||||
data.writeDouble(velX);
|
||||
data.writeDouble(velZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteBuf data) {
|
||||
public void readSpawnData(ByteBuf data){
|
||||
super.readSpawnData(data);
|
||||
this.velX = data.readDouble();
|
||||
this.velZ = data.readDouble();
|
||||
|
||||
Reference in New Issue
Block a user