Merge branch '1.12.2' into 1.12.2-dev

This commit is contained in:
Electroblob
2018-06-05 21:44:17 +01:00
52 changed files with 1079 additions and 805 deletions
@@ -79,36 +79,41 @@ public class FlameRay extends Spell {
public boolean cast(World world, EntityLiving caster, EnumHand hand, int ticksInUse, EntityLivingBase target,
SpellModifiers modifiers){
Vec3d vec = new Vec3d(target.posX - caster.posX, target.posY - caster.posY, target.posZ - caster.posZ)
.normalize();
if(target != null){
Vec3d vec = new Vec3d(target.posX - caster.posX, target.posY - caster.posY, target.posZ - caster.posZ).normalize();
target.setFire(10);
WizardryUtilities.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.FIRE),
3.0f * modifiers.get(SpellModifiers.DAMAGE));
}
if(world.isRemote){
for(int i = 0; i < 20; i++){
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.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(Type.MAGIC_FIRE, world, x1, y1, z1,
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(Type.MAGIC_FIRE, world, x1, y1, z1,
vec.x * modifiers.get(WizardryItems.range_upgrade),
vec.y * modifiers.get(WizardryItems.range_upgrade),
vec.z * modifiers.get(WizardryItems.range_upgrade), 0);
if(world.isRemote){
for(int i = 0; i < 20; i++){
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.z * i / 2 + world.rand.nextFloat() / 5 - 0.1f;
Wizardry.proxy.spawnParticle(Type.MAGIC_FIRE, world, x1, y1, z1,
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(Type.MAGIC_FIRE, world, x1, y1, z1,
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){
if(ticksInUse == 0) caster.playSound(SoundEvents.ENTITY_BLAZE_SHOOT, 1, 1);
caster.playSound(WizardrySounds.SPELL_LOOP_FIRE, 0.5F, 1.0f);
}
return true;
}
if(ticksInUse % 16 == 0){
if(ticksInUse == 0) caster.playSound(SoundEvents.ENTITY_BLAZE_SHOOT, 1, 1);
caster.playSound(WizardrySounds.SPELL_LOOP_FIRE, 0.5F, 1.0f);
}
return true;
return false;
}
@Override
@@ -72,39 +72,43 @@ public class LifeDrain extends Spell {
public boolean cast(World world, EntityLiving caster, EnumHand hand, int ticksInUse, EntityLivingBase target,
SpellModifiers modifiers){
Vec3d vec = new Vec3d(target.posX - caster.posX, target.posY - caster.posY, target.posZ - caster.posZ)
.normalize();
if(target != null){
Vec3d vec = new Vec3d(target.posX - caster.posX, target.posY - caster.posY, target.posZ - caster.posZ).normalize();
if(ticksInUse % 12 == 0){
WizardryUtilities.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.MAGIC),
2.0f * modifiers.get(SpellModifiers.DAMAGE));
caster.heal(1);
}
}
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.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.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(Type.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d,
0, 0.1f, 0.0f, 0.0f);
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.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.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(Type.DARK_MAGIC, world, x1, y1, z1, 0.0d, 0.0d, 0.0d,
0, 0.1f, 0.0f, 0.0f);
}
Wizardry.proxy.spawnParticle(Type.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);
}
Wizardry.proxy.spawnParticle(Type.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){
if(ticksInUse == 0) caster.playSound(WizardrySounds.SPELL_SUMMONING, 1.0F, 0.6f);
caster.playSound(WizardrySounds.SPELL_LOOP_CRACKLE, 2.0F, 1.0f);
}
if(ticksInUse % 18 == 0){
if(ticksInUse == 0) caster.playSound(WizardrySounds.SPELL_SUMMONING, 1.0F, 0.6f);
caster.playSound(WizardrySounds.SPELL_LOOP_CRACKLE, 2.0F, 1.0f);
}
return true;
return true;
}
return false;
}
@Override
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import java.util.Arrays;
import java.util.List;
import electroblob.wizardry.Wizardry;
@@ -14,6 +15,7 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.INpc;
@@ -143,7 +145,8 @@ public class MindControl extends Spell {
/** Returns true if the given entity can be mind controlled (i.e. is not a player, npc, evil wizard or boss). */
public static boolean canControl(EntityLivingBase target){
return target instanceof EntityLiving && target.isNonBoss() && !(target instanceof INpc)
&& !(target instanceof EntityEvilWizard);
&& !(target instanceof EntityEvilWizard) && !Arrays.asList(Wizardry.settings.mindControlTargetsBlacklist)
.contains(EntityList.getKey(target.getClass()));
}
/**
@@ -200,11 +203,11 @@ public class MindControl extends Spell {
Entity caster = WizardryUtilities.getEntityByUUID(world, entityNBT.getUniqueId(MindControl.NBT_KEY));
// If the current target is already a valid mind control target, nothing happens.
if(WizardryUtilities.isValidTarget(caster, currentTarget)) return;
if(caster instanceof EntityLivingBase){
// If the current target is already a valid mind control target, nothing happens.
if(WizardryUtilities.isValidTarget(caster, currentTarget)) return;
if(MindControl.findMindControlTarget(entity, (EntityLivingBase)caster, world)){
// If it worked, skip setting the target to null.
return;
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -364,8 +365,7 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
}
}
// ================================================ Static methods
// ==================================================
// ================================================ Static methods ==================================================
/**
* Returns the total number of registered spells, excluding the 'None' spell. Returns the same number that would be
@@ -404,12 +404,11 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
}
/** Returns a list of all registered spells' registry names, excluding the 'none' spell. Used in commands. */
public static String[] getSpellNames(){
public static Collection<ResourceLocation> getSpellNames(){
// Maybe it would be better to store all of this statically?
Set<ResourceLocation> keys = new HashSet<ResourceLocation>(registry.getKeys());
keys.remove(registry.getKey(Spells.none));
// Streams!
return keys.stream().map(ResourceLocation::toString).toArray(String[]::new);
return keys;
}
/**