That's one heck of a commit you've got there...

I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
Electroblob77
2019-08-18 00:04:18 +01:00
parent 2680d02304
commit f37812be3e
1564 changed files with 47652 additions and 12984 deletions
@@ -1,12 +1,8 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Element;
import electroblob.wizardry.constants.SpellType;
import electroblob.wizardry.constants.Tier;
import electroblob.wizardry.item.IConjuredItem;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
@@ -17,7 +13,6 @@ import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.World;
/**
@@ -26,53 +21,36 @@ import net.minecraft.world.World;
* instantiation of this class is sufficient to create a conjuration spell; if something extra needs to be done, such as
* a custom particle effect or conjuring the item in a specific slot, then methods can be overridden (perhaps using an
* anonymous class) to add the required functionality.
* <p>
* <p></p>
* Properties added by this type of spell: {@link SpellConjuration#ITEM_LIFETIME}
* <p></p>
* By default, this type of spell cannot be cast by NPCs. {@link Spell#canBeCastByNPCs()}
* <p>
* By default, this type of spell requires a packet to be sent. {@link Spell#doesSpellRequirePacket()}
* <p></p>
* By default, this type of spell cannot be cast by dispensers. {@link Spell#canBeCastByDispensers()}
* <p></p>
* By default, this type of spell requires a packet to be sent. {@link Spell#requiresPacket()}
*
* @author Electroblob
* @since Wizardry 4.2
* @see IConjuredItem
*/
public class SpellConjuration extends Spell {
public static final String ITEM_LIFETIME = "item_lifetime";
/** The item that is conjured by this spell. Should implement {@link IConjuredItem}. */
protected final Item item;
/** The sound that gets played when this spell is cast. */
protected final SoundEvent sound;
/** The volume of the sound played when this spell is cast. Defaults to 1. */
protected float volume = 1;
/** The pitch of the sound played when this spell is cast. Defaults to 1. */
protected float pitch = 1;
/** The pitch variation of the sound played when this spell is cast. Defaults to 0. */
protected float pitchVariation = 0;
public SpellConjuration(String name, Tier tier, Element element, SpellType type, int cost, int cooldown, Item item, SoundEvent sound){
this(Wizardry.MODID, name, tier, element, type, cost, cooldown, item, sound);
public SpellConjuration(String name, Item item){
this(Wizardry.MODID, name, item);
}
public SpellConjuration(String modID, String name, Tier tier, Element element, SpellType type, int cost, int cooldown, Item item, SoundEvent sound){
super(modID, name, tier, element, type, cost, cooldown, EnumAction.BOW, false);
public SpellConjuration(String modID, String name, Item item){
super(modID, name, EnumAction.BOW, false);
this.item = item;
this.sound = sound;
addProperties(ITEM_LIFETIME);
}
/**
* Sets the sound parameters for this spell.
* @param volume
* @param pitch
* @param pitchVariation
* @return The spell instance, allowing this method to be chained onto the constructor.
*/
public SpellConjuration soundValues(float volume, float pitch, float pitchVariation) {
this.volume = volume;
this.pitch = pitch;
this.pitchVariation = pitchVariation;
return this;
}
@Override
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
@@ -80,7 +58,7 @@ public class SpellConjuration extends Spell {
if(world.isRemote) spawnParticles(world, caster, modifiers);
WizardryUtilities.playSoundAtPlayer(caster, WizardrySounds.SPELL_CONJURATION, 1, 1);
this.playSound(world, caster, ticksInUse, -1, modifiers);
return true;
}
@@ -106,6 +84,7 @@ public class SpellConjuration extends Spell {
ItemStack stack = new ItemStack(item);
IConjuredItem.setDurationMultiplier(stack, modifiers.get(WizardryItems.duration_upgrade));
IConjuredItem.setDamageMultiplier(stack, modifiers.get(SpellModifiers.POTENCY));
if(WizardryUtilities.doesPlayerHaveItem(caster, item)) return false;