First Checkup

This commit is contained in:
Corail31
2018-02-11 22:51:13 +01:00
parent 7f7605c089
commit d0fda72a59
86 changed files with 429 additions and 428 deletions
@@ -53,10 +53,10 @@ public class ArcaneJammer extends Spell {
}
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1, 0.0d, 0.0d, 0.0d,
12 + world.rand.nextInt(8), 0.9f, 0.3f, 0.7f);
}
@@ -33,9 +33,9 @@ public class ArrowRain extends Spell {
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){
if(!world.isRemote){
double x = rayTrace.hitVec.xCoord;
double y = rayTrace.hitVec.yCoord;
double z = rayTrace.hitVec.zCoord;
double x = rayTrace.hitVec.x;
double y = rayTrace.hitVec.y;
double z = rayTrace.hitVec.z;
// Moves the entity back towards the caster a bit, so the area of effect is better centred on the
// position.
// 3.0d is the distance to move the entity back towards the caster.
@@ -81,10 +81,10 @@ public class Banish extends Spell {
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
world.spawnParticle(EnumParticleTypes.PORTAL, x1, y1 - 0.5, z1, 0.0d, 0.0d, 0.0d);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d, 0,
@@ -52,9 +52,9 @@ public class BlackHole extends Spell {
}
}else{
int x = (int)(Math.floor(caster.posX) + caster.getLookVec().xCoord * 8);
int y = (int)(Math.floor(caster.posY) + caster.eyeHeight + caster.getLookVec().yCoord * 8);
int z = (int)(Math.floor(caster.posZ) + caster.getLookVec().zCoord * 8);
int x = (int)(Math.floor(caster.posX) + caster.getLookVec().x * 8);
int y = (int)(Math.floor(caster.posY) + caster.eyeHeight + caster.getLookVec().y * 8);
int z = (int)(Math.floor(caster.posZ) + caster.getLookVec().z * 8);
if(!world.isRemote){
world.spawnEntity(new EntityBlackHole(world, x, y, z, caster,
(int)(600 * modifiers.get(WizardryItems.duration_upgrade)),
@@ -35,9 +35,9 @@ public class Blizzard extends Spell {
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){
if(!world.isRemote){
double x = rayTrace.hitVec.xCoord;
double y = rayTrace.hitVec.yCoord;
double z = rayTrace.hitVec.zCoord;
double x = rayTrace.hitVec.x;
double y = rayTrace.hitVec.y;
double z = rayTrace.hitVec.z;
EntityBlizzard blizzard = new EntityBlizzard(world, x, y + 0.5, z, caster,
(int)(600 * modifiers.get(WizardryItems.duration_upgrade)),
modifiers.get(SpellModifiers.DAMAGE));
@@ -54,10 +54,10 @@ public class Bubble extends Spell {
}
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
world.spawnParticle(EnumParticleTypes.WATER_SPLASH, x1, y1, z1, 0.0d, 0.0d, 0.0d);
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_BUBBLE, world, x1, y1, z1, 0.0d, 0.0d, 0.0d, 0);
@@ -81,10 +81,10 @@ public class Clairvoyance extends Spell {
256 * modifiers.get(WizardryItems.range_upgrade));
if(path != null && path.getFinalPathPoint() != null){
int x = path.getFinalPathPoint().xCoord;
int y = path.getFinalPathPoint().xCoord;
int z = path.getFinalPathPoint().xCoord;
// TODO Corail : is it normal to have x in each ???
int x = path.getFinalPathPoint().x;
int y = path.getFinalPathPoint().y;
int z = path.getFinalPathPoint().z;
if(x == destination.getX() && y == destination.getY() && z == destination.getZ()){
@@ -129,10 +129,10 @@ public class Clairvoyance extends Spell {
nextPoint = path.getCurrentPathLength() - path.getCurrentPathIndex() <= 2 ? path.getFinalPathPoint()
: path.getPathPointFromIndex(path.getCurrentPathIndex() + 2);
Wizardry.proxy.spawnParticle(WizardryParticleType.PATH, world, point.xCoord + 0.5, point.yCoord + 0.5,
point.zCoord + 0.5, (nextPoint.xCoord - point.xCoord) / (float)PARTICLE_MOVEMENT_INTERVAL,
(nextPoint.yCoord - point.yCoord) / (float)PARTICLE_MOVEMENT_INTERVAL,
(nextPoint.zCoord - point.zCoord) / (float)PARTICLE_MOVEMENT_INTERVAL,
Wizardry.proxy.spawnParticle(WizardryParticleType.PATH, world, point.x + 0.5, point.y + 0.5,
point.z + 0.5, (nextPoint.x - point.x) / (float)PARTICLE_MOVEMENT_INTERVAL,
(nextPoint.y - point.y) / (float)PARTICLE_MOVEMENT_INTERVAL,
(nextPoint.z - point.z) / (float)PARTICLE_MOVEMENT_INTERVAL,
(int)(1800 * durationMultiplier), 0, 1, 0.3f);
path.incrementPathIndex();
@@ -141,8 +141,8 @@ public class Clairvoyance extends Spell {
point = path.getFinalPathPoint();
Wizardry.proxy.spawnParticle(WizardryParticleType.PATH, world, point.xCoord + 0.5, point.yCoord + 0.5,
point.zCoord + 0.5, 0, 0, 0, (int)(1800 * durationMultiplier), 1, 1, 1);
Wizardry.proxy.spawnParticle(WizardryParticleType.PATH, world, point.x + 0.5, point.y + 0.5,
point.z + 0.5, 0, 0, 0, (int)(1800 * durationMultiplier), 1, 1, 1);
}
@SubscribeEvent
@@ -153,7 +153,7 @@ public class Clairvoyance extends Spell {
// The event now has an ItemStack, which greatly simplifies hand-related stuff.
ItemStack wand = event.getItemStack();
if(wand != null && wand.getItem() instanceof ItemWand
if(!wand.isEmpty() && wand.getItem() instanceof ItemWand
&& WandHelper.getCurrentSpell(wand) instanceof Clairvoyance){
WizardData properties = WizardData.get(event.getEntityPlayer());
@@ -49,7 +49,7 @@ public class ConjureBow extends Spell {
// TODO: When spells get superclassed, this method needs to be in the conjuration superclass.
/** Adds the given item to the given player's inventory, placing it in the main hand if the main hand is empty. */
public static boolean conjureItemInInventory(EntityPlayer caster, ItemStack item){
if(caster.getHeldItemMainhand() == null){
if(caster.getHeldItemMainhand().isEmpty()){
caster.setHeldItem(EnumHand.MAIN_HAND, item);
return true;
}else{
@@ -47,10 +47,10 @@ public class CurseOfSoulbinding extends Spell {
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
// I figured it out! when on client side, entityplayer.posY is at the eyes, not the feet!
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
// world.spawnParticle("mobSpell", x1, y1, z1, -1*look.xCoord, -1*look.yCoord, -1*look.zCoord);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d, 0,
0.4f, 0.0f, 0.0f);
@@ -29,7 +29,7 @@ public class Decoy extends Spell {
if(!world.isRemote){
EntityDecoy decoy = new EntityDecoy(world, caster.posX, caster.posY, caster.posZ, caster, 600);
decoy.setLocationAndAngles(caster.posX, caster.posY, caster.posZ, caster.rotationYaw, caster.rotationPitch);
decoy.addVelocity(-caster.getLookVec().zCoord * splitSpeed, 0, caster.getLookVec().xCoord * splitSpeed);
decoy.addVelocity(-caster.getLookVec().z * splitSpeed, 0, caster.getLookVec().x * splitSpeed);
// Ignores the show names setting, since this would allow a player to easily detect a decoy
decoy.setCustomNameTag(caster.getName());
world.spawnEntity(decoy);
@@ -44,7 +44,7 @@ public class Decoy extends Spell {
}
}
caster.addVelocity(caster.getLookVec().zCoord * splitSpeed, 0, -caster.getLookVec().xCoord * splitSpeed);
caster.addVelocity(caster.getLookVec().z * splitSpeed, 0, -caster.getLookVec().x * splitSpeed);
WizardryUtilities.playSoundAtPlayer(caster, WizardrySounds.SPELL_CONJURATION, 1.0F,
0.4F / (world.rand.nextFloat() * 0.4F + 0.8F));
@@ -61,7 +61,7 @@ public class Decoy extends Spell {
if(!world.isRemote){
EntityDecoy decoy = new EntityDecoy(world, caster.posX, caster.posY, caster.posZ, caster, 600);
decoy.setLocationAndAngles(caster.posX, caster.posY, caster.posZ, caster.rotationYaw, caster.rotationPitch);
decoy.addVelocity(-caster.getLookVec().zCoord * splitSpeed, 0, caster.getLookVec().xCoord * splitSpeed);
decoy.addVelocity(-caster.getLookVec().z * splitSpeed, 0, caster.getLookVec().x * splitSpeed);
world.spawnEntity(decoy);
// Tricks any mobs that are targeting the caster into targeting the decoy instead.
@@ -73,7 +73,7 @@ public class Decoy extends Spell {
}
}
}
caster.addVelocity(caster.getLookVec().zCoord * splitSpeed, 0, -caster.getLookVec().xCoord * splitSpeed);
caster.addVelocity(caster.getLookVec().z * splitSpeed, 0, -caster.getLookVec().x * splitSpeed);
caster.playSound(WizardrySounds.SPELL_CONJURATION, 1.0F, 0.4F / (world.rand.nextFloat() * 0.4F + 0.8F));
return true;
@@ -36,23 +36,23 @@ public class Detonate extends Spell {
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){
if(!world.isRemote){
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(
3.0d * modifiers.get(WizardryItems.blast_upgrade), (rayTrace.hitVec.xCoord + 0.5),
(rayTrace.hitVec.yCoord + 0.5), (rayTrace.hitVec.zCoord + 0.5), world);
3.0d * modifiers.get(WizardryItems.blast_upgrade), (rayTrace.hitVec.x + 0.5),
(rayTrace.hitVec.y + 0.5), (rayTrace.hitVec.z + 0.5), world);
for(int i = 0; i < targets.size(); i++){
targets.get(i).attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.BLAST),
// Damage decreases with distance but cannot be less than 0, naturally.
Math.max(12.0f - (float)((EntityLivingBase)targets.get(i)).getDistance(
(rayTrace.hitVec.xCoord + 0.5), (rayTrace.hitVec.yCoord + 0.5),
(rayTrace.hitVec.zCoord + 0.5)) * 4, 0) * modifiers.get(SpellModifiers.DAMAGE));
(rayTrace.hitVec.x + 0.5), (rayTrace.hitVec.y + 0.5),
(rayTrace.hitVec.z + 0.5)) * 4, 0) * modifiers.get(SpellModifiers.DAMAGE));
}
}
if(world.isRemote){
double dx = (rayTrace.hitVec.xCoord + 0.5) - caster.posX;
double dy = (rayTrace.hitVec.yCoord + 0.5) - WizardryUtilities.getPlayerEyesPos(caster);
double dz = (rayTrace.hitVec.zCoord + 0.5) - caster.posZ;
world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, (rayTrace.hitVec.xCoord + 0.5),
(rayTrace.hitVec.yCoord + 0.5), (rayTrace.hitVec.zCoord + 0.5), 0, 0, 0);
double dx = (rayTrace.hitVec.x + 0.5) - caster.posX;
double dy = (rayTrace.hitVec.y + 0.5) - WizardryUtilities.getPlayerEyesPos(caster);
double dz = (rayTrace.hitVec.z + 0.5) - caster.posZ;
world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, (rayTrace.hitVec.x + 0.5),
(rayTrace.hitVec.y + 0.5), (rayTrace.hitVec.z + 0.5), 0, 0, 0);
for(int i = 1; i < 5; i++){
world.spawnParticle(EnumParticleTypes.FLAME,
caster.posX + (i * (dx / 5)) + world.rand.nextFloat() / 5,
@@ -64,8 +64,8 @@ public class Detonate extends Spell {
caster.posZ + (i * (dz / 5)) + world.rand.nextFloat() / 5, 0, 0, 0);
}
}
world.playSound(caster, (rayTrace.hitVec.xCoord + 0.5), (rayTrace.hitVec.yCoord + 0.5),
(rayTrace.hitVec.zCoord + 0.5), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F,
world.playSound(caster, (rayTrace.hitVec.x + 0.5), (rayTrace.hitVec.y + 0.5),
(rayTrace.hitVec.z + 0.5), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F,
(1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
caster.swingArm(hand);
return true;
@@ -52,10 +52,10 @@ public class Entrapment extends Spell {
}
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
world.spawnParticle(EnumParticleTypes.PORTAL, x1, y1 - 0.5, z1, 0.0d, 0.0d, 0.0d);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d, 0,
@@ -34,9 +34,9 @@ public class FireSigil extends Spell {
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK && rayTrace.sideHit == EnumFacing.UP){
if(!world.isRemote){
double x = rayTrace.hitVec.xCoord;
double y = rayTrace.hitVec.yCoord;
double z = rayTrace.hitVec.zCoord;
double x = rayTrace.hitVec.x;
double y = rayTrace.hitVec.y;
double z = rayTrace.hitVec.z;
EntityFireSigil firesigil = new EntityFireSigil(world, x, y, z, caster,
modifiers.get(SpellModifiers.DAMAGE));
world.spawnEntity(firesigil);
@@ -34,10 +34,10 @@ public class Fireball extends Spell {
if(!world.isRemote){
EntitySmallFireball fireball = new EntitySmallFireball(world, caster, 1, 1, 1);
fireball.setPosition(caster.posX + look.xCoord, caster.posY + look.yCoord + 1.3, caster.posZ + look.zCoord);
fireball.accelerationX = look.xCoord * 0.1;
fireball.accelerationY = look.yCoord * 0.1;
fireball.accelerationZ = look.zCoord * 0.1;
fireball.setPosition(caster.posX + look.x, caster.posY + look.y + 1.3, caster.posZ + look.z);
fireball.accelerationX = look.x * 0.1;
fireball.accelerationY = look.y * 0.1;
fireball.accelerationZ = look.z * 0.1;
world.spawnEntity(fireball);
}
@@ -66,18 +66,18 @@ public class Firestorm extends Spell {
if(world.isRemote){
for(int i = 0; i < 40; i++){
// I figured it out! when on client side, entityplayer.posY is at the eyes, not the feet!
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() * 0.6f - 0.3f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() * 0.6f - 0.3f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() * 0.4f - 0.2f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() * 0.6f - 0.3f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() * 0.6f - 0.3f;
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, world, x1, y1, z1,
look.xCoord * modifiers.get(WizardryItems.range_upgrade),
look.yCoord * modifiers.get(WizardryItems.range_upgrade),
look.zCoord * modifiers.get(WizardryItems.range_upgrade), 0, 3 + world.rand.nextFloat(), 0, 0);
look.x * modifiers.get(WizardryItems.range_upgrade),
look.y * modifiers.get(WizardryItems.range_upgrade),
look.z * modifiers.get(WizardryItems.range_upgrade), 0, 3 + world.rand.nextFloat(), 0, 0);
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, world, x1, y1, z1,
look.xCoord * modifiers.get(WizardryItems.range_upgrade),
look.yCoord * modifiers.get(WizardryItems.range_upgrade),
look.zCoord * modifiers.get(WizardryItems.range_upgrade), 0, 3 + world.rand.nextFloat(), 0, 0);
look.x * modifiers.get(WizardryItems.range_upgrade),
look.y * modifiers.get(WizardryItems.range_upgrade),
look.z * modifiers.get(WizardryItems.range_upgrade), 0, 3 + world.rand.nextFloat(), 0, 0);
}
}
if(ticksInUse % 16 == 0){
@@ -54,18 +54,18 @@ public class FlameRay extends Spell {
if(world.isRemote){
for(int i = 0; i < 20; i++){
// I figured it out! when on client side, entityplayer.posY is at the eyes, not the feet!
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, world, x1, y1, z1,
look.xCoord * modifiers.get(WizardryItems.range_upgrade),
look.yCoord * modifiers.get(WizardryItems.range_upgrade),
look.zCoord * modifiers.get(WizardryItems.range_upgrade), 0);
look.x * modifiers.get(WizardryItems.range_upgrade),
look.y * modifiers.get(WizardryItems.range_upgrade),
look.z * modifiers.get(WizardryItems.range_upgrade), 0);
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, world, x1, y1, z1,
look.xCoord * modifiers.get(WizardryItems.range_upgrade),
look.yCoord * modifiers.get(WizardryItems.range_upgrade),
look.zCoord * modifiers.get(WizardryItems.range_upgrade), 0);
look.x * modifiers.get(WizardryItems.range_upgrade),
look.y * modifiers.get(WizardryItems.range_upgrade),
look.z * modifiers.get(WizardryItems.range_upgrade), 0);
}
}
if(ticksInUse % 16 == 0){
@@ -90,18 +90,18 @@ public class FlameRay extends Spell {
}
if(world.isRemote){
for(int i = 0; i < 20; i++){
double x1 = caster.posX + vec.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = caster.posY + caster.getEyeHeight() - 0.4f + vec.yCoord * i / 2 + world.rand.nextFloat() / 5
double x1 = caster.posX + vec.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = caster.posY + caster.getEyeHeight() - 0.4f + vec.y * i / 2 + world.rand.nextFloat() / 5
- 0.1f;
double z1 = caster.posZ + vec.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + vec.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, world, x1, y1, z1,
vec.xCoord * modifiers.get(WizardryItems.range_upgrade),
vec.yCoord * modifiers.get(WizardryItems.range_upgrade),
vec.zCoord * modifiers.get(WizardryItems.range_upgrade), 0);
vec.x * modifiers.get(WizardryItems.range_upgrade),
vec.y * modifiers.get(WizardryItems.range_upgrade),
vec.z * modifiers.get(WizardryItems.range_upgrade), 0);
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, world, x1, y1, z1,
vec.xCoord * modifiers.get(WizardryItems.range_upgrade),
vec.yCoord * modifiers.get(WizardryItems.range_upgrade),
vec.zCoord * modifiers.get(WizardryItems.range_upgrade), 0);
vec.x * modifiers.get(WizardryItems.range_upgrade),
vec.y * modifiers.get(WizardryItems.range_upgrade),
vec.z * modifiers.get(WizardryItems.range_upgrade), 0);
}
}
if(ticksInUse % 16 == 0){
@@ -25,14 +25,14 @@ public class Flight extends Spell {
if(!caster.isInWater() && !caster.isElytraFlying()){
// The division thingy checks if the look direction is the opposite way to the velocity. If this is the
// case then the velocity should be added regardless of the player's current speed.
if((Math.abs(caster.motionX) < 0.6 || caster.motionX / caster.getLookVec().xCoord < 0)
&& (Math.abs(caster.motionZ) < 0.6 || caster.motionZ / caster.getLookVec().zCoord < 0)){
caster.addVelocity(caster.getLookVec().xCoord / 20, 0, caster.getLookVec().zCoord / 20);
if((Math.abs(caster.motionX) < 0.6 || caster.motionX / caster.getLookVec().x < 0)
&& (Math.abs(caster.motionZ) < 0.6 || caster.motionZ / caster.getLookVec().z < 0)){
caster.addVelocity(caster.getLookVec().x / 20, 0, caster.getLookVec().z / 20);
}
// y velocity is handled separately to stop the player from falling from the sky when they reach maximum
// horizontal speed.
if(Math.abs(caster.motionY) < 0.6 || caster.motionY / caster.getLookVec().yCoord < 0){
caster.motionY += caster.getLookVec().yCoord / 20 + 0.075;
if(Math.abs(caster.motionY) < 0.6 || caster.motionY / caster.getLookVec().y < 0){
caster.motionY += caster.getLookVec().y / 20 + 0.075;
}
caster.fallDistance = 0.0f;
}
@@ -66,24 +66,24 @@ public class FrostRay extends Spell {
if(world.isRemote){
for(int i = 0; i < 20; i++){
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1,
look.xCoord * modifiers.get(WizardryItems.range_upgrade),
look.yCoord * modifiers.get(WizardryItems.range_upgrade),
look.zCoord * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 0.4f,
look.x * modifiers.get(WizardryItems.range_upgrade),
look.y * modifiers.get(WizardryItems.range_upgrade),
look.z * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 0.4f,
0.6f, 1.0f);
x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1,
look.xCoord * modifiers.get(WizardryItems.range_upgrade),
look.yCoord * modifiers.get(WizardryItems.range_upgrade),
look.zCoord * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 1.0f,
look.x * modifiers.get(WizardryItems.range_upgrade),
look.y * modifiers.get(WizardryItems.range_upgrade),
look.z * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 1.0f,
1.0f, 1.0f);
}
}
@@ -122,24 +122,24 @@ public class FrostRay extends Spell {
if(world.isRemote){
for(int i = 0; i < 20; i++){
double x1 = caster.posX + vec.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = caster.posY + caster.getEyeHeight() - 0.4f + vec.yCoord * i / 2
double x1 = caster.posX + vec.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = caster.posY + caster.getEyeHeight() - 0.4f + vec.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + vec.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + vec.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1,
vec.xCoord * modifiers.get(WizardryItems.range_upgrade),
vec.yCoord * modifiers.get(WizardryItems.range_upgrade),
vec.zCoord * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 0.4f,
vec.x * modifiers.get(WizardryItems.range_upgrade),
vec.y * modifiers.get(WizardryItems.range_upgrade),
vec.z * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 0.4f,
0.6f, 1.0f);
x1 = caster.posX + vec.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
y1 = caster.posY + caster.getEyeHeight() - 0.4f + vec.yCoord * i / 2 + world.rand.nextFloat() / 5
x1 = caster.posX + vec.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
y1 = caster.posY + caster.getEyeHeight() - 0.4f + vec.y * i / 2 + world.rand.nextFloat() / 5
- 0.1f;
z1 = caster.posZ + vec.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
z1 = caster.posZ + vec.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1,
vec.xCoord * modifiers.get(WizardryItems.range_upgrade),
vec.yCoord * modifiers.get(WizardryItems.range_upgrade),
vec.zCoord * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 1.0f,
vec.x * modifiers.get(WizardryItems.range_upgrade),
vec.y * modifiers.get(WizardryItems.range_upgrade),
vec.z * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 1.0f,
1.0f, 1.0f);
}
}
@@ -34,9 +34,9 @@ public class FrostSigil extends Spell {
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK && rayTrace.sideHit == EnumFacing.UP){
if(!world.isRemote){
double x = rayTrace.hitVec.xCoord;
double y = rayTrace.hitVec.yCoord;
double z = rayTrace.hitVec.zCoord;
double x = rayTrace.hitVec.x;
double y = rayTrace.hitVec.y;
double z = rayTrace.hitVec.z;
EntityFrostSigil frostsigil = new EntityFrostSigil(world, x, y, z, caster,
modifiers.get(SpellModifiers.DAMAGE));
world.spawnEntity(frostsigil);
@@ -25,7 +25,7 @@ public class Glide extends Spell {
if(caster.motionY < -0.1 && !caster.isInWater()){
caster.motionY = -0.1;
if(Math.abs(caster.motionX) < 0.4 && Math.abs(caster.motionZ) < 0.4){
caster.addVelocity(caster.getLookVec().xCoord / 8, 0, caster.getLookVec().zCoord / 8);
caster.addVelocity(caster.getLookVec().x / 8, 0, caster.getLookVec().z / 8);
// entityplayer.moveEntity(entityplayer.motionX*10, 0, entityplayer.motionZ*10);
}
caster.fallDistance = 0.0f;
@@ -33,10 +33,10 @@ public class GreaterFireball extends Spell {
if(!world.isRemote){
EntityLargeFireball fireball = new EntityLargeFireball(world, caster, 1, 1, 1);
fireball.setPosition(caster.posX + look.xCoord, caster.posY + look.yCoord + 1.3, caster.posZ + look.zCoord);
fireball.accelerationX = look.xCoord * 0.1;
fireball.accelerationY = look.yCoord * 0.1;
fireball.accelerationZ = look.zCoord * 0.1;
fireball.setPosition(caster.posX + look.x, caster.posY + look.y + 1.3, caster.posZ + look.z);
fireball.accelerationX = look.x * 0.1;
fireball.accelerationY = look.y * 0.1;
fireball.accelerationZ = look.z * 0.1;
world.spawnEntity(fireball);
}
@@ -33,9 +33,9 @@ public class Hailstorm extends Spell {
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){
if(!world.isRemote){
double x = rayTrace.hitVec.xCoord;
double y = rayTrace.hitVec.yCoord;
double z = rayTrace.hitVec.zCoord;
double x = rayTrace.hitVec.x;
double y = rayTrace.hitVec.y;
double z = rayTrace.hitVec.z;
// Moves the entity back towards the caster a bit, so the area of effect is better centred on the
// position.
// 3.0d is the distance to move the entity back towards the caster.
@@ -40,9 +40,9 @@ public class IceSpikes extends Spell {
if(!world.isRemote){
double x = rayTrace.hitVec.xCoord;
double y = rayTrace.hitVec.yCoord;
double z = rayTrace.hitVec.zCoord;
double x = rayTrace.hitVec.x;
double y = rayTrace.hitVec.y;
double z = rayTrace.hitVec.z;
for(int i = 0; i < (int)(18 * modifiers.get(WizardryItems.blast_upgrade)); i++){
@@ -110,10 +110,10 @@ public class IceStatue extends Spell {
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
float brightness = 0.5f + (world.rand.nextFloat() / 2);
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1, 0.0d, 0.0d, 0.0d,
12 + world.rand.nextInt(8), brightness, brightness + 0.1f, 1.0f);
@@ -100,12 +100,12 @@ public class Intimidate extends Spell {
if(!target.getNavigator().noPath()){
PathPoint point = target.getNavigator().getPath().getFinalPathPoint();
if(point != null) flag = caster.getDistance(point.xCoord, point.yCoord, point.zCoord) < 16;
if(point != null) flag = caster.getDistance(point.x, point.y, point.z) < 16;
}
// Has a built in mind trick effect because for whatever reason this makes it work with skeletons.
target.setAttackTarget(null);
if(flag) return target.getNavigator().tryMoveToXYZ(Vec3d.xCoord, Vec3d.yCoord, Vec3d.zCoord, 1.25);// target.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
if(flag) return target.getNavigator().tryMoveToXYZ(Vec3d.x, Vec3d.y, Vec3d.z, 1.25);// target.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
}
}
@@ -24,7 +24,7 @@ public class Leap extends Spell {
if(caster.onGround){
caster.motionY = 0.65 * modifiers.get(SpellModifiers.DAMAGE);
caster.addVelocity(caster.getLookVec().xCoord * 0.3, 0, caster.getLookVec().zCoord * 0.3);
caster.addVelocity(caster.getLookVec().x * 0.3, 0, caster.getLookVec().z * 0.3);
if(world.isRemote){
for(int i = 0; i < 10; i++){
@@ -49,17 +49,17 @@ public class LifeDrain extends Spell {
if(world.isRemote){
for(int i = 5; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
// I figured it out! when on client side, entityplayer.posY is at the eyes, not the feet!
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
// world.spawnParticle("mobSpell", x1, y1, z1, -1*look.xCoord, -1*look.yCoord, -1*look.zCoord);
if(i % 5 == 0){
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d,
0, 0.1f, 0.0f, 0.0f);
}
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1, -0.05 * look.xCoord * i,
-0.05 * look.yCoord * i, -0.05 * look.zCoord * i, 8 + world.rand.nextInt(6), 0.5f, 0.0f, 0.0f);
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1, -0.05 * look.x * i,
-0.05 * look.y * i, -0.05 * look.z * i, 8 + world.rand.nextInt(6), 0.5f, 0.0f, 0.0f);
}
}
if(ticksInUse % 18 == 0){
@@ -87,17 +87,17 @@ public class LifeDrain extends Spell {
if(world.isRemote){
for(int i = 5; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
// I figured it out! when on client side, entityplayer.posY is at the eyes, not the feet!
double x1 = caster.posX + vec.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = caster.posY + caster.getEyeHeight() - 0.4f + vec.yCoord * i / 2 + world.rand.nextFloat() / 5
double x1 = caster.posX + vec.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = caster.posY + caster.getEyeHeight() - 0.4f + vec.y * i / 2 + world.rand.nextFloat() / 5
- 0.1f;
double z1 = caster.posZ + vec.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + vec.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
// world.spawnParticle("mobSpell", x1, y1, z1, -1*look.xCoord, -1*look.yCoord, -1*look.zCoord);
if(i % 5 == 0){
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d,
0, 0.1f, 0.0f, 0.0f);
}
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1, -0.05 * vec.xCoord * i,
-0.05 * vec.yCoord * i, -0.05 * vec.zCoord * i, 8 + world.rand.nextInt(6), 0.5f, 0.0f, 0.0f);
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1, -0.05 * vec.x * i,
-0.05 * vec.y * i, -0.05 * vec.z * i, 8 + world.rand.nextInt(6), 0.5f, 0.0f, 0.0f);
}
}
if(ticksInUse % 18 == 0){
@@ -52,9 +52,9 @@ public class Light extends Spell {
}
}else{
int x = (int)(Math.floor(caster.posX) + caster.getLookVec().xCoord * 4);
int y = (int)(Math.floor(caster.posY) + caster.eyeHeight + caster.getLookVec().yCoord * 4);
int z = (int)(Math.floor(caster.posZ) + caster.getLookVec().zCoord * 4);
int x = (int)(Math.floor(caster.posX) + caster.getLookVec().x * 4);
int y = (int)(Math.floor(caster.posY) + caster.eyeHeight + caster.getLookVec().y * 4);
int z = (int)(Math.floor(caster.posZ) + caster.getLookVec().z * 4);
BlockPos pos = new BlockPos(x, y, z);
@@ -87,9 +87,9 @@ public class LightningRay extends Spell {
EntityArc arc = new EntityArc(world);
arc.setEndpointCoords(caster.posX, caster.posY + 1.2, caster.posZ,
caster.posX + caster.getLookVec().xCoord * 8,
caster.posY + caster.eyeHeight + caster.getLookVec().yCoord * 8,
caster.posZ + caster.getLookVec().zCoord * 8);
caster.posX + caster.getLookVec().x * 8,
caster.posY + caster.eyeHeight + caster.getLookVec().y * 8,
caster.posZ + caster.getLookVec().z * 8);
arc.lifetime = 1;
@@ -35,9 +35,9 @@ public class LightningSigil extends Spell {
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK && rayTrace.sideHit == EnumFacing.UP){
if(!world.isRemote){
double x = rayTrace.hitVec.xCoord;
double y = rayTrace.hitVec.yCoord;
double z = rayTrace.hitVec.zCoord;
double x = rayTrace.hitVec.x;
double y = rayTrace.hitVec.y;
double z = rayTrace.hitVec.z;
EntityLightningSigil lightningsigil = new EntityLightningSigil(world, x, y, z, caster,
modifiers.get(SpellModifiers.DAMAGE));
world.spawnEntity(lightningsigil);
@@ -200,9 +200,9 @@ public class LightningWeb extends Spell {
if(ticksInUse % 2 == 0){
EntityArc arc = new EntityArc(world);
arc.setEndpointCoords(caster.posX, caster.posY + 1.2, caster.posZ,
caster.posX + caster.getLookVec().xCoord * 8,
caster.posY + caster.eyeHeight + caster.getLookVec().yCoord * 8,
caster.posZ + caster.getLookVec().zCoord * 8);
caster.posX + caster.getLookVec().x * 8,
caster.posY + caster.eyeHeight + caster.getLookVec().y * 8,
caster.posZ + caster.getLookVec().z * 8);
arc.lifetime = 1;
// arc.setOffset(entityplayer.getLookVec().zCoord * 0.5, entityplayer.getLookVec().xCoord * 0.5);
world.spawnEntity(arc);
@@ -97,10 +97,10 @@ public class Metamorphosis extends Spell {
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
// I figured it out! when on client side, entityplayer.posY is at the eyes, not the feet!
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
// world.spawnParticle("mobSpell", x1, y1, z1, -1*look.xCoord, -1*look.yCoord, -1*look.zCoord);
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1, 0.0d, 0.0d, 0.0d,
12 + world.rand.nextInt(8), 0.2f, 0.0f, 0.1f);
@@ -113,7 +113,7 @@ public class MindTrick extends Spell {
@SubscribeEvent
public static void onLivingAttackEvent(LivingAttackEvent event){
if(event.getSource() != null && event.getSource().getEntity() instanceof EntityLivingBase){
if(event.getSource() != null && event.getSource().getTrueSource() instanceof EntityLivingBase){
// Cancels the mind trick effect if the creature takes damage
// This has been moved to within an (event.getSource().getEntity() instanceof EntityLivingBase) check so it
// doesn't
@@ -107,10 +107,10 @@ public class Petrify extends Spell {
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
// I figured it out! when on client side, entityplayer.posY is at the eyes, not the feet!
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
// world.spawnParticle("mobSpell", x1, y1, z1, -1*look.xCoord, -1*look.yCoord, -1*look.zCoord);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d, 0,
0.1f, 0.1f, 0.1f);
@@ -55,10 +55,10 @@ public class Poison extends Spell {
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
// I figured it out! when on client side, entityplayer.posY is at the eyes, not the feet!
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
// world.spawnParticle("mobSpell", x1, y1, z1, -1*look.xCoord, -1*look.yCoord, -1*look.zCoord);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d, 0,
0.3f, 0.7f, 0.0f);
@@ -49,11 +49,11 @@ public class ShadowWard extends Spell {
@SubscribeEvent
public static void onLivingAttackEvent(LivingAttackEvent event){
if(event.getSource() != null && event.getSource().getEntity() instanceof EntityLivingBase){
if(event.getSource() != null && event.getSource().getTrueSource() instanceof EntityLivingBase){
// There used to be a check that the target was a player here, but I don't see any reason for it.
ItemStack wand = event.getEntityLiving().getActiveItemStack();
if(wand != null && wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand
if(!wand.isEmpty() && wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand
&& WandHelper.getCurrentSpell(wand) instanceof ShadowWard && !event.getSource().isUnblockable()
&& !(event.getSource() instanceof IElementalDamage
&& ((IElementalDamage)event.getSource()).isRetaliatory())){
@@ -61,9 +61,9 @@ public class ShadowWard extends Spell {
event.setCanceled(true);
// Now we can preserve the original daage source (sort of) as long as we make it retaliatory.
event.getEntityLiving().attackEntityFrom(
MagicDamage.causeDirectMagicDamage(event.getSource().getEntity(), DamageType.MAGIC, true),
MagicDamage.causeDirectMagicDamage(event.getSource().getTrueSource(), DamageType.MAGIC, true),
event.getAmount() / 2);
((EntityLivingBase)event.getSource().getEntity()).attackEntityFrom(
((EntityLivingBase)event.getSource().getTrueSource()).attackEntityFrom(
MagicDamage.causeDirectMagicDamage(event.getEntityLiving(), DamageType.MAGIC, true),
event.getAmount() / 2);
}
@@ -60,10 +60,10 @@ public class Slime extends Spell {
if(world.isRemote){
for(int i = 1; i < (int)(25 * modifiers.get(WizardryItems.range_upgrade)); i += 2){
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
world.spawnParticle(EnumParticleTypes.SLIME, x1, y1, z1, 0.0d, 0.0d, 0.0d);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d, 0,
@@ -15,6 +15,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
@@ -53,7 +54,7 @@ public class Telekinesis extends Spell {
EntityPlayer target = (EntityPlayer)rayTrace.entityHit;
if(target.getHeldItemMainhand() != null){
if(!target.getHeldItemMainhand().isEmpty()){
if(!world.isRemote){
EntityItem item = target.entityDropItem(target.getHeldItemMainhand(), 0.0f);
@@ -62,7 +63,7 @@ public class Telekinesis extends Spell {
item.motionZ = (caster.posZ - target.posZ) / 20;
}
target.setHeldItem(EnumHand.MAIN_HAND, null);
target.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
target.playSound(WizardrySounds.SPELL_CONJURATION, 1.0F, 1.0f);
caster.swingArm(hand);
@@ -88,7 +89,7 @@ public class Telekinesis extends Spell {
public boolean cast(World world, EntityLiving caster, EnumHand hand, int ticksInUse, EntityLivingBase target,
SpellModifiers modifiers){
if(target instanceof EntityPlayer && target.getHeldItemMainhand() != null){
if(target instanceof EntityPlayer && !target.getHeldItemMainhand().isEmpty()){
// IDEA: Disarm the offhand if the mainhand is empty or otherwise harmless?
@@ -99,7 +100,7 @@ public class Telekinesis extends Spell {
item.motionZ = (caster.posZ - target.posZ) / 20;
}
target.setHeldItem(EnumHand.MAIN_HAND, null);
target.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
target.playSound(WizardrySounds.SPELL_CONJURATION, 1.0F, 1.0f);
caster.swingArm(hand);
@@ -30,13 +30,13 @@ public class Tornado extends Spell {
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
if(!world.isRemote){
double x = caster.posX + caster.getLookVec().xCoord;
double x = caster.posX + caster.getLookVec().x;
double y = caster.posY;
double z = caster.posZ + caster.getLookVec().zCoord;
double z = caster.posZ + caster.getLookVec().z;
EntityTornado tornado = new EntityTornado(world, x, y, z, caster,
(int)(200 * modifiers.get(WizardryItems.duration_upgrade)), caster.getLookVec().xCoord / 3,
caster.getLookVec().zCoord / 3, modifiers.get(SpellModifiers.DAMAGE));
(int)(200 * modifiers.get(WizardryItems.duration_upgrade)), caster.getLookVec().x / 3,
caster.getLookVec().z / 3, modifiers.get(SpellModifiers.DAMAGE));
world.spawnEntity(tornado);
}
caster.swingArm(hand);
@@ -51,13 +51,13 @@ public class Tornado extends Spell {
if(target != null){
if(!world.isRemote){
double x = caster.posX + caster.getLookVec().xCoord;
double x = caster.posX + caster.getLookVec().x;
double y = caster.posY;
double z = caster.posZ + caster.getLookVec().zCoord;
double z = caster.posZ + caster.getLookVec().z;
EntityTornado tornado = new EntityTornado(world, x, y, z, caster,
(int)(200 * modifiers.get(WizardryItems.duration_upgrade)), caster.getLookVec().xCoord / 3,
caster.getLookVec().zCoord / 3, modifiers.get(SpellModifiers.DAMAGE));
(int)(200 * modifiers.get(WizardryItems.duration_upgrade)), caster.getLookVec().x / 3,
caster.getLookVec().z / 3, modifiers.get(SpellModifiers.DAMAGE));
world.spawnEntity(tornado);
}
caster.swingArm(hand);
@@ -57,8 +57,8 @@ public class Transience extends Spell {
event.setCanceled(true);
}
// Prevents transient entities from causing any damage
if(event.getSource().getEntity() instanceof EntityLivingBase
&& ((EntityLivingBase)event.getSource().getEntity()).isPotionActive(WizardryPotions.transience)){
if(event.getSource().getTrueSource() instanceof EntityLivingBase
&& ((EntityLivingBase)event.getSource().getTrueSource()).isPotionActive(WizardryPotions.transience)){
event.setCanceled(true);
}
}
@@ -70,24 +70,24 @@ public class WallOfFrost extends Spell {
if(world.isRemote){
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1,
look.xCoord * modifiers.get(WizardryItems.range_upgrade),
look.yCoord * modifiers.get(WizardryItems.range_upgrade),
look.zCoord * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 0.4f,
look.x * modifiers.get(WizardryItems.range_upgrade),
look.y * modifiers.get(WizardryItems.range_upgrade),
look.z * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 0.4f,
0.6f, 1.0f);
x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x1, y1, z1,
look.xCoord * modifiers.get(WizardryItems.range_upgrade),
look.yCoord * modifiers.get(WizardryItems.range_upgrade),
look.zCoord * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 1.0f,
look.x * modifiers.get(WizardryItems.range_upgrade),
look.y * modifiers.get(WizardryItems.range_upgrade),
look.z * modifiers.get(WizardryItems.range_upgrade), 8 + world.rand.nextInt(12), 1.0f,
1.0f, 1.0f);
}
}
@@ -35,9 +35,9 @@ public class Whirlwind extends Spell {
if(!world.isRemote){
target.motionX = caster.getLookVec().xCoord * 2;
target.motionY = caster.getLookVec().yCoord * 2 + 1;
target.motionZ = caster.getLookVec().zCoord * 2;
target.motionX = caster.getLookVec().x * 2;
target.motionY = caster.getLookVec().y * 2 + 1;
target.motionZ = caster.getLookVec().z * 2;
// Player motion is handled on that player's client so needs packets
if(target instanceof EntityPlayerMP){
@@ -48,13 +48,13 @@ public class Whirlwind extends Spell {
if(world.isRemote){
for(int i = 0; i < 10; i++){
double x2 = (double)(caster.posX + world.rand.nextFloat() - 0.5F
+ caster.getLookVec().xCoord * caster.getDistanceToEntity(target) * 0.5);
+ caster.getLookVec().x * caster.getDistanceToEntity(target) * 0.5);
double y2 = (double)(WizardryUtilities.getPlayerEyesPos(caster) + world.rand.nextFloat() - 0.5F
+ caster.getLookVec().yCoord * caster.getDistanceToEntity(target) * 0.5);
+ caster.getLookVec().y * caster.getDistanceToEntity(target) * 0.5);
double z2 = (double)(caster.posZ + world.rand.nextFloat() - 0.5F
+ caster.getLookVec().zCoord * caster.getDistanceToEntity(target) * 0.5);
world.spawnParticle(EnumParticleTypes.CLOUD, x2, y2, z2, caster.getLookVec().xCoord,
caster.getLookVec().yCoord, caster.getLookVec().zCoord);
+ caster.getLookVec().z * caster.getDistanceToEntity(target) * 0.5);
world.spawnParticle(EnumParticleTypes.CLOUD, x2, y2, z2, caster.getLookVec().x,
caster.getLookVec().y, caster.getLookVec().z);
// Minecraft.getMinecraft().effectRenderer.addEffect(new EntitySparkleFX(world, x2, y2, z2,
// entityplayer.getLookVec().xCoord, entityplayer.getLookVec().yCoord,
// entityplayer.getLookVec().zCoord, null, 1.0f, 1.0f, 0.8f, 10));
@@ -75,9 +75,9 @@ public class Whirlwind extends Spell {
if(target != null){
if(!world.isRemote){
target.motionX = caster.getLookVec().xCoord * 2;
target.motionY = caster.getLookVec().yCoord * 2 + 1;
target.motionZ = caster.getLookVec().zCoord * 2;
target.motionX = caster.getLookVec().x * 2;
target.motionY = caster.getLookVec().y * 2 + 1;
target.motionZ = caster.getLookVec().z * 2;
// Player motion is handled on that player's client so needs packets
if(target instanceof EntityPlayerMP){
@@ -87,13 +87,13 @@ public class Whirlwind extends Spell {
if(world.isRemote){
for(int i = 0; i < 10; i++){
double x2 = (double)(caster.posX + world.rand.nextFloat() - 0.5F
+ caster.getLookVec().xCoord * caster.getDistanceToEntity(target) * 0.5);
+ caster.getLookVec().x * caster.getDistanceToEntity(target) * 0.5);
double y2 = (double)(caster.posY + caster.getEyeHeight() + world.rand.nextFloat() - 0.5F
+ caster.getLookVec().yCoord * caster.getDistanceToEntity(target) * 0.5);
+ caster.getLookVec().y * caster.getDistanceToEntity(target) * 0.5);
double z2 = (double)(caster.posZ + world.rand.nextFloat() - 0.5F
+ caster.getLookVec().zCoord * caster.getDistanceToEntity(target) * 0.5);
world.spawnParticle(EnumParticleTypes.CLOUD, x2, y2, z2, caster.getLookVec().xCoord,
caster.getLookVec().yCoord, caster.getLookVec().zCoord);
+ caster.getLookVec().z * caster.getDistanceToEntity(target) * 0.5);
world.spawnParticle(EnumParticleTypes.CLOUD, x2, y2, z2, caster.getLookVec().x,
caster.getLookVec().y, caster.getLookVec().z);
}
}
caster.swingArm(hand);
@@ -61,10 +61,10 @@ public class Wither extends Spell {
* + world.rand.nextFloat()/5 - 0.1f; double y1 = origin.yCoord + look.yCoord*i/2 +
* world.rand.nextFloat()/5 - 0.1f; double z1 = origin.zCoord + look.zCoord*i/2 +
* world.rand.nextFloat()/5 - 0.1f; */
double x1 = caster.posX + look.xCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.yCoord * i / 2
double x1 = caster.posX + look.x * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double y1 = WizardryUtilities.getPlayerEyesPos(caster) - 0.4f + look.y * i / 2
+ world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.zCoord * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
double z1 = caster.posZ + look.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
// world.spawnParticle("mobSpell", x1, y1, z1, -1*look.xCoord, -1*look.yCoord, -1*look.zCoord);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d, 0,
0.1f, 0.0f, 0.0f);
@@ -33,11 +33,11 @@ public class WitherSkull extends Spell {
if(!world.isRemote){
EntityWitherSkull witherskull = new EntityWitherSkull(world, caster, 1, 1, 1);
witherskull.setPosition(caster.posX + look.xCoord, caster.posY + look.yCoord + 1.3,
caster.posZ + look.zCoord);
witherskull.accelerationX = look.xCoord * 0.1;
witherskull.accelerationY = look.yCoord * 0.1;
witherskull.accelerationZ = look.zCoord * 0.1;
witherskull.setPosition(caster.posX + look.x, caster.posY + look.y + 1.3,
caster.posZ + look.z);
witherskull.accelerationX = look.x * 0.1;
witherskull.accelerationY = look.y * 0.1;
witherskull.accelerationZ = look.z * 0.1;
world.spawnEntity(witherskull);
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.ENTITY_WITHER_SHOOT, 1.0F,
world.rand.nextFloat() * 0.2F + 1.0F);