Spell hierarchisation and refactoring, plus miscellaneous renaming and minor refactoring

- Adds new generic spell superclasses which aim to group spells such that duplicate code is eliminated, and functions standardised, as much as possible.
- Removes numerous spell classes which are no longer required as a result of this change, and replaces them with instances of the relevant generic spell classes.
- Changes the remaining spell classes to fit with the new system, mostly by having them extend the generic spell classes.
- Completes the transfer of particle spawning to the ParticleBuilder system.
This commit is contained in:
Electroblob
2018-06-20 22:25:54 +01:00
parent b6400c72a7
commit 29261082f1
222 changed files with 4412 additions and 9016 deletions
@@ -2,12 +2,12 @@ package electroblob.wizardry.spell;
import java.util.Random;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Element;
import electroblob.wizardry.constants.SpellType;
import electroblob.wizardry.constants.Tier;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
@@ -19,7 +19,7 @@ import net.minecraft.world.World;
public class InvokeWeather extends Spell {
public InvokeWeather(){
super(Tier.ADVANCED, 30, Element.LIGHTNING, "invoke_weather", SpellType.UTILITY, 100, EnumAction.BOW, false);
super("invoke_weather", Tier.ADVANCED, Element.LIGHTNING, SpellType.UTILITY, 30, 100, EnumAction.BOW, false);
}
@Override
@@ -28,8 +28,9 @@ public class InvokeWeather extends Spell {
if(caster.dimension == 0){
if(!world.isRemote){
// TODO: Backport these changes.
int standardWeatherTime = (300 + (new Random()).nextInt(600)) * 20;
if(world.isRaining()){
caster.sendMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".sun"));
world.getWorldInfo().setCleanWeatherTime(standardWeatherTime);
@@ -50,18 +51,17 @@ public class InvokeWeather extends Spell {
if(world.isRemote){
for(int i = 0; i < 10; i++){
double x1 = (double)((float)caster.posX + world.rand.nextFloat() * 2 - 1.0F);
double y1 = (double)((float)WizardryUtilities.getPlayerEyesPos(caster) - 0.5F
+ world.rand.nextFloat());
double z1 = (double)((float)caster.posZ + world.rand.nextFloat() * 2 - 1.0F);
Wizardry.proxy.spawnParticle(Type.SPARKLE, world, x1, y1, z1, 0, 0.1F, 0,
48 + world.rand.nextInt(12), 0.5f, 0.7f, 1.0f);
double x = caster.posX + world.rand.nextDouble() * 2 - 1;
double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble();
double z = caster.posZ + world.rand.nextDouble() * 2 - 1;
ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).colour(0.5f, 0.7f, 1).spawn(world);
}
}
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.ENTITY_LIGHTNING_THUNDER, 0.5F, 1.0f);
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.ENTITY_LIGHTNING_THUNDER, 0.5f, 1.0f);
return true;
}
return false;
}