Add player animation system!

- Hooks into ModelRenderer by wrapping it in an extended version that allows modification of angles after the model has set them
- Is compatible with pretty much everything, yay (even modded armour!)
- Adds property overrides to ItemWand so that gets animated too
- Adds a system for generating override models from a template at runtime so I don't have to duplicate all the wand models
- Tweaks particles and ray spells so they line up with the end of the newly-animated wand
- Fixes a long-standing bug where wand usage actions would stop immediately for all non-continuous spells
This commit is contained in:
Electroblob77
2020-05-09 20:17:15 +01:00
parent cf38a16f49
commit be250e218e
146 changed files with 1531 additions and 262 deletions
@@ -44,6 +44,8 @@ public class CommonProxy {
public void initialiseLayers(){}
public void initialiseAnimations(){}
public void registerKeyBindings(){}
public net.minecraft.client.model.ModelBiped getWizardArmourModel(){
@@ -266,6 +268,14 @@ public class CommonProxy {
return null;
}
/**
* Returns true if the game is being viewed from the perspective of the given entity and is set to first-person
* view. Always returns false on the server side.
*/
public boolean isFirstPerson(Entity entity){
return false;
}
/** Returns an unmodifiable set of the string keys for all of the loaded spell HUD skins. */
public Set<String> getSpellHUDSkins(){
return null;
@@ -174,6 +174,7 @@ public class Wizardry {
@EventHandler
public void postInit(FMLPostInitializationEvent event){
proxy.initialiseLayers();
proxy.initialiseAnimations();
}
@EventHandler
@@ -3,6 +3,8 @@ package electroblob.wizardry.client;
import electroblob.wizardry.CommonProxy;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.block.BlockBookshelf;
import electroblob.wizardry.client.animation.ActionAnimation;
import electroblob.wizardry.client.animation.PlayerAnimator;
import electroblob.wizardry.client.audio.MovingSoundEntity;
import electroblob.wizardry.client.audio.SoundLoop;
import electroblob.wizardry.client.audio.SoundLoopSpell;
@@ -140,7 +142,7 @@ public class ClientProxy extends CommonProxy {
mixedFontRenderer = new MixedFontRenderer(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"),
Minecraft.getMinecraft().renderEngine, false);
}
@Override
public void registerResourceReloadListeners(){
IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
@@ -166,7 +168,7 @@ public class ClientProxy extends CommonProxy {
public void setToNumberSliderEntry(Property property){
property.setConfigEntryClass(NumberSliderEntry.class);
}
@Override
public void setToHUDChooserEntry(Property property){
property.setConfigEntryClass(SpellHUDSkinChooserEntry.class);
@@ -182,11 +184,16 @@ public class ClientProxy extends CommonProxy {
return Minecraft.getMinecraft().world;
}
@Override
public boolean isFirstPerson(Entity entity){
return entity == Minecraft.getMinecraft().getRenderViewEntity() && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0;
}
@Override
public void playMovingSound(Entity entity, SoundEvent sound, SoundCategory category, float volume, float pitch, boolean repeat){
Minecraft.getMinecraft().getSoundHandler().playSound(new MovingSoundEntity<>(entity, sound, category, volume, pitch, repeat));
}
@Override
public void playSpellSoundLoop(EntityLivingBase entity, Spell spell, SoundEvent start, SoundEvent loop, SoundEvent end, SoundCategory category, float volume, float pitch){
SoundLoop.addLoop(new SoundLoopSpell.SoundLoopSpellEntity(start, loop, end, spell, entity, volume, pitch));
@@ -363,7 +370,7 @@ public class ClientProxy extends CommonProxy {
ParticleWizardry.registerParticle(Type.SUMMON, ParticleSummon::new);
ParticleWizardry.registerParticle(Type.VINE, ParticleVine::new);
}
@Override
public ParticleWizardry createParticle(ResourceLocation type, World world, double x, double y, double z){
IWizardryParticleFactory factory = factories.get(type);
@@ -483,36 +490,36 @@ public class ClientProxy extends CommonProxy {
Wizardry.logger.warn("Recieved a PacketNPCCastSpell, but the caster ID was not the ID of an EntityLiving");
}
}
@Override
public void handleDispenserCastSpellPacket(PacketDispenserCastSpell.Message message){
World world = Minecraft.getMinecraft().world;
if(world.getTileEntity(message.pos) instanceof TileEntityDispenser){ // Should always be true
Spell spell = Spell.byNetworkID(message.spellID);
spell.cast(world, message.x, message.y, message.z, message.direction, 0, -1, message.modifiers);
// No need to check if the spell succeeded, because the packet is only ever sent when it succeeds.
MinecraftForge.EVENT_BUS.post(new SpellCastEvent.Post(Source.DISPENSER, spell, world, message.x, message.y,
message.z, message.direction, message.modifiers));
if(spell.isContinuous || spell instanceof None){
DispenserCastingData data = DispenserCastingData.get((TileEntityDispenser)world.getTileEntity(message.pos));
if(spell.isContinuous){
data.startCasting(spell, message.x, message.y, message.z, message.duration, message.modifiers);
}else{
data.stopCasting();
}
}
}else{
Wizardry.logger.warn("Recieved a PacketDispenserCastSpell, but no tileEntity was found at the supplied location.");
}
}
@Override
@@ -682,6 +689,12 @@ public class ClientProxy extends CommonProxy {
LayerFrost.initialiseLayers();
}
@Override
public void initialiseAnimations(){
PlayerAnimator.init();
ActionAnimation.register();
}
@Override
public void registerRenderers(){
@@ -0,0 +1,154 @@
package electroblob.wizardry.client.animation;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.spell.Grapple;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
/**
* An animation that is associated with a particular {@link net.minecraft.item.EnumAction}. This animation will display
* when a player is using an item with that action.
* @author Electroblob
* @since Wizardry 4.3
* @see electroblob.wizardry.item.SpellActions
*/
public abstract class ActionAnimation extends Animation {
private final EnumAction action;
public ActionAnimation(EnumAction action){
super(action.name());
this.action = action;
}
@Override
public boolean shouldDisplay(EntityPlayer player, boolean firstPerson){
return !firstPerson && player.getItemInUseCount() > 0 && player.getActiveItemStack().getItemUseAction() == action;
}
/** Called from the client proxy to register all of wizardry's action animations. */
public static void register(){
PlayerAnimator.registerAnimation(new ActionAnimation(SpellActions.POINT){
@Override
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
// Something (probably some sort of race condition) causes getActiveItemStack to sometimes be wrong
if(player.getActiveItemStack() != player.getHeldItem(player.getActiveHand())) return;
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
float pitch = (float)Math.toRadians(player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks);
float yaw = (float)Math.toRadians(player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks)
- (float)Math.toRadians(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks);
float x = -((float)Math.PI / 2) + pitch + 0.2f;
float y = (side == EnumHandSide.RIGHT ? -0.25f : 0.25f) + yaw;
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
arm.setRotation(x, y, 0);
}
});
PlayerAnimator.registerAnimation(new ActionAnimation(SpellActions.POINT_UP){
@Override
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
if(player.getActiveItemStack() != player.getHeldItem(player.getActiveHand())) return;
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
arm.addRotation(-2.2f, side == EnumHandSide.RIGHT ? 0.2f : -0.2f, 0);
}
});
PlayerAnimator.registerAnimation(new ActionAnimation(SpellActions.POINT_DOWN){
@Override
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
float tick = player.getItemInUseMaxCount() + partialTicks; // It's not the "max" use count at all!
float y = Math.min(0.4f + tick * 0.05f, 0.7f);
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
arm.addRotation(-0.2f, side == EnumHandSide.RIGHT ? y : -y, 0);
}
});
PlayerAnimator.registerAnimation(new ActionAnimation(SpellActions.SUMMON){
@Override
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
float tick = player.getItemInUseMaxCount() + partialTicks; // It's not the "max" use count at all!
float x = -Math.min(0.4f + tick * 0.2f, 2f);
((ModelRendererExtended)getArmForSide(model, EnumHandSide.RIGHT)).addRotation(x, 1.2f, 0);
((ModelRendererExtended)getArmForSide(model, EnumHandSide.LEFT)).addRotation(x, -1.2f, 0);
}
});
PlayerAnimator.registerAnimation(new ActionAnimation(SpellActions.GRAPPLE){
@Override
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
WizardData data = WizardData.get(player);
RayTraceResult hit = data.getVariable(Grapple.TARGET_KEY);
if(hit == null || hit.typeOfHit == RayTraceResult.Type.MISS) return;
Vec3d target = hit.hitVec;
if(hit.entityHit instanceof EntityLivingBase){
// If the target is an entity, we need to use the entity's centre rather than the original hit position
// because the entity will have moved!
target = new Vec3d(hit.entityHit.posX, hit.entityHit.getEntityBoundingBox().minY + hit.entityHit.height/2, hit.entityHit.posZ);
}
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
Vec3d direction = target.subtract(player.getPositionEyes(partialTicks));
float yaw = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
float pitch = (float)MathHelper.atan2(MathHelper.sqrt(direction.x*direction.x + direction.z*direction.z), direction.y);
float x = pitch - (float)Math.PI * 0.9f;
float y = -(float)Math.toRadians(yaw) - (float)MathHelper.atan2(direction.x, direction.z);
y += (side == EnumHandSide.RIGHT ? -0.25f : 0.25f);
if(Math.abs(pitch) < 0.2f) y = arm.rotateAngleY;
arm.setRotation(x, y, 0);
}
});
PlayerAnimator.registerAnimation(new ActionAnimation(SpellActions.IMBUE){
@Override
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
float tick = player.getItemInUseMaxCount() + partialTicks; // It's not the "max" use count at all!
float z = Math.max(1.5f - tick * 0.1f, 0.8f);
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
arm.addRotation(-1.2f, side == EnumHandSide.RIGHT ? -0.2f : 0.2f, side == EnumHandSide.RIGHT ? z : -z);
if(!player.getHeldItem(WizardryUtilities.getHandForSide(player, side.opposite())).isEmpty()){
((ModelRendererExtended)getArmForSide(model, side.opposite())).addRotation(-0.8f, side == EnumHandSide.LEFT ? 0.3f : -0.3f, 0);
}
}
});
PlayerAnimator.registerAnimation(new ActionAnimation(SpellActions.THRUST){
@Override
public void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson){
if(player.getActiveItemStack() != player.getHeldItem(player.getActiveHand())) return;
EnumHandSide side = WizardryUtilities.getSideForHand(player, player.getActiveHand());
ModelRendererExtended arm = (ModelRendererExtended)getArmForSide(model, side);
float y = side == EnumHandSide.RIGHT ? -0.6f : 0.6f;
arm.addRotation(-1.2f, y, 0);
if(player.getHeldItem(WizardryUtilities.getHandForSide(player, side.opposite())).isEmpty()){
ModelRendererExtended otherArm = (ModelRendererExtended)getArmForSide(model, side.opposite());
otherArm.setRotation(arm.rotateAngleX - 1.2f, -arm.rotateAngleY - y, otherArm.rotateAngleZ);
}
}
});
}
}
@@ -0,0 +1,77 @@
package electroblob.wizardry.client.animation;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumHandSide;
/**
* Represents a player animation. Use one of the predefined subclasses below for common animation types, or extend this
* class directly to define a completely custom animation. Register instances of this class using
* {@link PlayerAnimator#registerAnimation(Animation)}.
* @author Electroblob
* @since Wizardry 4.3
* @see ActionAnimation
*/
public abstract class Animation {
private final String name;
public Animation(String name){
this.name = name;
}
/** Returns the name of this animation, currently only used for warning messages / debugging. */
public String getName(){
return name;
}
/**
* Returns whether this animation should be displayed for the given player. <i>Note that if two registered
* animations have overlapping conditions, both will attempt to display simultaneously, so if they both animate the
* same model part, that part may not behave as expected.</i>
* @param player The player being animated
* @param firstPerson True if the player being animated is the local client player, and they are in first-person
* view. In first-person, animations are only useful for animating the player's empty hand.
* @return True if the animation should be displayed, false if not.
*/
public abstract boolean shouldDisplay(EntityPlayer player, boolean firstPerson);
/**
* Sets the rotation of the model parts for this animation. This method is called every time the player is rendered
* when {@link Animation#shouldDisplay(EntityPlayer, boolean)} returns true.
* @param player The player being animated
* @param model The model to animate. All of the standard {@link ModelBiped} parts will already be wrapped and may
* be safely cast to {@code ModelRendererExtended} in order to override the rotations set by the model
* itself - see {@link ModelRendererExtended ModelRendererExtended} for details.
* @param partialTicks The current partial tick time
* @param firstPerson True if the player being animated is the local client player, and they are in first-person
* view. In first-person, animations are only useful for animating the player's empty hand.
*/
public abstract void setRotationAngles(EntityPlayer player, ModelBiped model, float partialTicks, boolean firstPerson);
/**
* Returns whether the boxes that form the second layer of the player's skin (for models that are instances of
* {@link net.minecraft.client.model.ModelPlayer ModelPlayer}) should automatically be set to the same angles as
* their corresponding first-layer parts.
* @param player The player being rendered, for reference
* @param firstPerson True if the player being animated is the local client player, and they are in first-person
* view. In first-person, animations are only useful for animating the player's empty hand.
* @return True to let {@link PlayerAnimator} auto-rotate the second skin layer, false to rotate them manually.
*/
public boolean autoRotateSecondLayer(EntityPlayer player, boolean firstPerson){
return true;
}
/**
* Returns the arm of the given model corresponding to the given side. Function is identical to the method of the
* same name in {@link ModelBiped}.
* @param model The model to get the arm of
* @param side The {@link EnumHandSide} to return the arm for
* @return The {@link ModelRenderer} corresponding to the given arm
*/
public static ModelRenderer getArmForSide(ModelBiped model, EnumHandSide side){
return side == EnumHandSide.LEFT ? model.bipedLeftArm : model.bipedRightArm;
}
}
@@ -0,0 +1,177 @@
package electroblob.wizardry.client.animation;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer;
/**
* A wrapper around {@link ModelRenderer} which can be swapped into models to allow render pre/post events to
* circumvent {@code ModelBase.setRotationAngles(...)} and set model part rotations themselves. Instances of this class
* keep a reference to the original {@code ModelRenderer} and delegate all the actual rendering to it.
* <p></p>
* {@link PlayerAnimator PlayerAnimator} does all the necessary setup with this
* class for player animations. It is also possible to set up custom animations for non-player entities with this class,
* see {@link ModelRendererExtended#wrap(ModelBiped)} and {@link ModelRendererExtended#wrap(ModelBase, ModelRenderer)}.
* @author Electroblob
* @since Wizardry 4.3
*/
public class ModelRendererExtended extends ModelRenderer {
// We probably could have copied all the fields over instead, but this way if anyone else modifies the boxes we
// won't overwrite their changes
// This way also avoids reflection because we don't need to copy private fields, which is better for performance
private ModelRenderer delegate;
private float actualRotationX;
private float actualRotationY;
private float actualRotationZ;
private float extraRotationX;
private float extraRotationY;
private float extraRotationZ;
private ModelRendererExtended(ModelBase baseModel, ModelRenderer delegate){
super(baseModel, delegate.boxName);
this.delegate = delegate;
// Copy over any public fields that might get changed
this.textureWidth = delegate.textureWidth;
this.textureHeight = delegate.textureHeight;
this.showModel = delegate.showModel;
this.isHidden = delegate.isHidden;
this.rotationPointX = delegate.rotationPointX;
this.rotationPointY = delegate.rotationPointY;
this.rotationPointZ = delegate.rotationPointZ;
this.resetRotation();
}
// Static initialisers
/**
* Replaces the given part of the given {@link ModelBase} with a new {@code ModelRendererExtended} that wraps the
* original part. This method takes care of modifying the model's box list, but <b>is unable to change any
* individual {@link ModelRenderer} fields</b> - this method instead returns the resulting
* {@code ModelRendererExtended} to be assigned to the appropriate field.
* @param model The model whose part is to be wrapped
* @param box The part of the model to wrap, must belong to the above model
* @return The resulting wrapped model part, this should be assigned to the appropriate part field in the model. If
* the given model part was already wrapped, this method simply returns it unchanged.
* @throws IllegalArgumentException if the given box does not belong to the given model
*/
public static ModelRendererExtended wrap(ModelBase model, ModelRenderer box){
if(box instanceof ModelRendererExtended) return (ModelRendererExtended)box; // Ignore already-wrapped parts
ModelRendererExtended wrapper = new ModelRendererExtended(model, box);
int index = model.boxList.indexOf(box);
if(index < 0) throw new IllegalArgumentException(String.format("The given ModelRenderer %s does not belong to the given model %s", model, box));
model.boxList.set(index, wrapper); // I doubt the order matters but we may as well put it at the same index
return wrapper;
}
/**
* Replaces the given {@link ModelBiped}'s parts with new {@code ModelRendererExtended} versions that wrap the
* original parts. If the given model is a {@link ModelPlayer}, the extra boxes for player skin overlays will also
* be wrapped.
*/
public static void wrap(ModelBiped model){
// MMmmmmmm wraps
model.bipedHead = wrap(model, model.bipedHead);
model.bipedBody = wrap(model, model.bipedBody);
model.bipedRightArm = wrap(model, model.bipedRightArm);
model.bipedLeftArm = wrap(model, model.bipedLeftArm);
model.bipedRightLeg = wrap(model, model.bipedRightLeg);
model.bipedLeftLeg = wrap(model, model.bipedLeftLeg);
model.bipedHeadwear = wrap(model, model.bipedHeadwear);
if(model instanceof ModelPlayer){
((ModelPlayer)model).bipedBodyWear = wrap(model, ((ModelPlayer)model).bipedBodyWear);
((ModelPlayer)model).bipedRightArmwear = wrap(model, ((ModelPlayer)model).bipedRightArmwear);
((ModelPlayer)model).bipedLeftArmwear = wrap(model, ((ModelPlayer)model).bipedLeftArmwear);
((ModelPlayer)model).bipedRightLegwear = wrap(model, ((ModelPlayer)model).bipedRightLegwear);
((ModelPlayer)model).bipedLeftLegwear = wrap(model, ((ModelPlayer)model).bipedLeftLegwear);
}
}
/** Resets the rotation of this model part to the angle set by the parent model. */
public void resetRotation(){
this.actualRotationX = Float.NaN;
this.actualRotationY = Float.NaN;
this.actualRotationZ = Float.NaN;
this.extraRotationX = 0;
this.extraRotationY = 0;
this.extraRotationZ = 0;
}
/** Sets the rotation of this model part, which will overwrite the angle set by the parent model. */
public void setRotation(float x, float y, float z){
this.actualRotationX = x;
this.actualRotationY = y;
this.actualRotationZ = z;
}
/** Sets the extra rotation of this model part, which will be added onto the angle set by the parent model. */
public void addRotation(float x, float y, float z){
this.extraRotationX = x;
this.extraRotationY = y;
this.extraRotationZ = z;
}
/** Sets the rotation of this model part to the same values as the given box. */
public void setRotationTo(ModelRendererExtended box){
this.actualRotationX = box.actualRotationX;
this.actualRotationY = box.actualRotationY;
this.actualRotationZ = box.actualRotationZ;
this.extraRotationX = box.extraRotationX;
this.extraRotationY = box.extraRotationY;
this.extraRotationZ = box.extraRotationZ;
}
// Delegate rendering, but fiddle with the angles first
@Override
public void render(float scale){
// Need to copy these over each time in case they were changed
delegate.showModel = this.showModel;
delegate.isHidden = this.isHidden;
delegate.rotationPointX = this.rotationPointX;
delegate.rotationPointY = this.rotationPointY;
delegate.rotationPointZ = this.rotationPointZ;
if(!Float.isNaN(actualRotationX) && !Float.isNaN(actualRotationY) && !Float.isNaN(actualRotationZ)){
delegate.rotateAngleX = actualRotationX;
delegate.rotateAngleY = actualRotationY;
delegate.rotateAngleZ = actualRotationZ;
}else{
delegate.rotateAngleX = this.rotateAngleX + extraRotationX;
delegate.rotateAngleY = this.rotateAngleY + extraRotationY;
delegate.rotateAngleZ = this.rotateAngleZ + extraRotationZ;
}
delegate.render(scale);
}
// Delegate all other methods
@Override
public void addChild(ModelRenderer renderer){
delegate.addChild(renderer);
}
@Override
public void renderWithRotation(float scale){
delegate.renderWithRotation(scale);
}
@Override
public void postRender(float scale){
// TODO: It may just be easier to hardcode the item rotation part of the animation as well
// Exactly the same setup as above, just add item rotation/translation fields and setters
// float angle = 1;
// float radius = 10;
// delegate.rotationPointY -= radius * MathHelper.cos(angle);
// delegate.rotationPointZ -= radius * MathHelper.sin(angle);
// delegate.rotateAngleX += angle;
delegate.postRender(scale);
}
}
@@ -0,0 +1,213 @@
package electroblob.wizardry.client.animation;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.event.RenderSpecificHandEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Handles the setup and rendering events for custom player animations, as well as registering of animations. Addons
* can also register their own animations here, see {@link PlayerAnimator#registerAnimation(Animation)}.
* @author Electroblob
* @since Wizardry 4.3
* @see electroblob.wizardry.item.SpellActions SpellActions
*/
@Mod.EventBusSubscriber(Side.CLIENT)
public class PlayerAnimator {
// TODO: Attempt to extend this to all bipeds
private static final List<Animation> animations = new ArrayList<>();
/** Stores all registered layer renderers for lazy-loading of armour models later. */
private static final Map<RenderPlayer, List<LayerRenderer<? extends EntityLivingBase>>> playerLayers = new HashMap<>();
/** Stores the main model for each renderer plus all models for registered layer renderers. */
private static final Map<RenderPlayer, List<ModelBiped>> playerLayerModels = new HashMap<>();
/** Reflected into {@link RenderLivingBase}{@code #layerRenderers}. */
private static final Field layerRenderers;
static {
layerRenderers = ObfuscationReflectionHelper.findField(RenderLivingBase.class, "field_177097_h");
}
/**
* Registers a new player animation. This method should be called from the {@code init()} phase via a client proxy.
* @param animation The animation to register
*/
// N.B. This can (and will) be called before PlayerAnimator#init() is called
public static void registerAnimation(Animation animation){
if(animations.contains(animation)){
Wizardry.logger.warn("Animation {} is already registered!", animation.getName());
}else{
animations.add(animation);
}
}
// TODO: Figure out if calling this from postInit ensures we catch all the layers, and lazy-load it if not
@SuppressWarnings("unchecked")
public static void init(){
for(RenderPlayer renderer : Minecraft.getMinecraft().getRenderManager().getSkinMap().values()){
List<ModelBiped> models = new ArrayList<>();
ModelRendererExtended.wrap(renderer.getMainModel());
models.add(renderer.getMainModel());
try {
List<LayerRenderer<? extends EntityLivingBase>> layers = (List<LayerRenderer<? extends EntityLivingBase>>)layerRenderers.get(renderer);
playerLayers.put(renderer, layers);
for(LayerRenderer<?> layer : layers){
for(Field field : WizardryUtilities.getAllFields(layer.getClass())){
field.setAccessible(true);
// If your layer model doesn't extend ModelBiped, you DESERVE to be incompatible!
// (Just kidding... there's nothing I can do about it anyway)
if(field.get(layer) instanceof ModelBiped){
ModelBiped model = (ModelBiped)field.get(layer);
ModelRendererExtended.wrap(model);
models.add(model);
}
}
}
}catch(IllegalAccessException e){
Wizardry.logger.error("Error during reflective access of render layers: ", e);
}
playerLayerModels.put(renderer, models);
}
}
private static void updateModels(EntityPlayer player, Render<?> renderer, float partialTicks, boolean firstPerson){
// Biped armour is special because of Forge's armour item render hook
// This needs to be lazy-loaded because we need access to an actual item
for(LayerRenderer<? extends EntityLivingBase> layer : playerLayers.get(renderer)){
if(layer instanceof LayerBipedArmor){
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
ItemStack armour = player.getItemStackFromSlot(slot);
ModelBiped model = ForgeHooksClient.getArmorModel(player, armour, slot, ((LayerBipedArmor)layer).getModelFromSlot(slot));
List<ModelBiped> models = playerLayerModels.get(renderer);
if(!models.contains(model)){
models.add(model);
ModelRendererExtended.wrap(model);
}
}
}
}
boolean flag = false;
for(Animation animation : animations){
boolean autoRotateSecondLayer = animation.autoRotateSecondLayer(player, firstPerson);
if(animation.shouldDisplay(player, firstPerson)){
flag = true;
for(ModelBiped model : playerLayerModels.get(renderer)){
animation.setRotationAngles(player, model, partialTicks, firstPerson);
if(autoRotateSecondLayer && model instanceof ModelPlayer){
alignSecondLayer((ModelPlayer)model);
}
}
}
}
if(!flag){
for(ModelBiped model : playerLayerModels.get(renderer)){
for(ModelRenderer box : model.boxList){ // For ModelPlayer, this will include the second layer
// Some models have extra boxes, they (probably) don't need wrapping but we need this check!
if(box instanceof ModelRendererExtended){
((ModelRendererExtended)box).resetRotation();
}
}
}
}
}
/** Rotates the second layer boxes of the given (wrapped) player model to match the first layer. */
public static void alignSecondLayer(ModelPlayer model){
((ModelRendererExtended)model.bipedBodyWear) .setRotationTo((ModelRendererExtended)model.bipedBody);
((ModelRendererExtended)model.bipedRightArmwear).setRotationTo((ModelRendererExtended)model.bipedRightArm);
((ModelRendererExtended)model.bipedLeftArmwear) .setRotationTo((ModelRendererExtended)model.bipedLeftArm);
((ModelRendererExtended)model.bipedRightLegwear).setRotationTo((ModelRendererExtended)model.bipedBody);
((ModelRendererExtended)model.bipedLeftLegwear) .setRotationTo((ModelRendererExtended)model.bipedBody);
}
@SubscribeEvent
public static void onRenderHandEvent(RenderSpecificHandEvent event){
AbstractClientPlayer player = Minecraft.getMinecraft().player;
EnumAction action = event.getItemStack().getItemUseAction();
if(player.isHandActive() && player.getActiveHand() == event.getHand() && SpellActions.getSpellActions().contains(action)){
// Minecraft's item renderer helpfully doesn't have a default case for the usage action so it doesn't do any
// transformations at all (which is VERY ANNOYING!) - the following lines are from ItemRenderer#transformSideFirstPerson
int i = (player.getPrimaryHand() == EnumHandSide.RIGHT) == (event.getHand() == EnumHand.MAIN_HAND) ? 1 : -1;
GlStateManager.translate((float)i * 0.56F, -0.52F + event.getEquipProgress() * -0.6F, -0.72F);
}
updateModels(player, Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(player), event.getPartialTicks(), true);
}
@SubscribeEvent
public static void onRenderPlayerPreEvent(RenderPlayerEvent.Pre event){
// boolean firstPerson = event.getEntityPlayer() == Minecraft.getMinecraft().player
// && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0;
updateModels(event.getEntityPlayer(), event.getRenderer(), event.getPartialRenderTick(), false);
}
// @SubscribeEvent
// public static void onRenderPlayerPostEvent(RenderPlayerEvent.Post event){
// TODO: Would we ever need to unwrap the models?
// }
}
@@ -0,0 +1,163 @@
package electroblob.wizardry.client.model;
import com.google.common.collect.ImmutableMap;
import electroblob.wizardry.Wizardry;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* A special type of model that generates override models dynamically. This allows the same overrides to be applied to
* multiple item models without needing an override version of each one just to point to a texture.
* <p></p>
* To use this system in a model file:<p></p>
* 1. Make a base model file and define the item overrides in it. <b>This model must be placed in the folder
* {@code models/item/override_generators}</b> (unfortunately the folder has to be predefined, see below).<br>
* 2. Make the model files your overrides point to. These should define everything about the model except textures.<br>
* 3. In each model that should generate overrides dynamically, define a single override that points to the location of
* the model from step 1 (the predicate doesn't matter).<br>
* <p></p>
* It is advisable to make the parent of the override model (from step 2) the same as the parent of the model to
* be overridden, so that they share any necessary properties and texture variables. For example, both
* {@code ebwizardry:item/magic_wand.json} and {@code ebwizardry:item/wand_point.json} have {@code item/handheld} as
* their parent. The override model will reference the textures in the original model, so if the override defines a
* face with the texture {@code "#face"}, the texture used will be the file associated with {@code "face"} in the
* original model. For simple models, this will just be the standard {@code "layer0"}.
* @since Wizardry 4.3
* @author Electroblob
*/
// Okay, it's not *that* bad if you only have one override, but imagine having to duplicate every single wand model 5
// times if we wanted 5 animations...
// The nice thing is resource packs don't lose any flexibility this way, they can still redefine the models themselves
// and specify custom models for the overrides if they want, or they can keep using this system - in fact, they GAIN
// flexibility because they can also overwrite the base wand.json model and specify global overrides too
@Mod.EventBusSubscriber(Side.CLIENT)
public class BakedModelGenerateOverrides implements IBakedModel {
// I tried having this as a prefix that gets removed at runtime, which worked fine but it spammed the log with
// errors because the prefixed file doesn't actually exist, so even though it's never used the game still complains
private static final String OVERRIDE_GENERATORS = "override_generators";
private final IBakedModel delegate;
private final ItemOverrideList overrides;
public BakedModelGenerateOverrides(IBakedModel delegate, ItemOverrideList overrides){
this.delegate = delegate;
this.overrides = overrides;
}
@Override
public ItemOverrideList getOverrides(){
return overrides; // The only thing that's not delegated
}
// Delegate everything else
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand){
return delegate.getQuads(state, side, rand);
}
@Override
public boolean isAmbientOcclusion(){
return delegate.isAmbientOcclusion();
}
@Override
public boolean isGui3d(){
return delegate.isGui3d();
}
@Override
public boolean isBuiltInRenderer(){
return delegate.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getParticleTexture(){
return delegate.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms(){
return delegate.getItemCameraTransforms();
}
@Override
public boolean isAmbientOcclusion(IBlockState state){
return delegate.isAmbientOcclusion(state);
}
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType){
return delegate.handlePerspective(cameraTransformType);
}
// Baking
@SubscribeEvent
public static void bake(ModelBakeEvent event){
for(ModelResourceLocation location : event.getModelRegistry().getKeys()){
IBakedModel original = event.getModelRegistry().getObject(location);
if(original != null){
original.getOverrides().getOverrides().stream().map(ItemOverride::getLocation)
.filter(l -> l.getPath().contains(OVERRIDE_GENERATORS)).findFirst()
.ifPresent(l -> event.getModelRegistry().putObject(location,
substituteWandModel(event.getModelManager(), location, original, l)));
}
}
}
// We have to use ModelBakeEvent for this because we need the original model to be baked with the vanilla system
private static IBakedModel substituteWandModel(ModelManager modelManager, ModelResourceLocation location, IBakedModel original, ResourceLocation overrideLocation){
try {
IModel unbakedOriginal = ModelLoaderRegistry.getModel(location);
IModel referenceModel = ModelLoaderRegistry.getModel(overrideLocation);
ModelBlock vanillaOriginal = unbakedOriginal.asVanillaModel().orElse(null);
ModelBlock vanillaRefModel = referenceModel.asVanillaModel().orElse(null);
if(vanillaOriginal != null && vanillaRefModel != null){
// So... many... data structures...
List<ItemOverride> overrides = vanillaRefModel.getOverrides();
Map<ResourceLocation, IBakedModel> replacementMap = new HashMap<>();
for(ItemOverride override : overrides){
IModel replacement = ModelLoaderRegistry.getModel(override.getLocation()).retexture(ImmutableMap.copyOf(vanillaOriginal.textures));
replacementMap.put(override.getLocation(), replacement.bake(unbakedOriginal.getDefaultState(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter()));
}
ItemOverrideListMapped overrideList = new ItemOverrideListMapped(overrides, replacementMap);
return new BakedModelGenerateOverrides(original, overrideList);
}
}catch(Exception exception){
Wizardry.logger.error("Error baking item display override models: ", exception);
}
return modelManager.getMissingModel();
}
}
@@ -0,0 +1,42 @@
package electroblob.wizardry.client.model;
import com.google.common.collect.ImmutableMap;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemOverride;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
/** A version of {@link ItemOverrideList} that uses a predefined map to substitute a specific baked model depending on
* the location the currently-applicable override points to. */
public class ItemOverrideListMapped extends ItemOverrideList {
private final Map<ResourceLocation, IBakedModel> replacementMap;
public ItemOverrideListMapped(List<ItemOverride> overrides, Map<ResourceLocation, IBakedModel> replacementMap){
super(overrides);
this.replacementMap = ImmutableMap.copyOf(replacementMap);
}
@Override
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity){
if(!stack.isEmpty() && stack.getItem().hasCustomProperties()){
// Get the location the original override points to...
ResourceLocation location = applyOverride(stack, world, entity); // I wonder why this is deprecated?
if(location != null){
return replacementMap.get(location); // ... then substitute in the corresponding generated model
}
}
return originalModel;
}
}
@@ -308,11 +308,11 @@ public final class WizardryModels {
if(location.getNamespace().equals(Wizardry.MODID)){
IBakedModel original = event.getModelRegistry().getObject(location);
if(location.getPath().contains("runestone") || location.getPath().contains("runestone_pedestal")){
IBakedModel original = event.getModelRegistry().getObject(location);
event.getModelRegistry().putObject(location, new BakedModelGlowingOverlay(original, "overlay"));
}else if(location.getPath().contains("spectral_block")){
IBakedModel original = event.getModelRegistry().getObject(location);
event.getModelRegistry().putObject(location, new BakedModelGlowingOverlay(original, "spectral_block"));
}
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.client.particle;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@@ -15,6 +16,8 @@ import javax.annotation.Nullable;
/** Superclass for particles with a second target entity or target position. */
public abstract class ParticleTargeted extends ParticleWizardry {
private static final double THIRD_PERSON_AXIAL_OFFSET = 1.2;
protected double targetX;
protected double targetY;
protected double targetZ;
@@ -79,6 +82,16 @@ public abstract class ParticleTargeted extends ParticleWizardry {
float y = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks);
float z = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks);
// Translates the particle a short distance in front of the entity
if(this.entity != null && this.shouldApplyOriginOffset()){ // TODO: Replace with a protected boolean method
if(this.entity != viewer || Minecraft.getMinecraft().gameSettings.thirdPersonView != 0){
Vec3d look = entity.getLook(partialTicks).scale(THIRD_PERSON_AXIAL_OFFSET);
x += look.x;
y += look.y;
z += look.z;
}
}
if(this.target != null){
this.targetX = this.target.prevPosX + (this.target.posX - this.target.prevPosX) * partialTicks;
@@ -133,6 +146,12 @@ public abstract class ParticleTargeted extends ParticleWizardry {
GlStateManager.popMatrix();
}
/** Returns whether the origin of this particle should be moved a short distance in front of the entity it is
* linked to, if any. */
protected boolean shouldApplyOriginOffset(){
return true;
}
/** Called from {@link ParticleTargeted#renderParticle(BufferBuilder, Entity, float, float, float, float, float, float)},
* once the appropriate calculations and transformations have been applied, to actually render the particle. Subclasses
* override this <i>instead</i> of overriding {@code renderParticle} directly, and inside render the particle <b>along
@@ -46,6 +46,11 @@ public class ParticleVine extends ParticleTargeted {
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
}
@Override
protected boolean shouldApplyOriginOffset(){
return false;
}
@Override
protected void draw(Tessellator tessellator, double length, float partialTicks){
@@ -28,10 +28,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
@@ -91,6 +88,14 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem,
this.element = element;
setMaxDamage(this.tier.maxCharge);
WizardryRecipes.addToManaFlaskCharging(this);
// TODO: Hook to allow addon devs to have this override apply to their own animations
addPropertyOverride(new ResourceLocation("pointing"),
(s, w, e) -> e != null && e.getActiveItemStack() == s
&& (s.getItemUseAction() == SpellActions.POINT
|| s.getItemUseAction() == SpellActions.POINT_UP
|| s.getItemUseAction() == SpellActions.POINT_DOWN
|| s.getItemUseAction() == SpellActions.GRAPPLE
|| s.getItemUseAction() == SpellActions.SUMMON) ? 1 : 0);
}
@Override
@@ -381,6 +386,8 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem,
Spell spell = WandHelper.getCurrentSpell(stack);
if(!spell.isContinuous) return;
SpellModifiers modifiers;
if(WizardData.get(player) != null){
@@ -393,7 +400,7 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem,
// Continuous spells (these must check if they can be cast each tick since the mana changes)
// Don't call canCast when castingTick == 0 because we already did it in onItemRightClick
if(spell.isContinuous && (castingTick == 0 || canCast(stack, spell, player, player.getActiveHand(), castingTick, modifiers))){
if(castingTick == 0 || canCast(stack, spell, player, player.getActiveHand(), castingTick, modifiers)){
cast(stack, spell, player, player.getActiveHand(), castingTick, modifiers);
}else{
// Stops the casting if it was interrupted, either by events or because the wand ran out of mana
@@ -0,0 +1,63 @@
package electroblob.wizardry.item;
import electroblob.wizardry.Wizardry;
import net.minecraft.item.EnumAction;
import net.minecraftforge.common.util.EnumHelper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Defines and stores wizardry's custom {@link EnumAction}s.
* @author Electroblob
* @since Wizardry 4.3
*/
public final class SpellActions {
private static final List<EnumAction> spellActions = new ArrayList<>();
/** An {@link EnumAction} that causes the player to point in the direction they are looking. */
public static final EnumAction POINT = createAction("point");
/** An {@link EnumAction} that causes the player to point directly upwards. */
public static final EnumAction POINT_UP = createAction("point_up");
/** An {@link EnumAction} that causes the player to point down towards the ground. */
public static final EnumAction POINT_DOWN = createAction("point_down");
/** An {@link EnumAction} that causes the player to stretch both arms out and up slightly, as if summoning. */
public static final EnumAction SUMMON = createAction("summon");
/** An {@link EnumAction} that causes the player to hold their item vertically in front of them. */
public static final EnumAction THRUST = createAction("thrust");
/** An {@link EnumAction} that causes the player to point the item in use towards their other hand. */
public static final EnumAction IMBUE = createAction("imbue");
/** An {@link EnumAction} that causes the player to point towards their grappling target (see
* {@link electroblob.wizardry.spell.Grapple Grapple}). */
public static final EnumAction GRAPPLE = createAction("grapple");
private SpellActions(){} // No instances!
private static EnumAction createAction(String name){
return createAction(Wizardry.MODID, name);
}
/**
* Creates a new {@link EnumAction} with the given mod ID and name and adds it to the internal spell action list.
* Use this method to add extra spell actions for use with wizardry's player animator.
*
* @param modID The ID of the mod adding this action (avoids naming conflicts)
* @param name The name of the action (for Forge to use as the in-code name; should only contain characters that
* can be used in Java identifiers)
* @return The resulting {@code EnumAction}
*/
public static EnumAction createAction(String modID, String name){
// Using $ because this name will be used as the in-code name of the enum constant, and : wouldn't compile
EnumAction action = EnumHelper.addAction(modID + "$" + name);
spellActions.add(action);
return action;
}
/** Returns an unmodifiable list of all spell actions. */
public static List<EnumAction> getSpellActions(){
return Collections.unmodifiableList(spellActions);
}
}
@@ -4,6 +4,7 @@ import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.construct.*;
import electroblob.wizardry.entity.living.*;
import electroblob.wizardry.entity.projectile.*;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.spell.*;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.init.MobEffects;
@@ -299,7 +300,7 @@ public final class Spells {
registry.register(new HealAlly());
registry.register(new SpellMinion<>("summon_blaze", EntityBlazeMinion::new).soundValues(1, 1.1f, 0.2f));
registry.register(new SpellConstruct<>("ring_of_fire", EnumAction.BOW, EntityFireRing::new, false).floor(true).addProperties(Spell.DAMAGE, Spell.BURN_DURATION));
registry.register(new SpellConstruct<>("ring_of_fire", SpellActions.POINT_DOWN, EntityFireRing::new, false).floor(true).addProperties(Spell.DAMAGE, Spell.BURN_DURATION));
registry.register(new Detonate());
registry.register(new SpellBuff("fire_resistance", 1, 0.5f, 0, () -> MobEffects.FIRE_RESISTANCE).soundValues(0.7f, 1.2f, 0.4f));
registry.register(new SpellBuff("fireskin", 1, 0.5f, 0, () -> WizardryPotions.fireskin).addProperties(Spell.BURN_DURATION));
@@ -337,7 +338,7 @@ public final class Spells {
registry.register(new PhaseStep());
registry.register(new VanishingBox());
registry.register(new GreaterHeal());
registry.register(new SpellConstruct<>("healing_aura", EnumAction.BOW, EntityHealAura::new, false).addProperties(Spell.DAMAGE, Spell.HEALTH));
registry.register(new SpellConstruct<>("healing_aura", SpellActions.POINT_DOWN, EntityHealAura::new, false).addProperties(Spell.DAMAGE, Spell.HEALTH));
registry.register(new Forcefield());
registry.register(new SpellBuff("ironflesh", 0.4f, 0.5f, 0.6f, () -> MobEffects.RESISTANCE).soundValues(0.7f, 1.2f, 0.4f));
registry.register(new Transience());
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -19,7 +19,7 @@ import net.minecraft.world.World;
public class Arc extends SpellRay {
public Arc(){
super("arc", false, EnumAction.NONE);
super("arc", false, SpellActions.POINT);
this.aimAssist(0.6f);
this.soundValues(1, 1.7f, 0.2f);
this.addProperties(DAMAGE);
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.event.SpellCastEvent;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.ParticleBuilder;
@@ -11,7 +12,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySpellcasterIllager;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -35,7 +35,7 @@ public class ArcaneJammer extends SpellRay {
}
public ArcaneJammer(){
super("arcane_jammer", false, EnumAction.NONE);
super("arcane_jammer", false, SpellActions.POINT);
this.soundValues(0.7f, 1, 0.4f);
this.addProperties(EFFECT_DURATION);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.AllyDesignationSystem;
import electroblob.wizardry.util.NBTExtras;
import electroblob.wizardry.util.SpellModifiers;
@@ -9,7 +10,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityDispenser;
@@ -29,7 +29,7 @@ public class ArcaneLock extends SpellRay {
public static final String NBT_KEY = "arcaneLockOwner";
public ArcaneLock(){
super("arcane_lock", false, EnumAction.NONE);
super("arcane_lock", false, SpellActions.POINT);
}
@Override public boolean requiresPacket(){ return true; }
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
@@ -23,7 +23,7 @@ public class Banish extends SpellRay {
public static final String MAXIMUM_TELEPORT_DISTANCE = "maximum_teleport_distance";
public Banish(){
super("banish", false, EnumAction.NONE);
super("banish", false, SpellActions.POINT);
this.addProperties(MINIMUM_TELEPORT_DISTANCE, MAXIMUM_TELEPORT_DISTANCE);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.RayTracer;
import electroblob.wizardry.util.SpellModifiers;
@@ -8,7 +9,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
@@ -20,7 +20,7 @@ import net.minecraft.world.World;
public class Blink extends Spell {
public Blink(){
super("blink", EnumAction.NONE, false);
super("blink", SpellActions.POINT, false);
addProperties(RANGE);
}
@@ -73,7 +73,6 @@ public class Blink extends Spell {
if(!world.isRemote) caster.setPositionAndUpdate(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
this.playSound(world, caster, ticksInUse, -1, modifiers);
caster.swingArm(hand);
return true;
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.entity.construct.EntityBubble;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -10,7 +11,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundEvent;
@@ -21,7 +21,7 @@ import net.minecraft.world.World;
public class Bubble extends SpellRay {
public Bubble(){
super("bubble", false, EnumAction.NONE);
super("bubble", false, SpellActions.POINT);
this.soundValues(0.5f, 1.1f, 0.2f);
addProperties(DURATION);
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.*;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -28,7 +28,7 @@ public class ChainLightning extends SpellRay {
public static final String TERTIARY_MAX_TARGETS = "tertiary_max_targets"; // This is per secondary target
public ChainLightning(){
super("chain_lightning", false, EnumAction.NONE);
super("chain_lightning", false, SpellActions.POINT);
this.aimAssist(0.6f);
this.soundValues(1, 1.7f, 0.2f);
addProperties(PRIMARY_DAMAGE, SECONDARY_DAMAGE, TERTIARY_DAMAGE, SECONDARY_RANGE, TERTIARY_RANGE,
@@ -3,6 +3,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.data.IVariable;
import electroblob.wizardry.data.Persistence;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
@@ -13,7 +14,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.Vec3d;
@@ -37,7 +37,7 @@ public class Charge extends Spell {
private static final double EXTRA_HIT_MARGIN = 1;
public Charge(){
super("charge", EnumAction.NONE, false);
super("charge", SpellActions.POINT, false);
addProperties(CHARGE_SPEED, DURATION, DAMAGE, KNOCKBACK_STRENGTH);
this.soundValues(0.6f, 1, 0);
}
@@ -4,6 +4,7 @@ import electroblob.wizardry.data.IStoredVariable;
import electroblob.wizardry.data.Persistence;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.ISpellCastingItem;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.misc.WizardryPathFinder;
import electroblob.wizardry.packet.PacketClairvoyance;
import electroblob.wizardry.packet.WizardryPacketHandler;
@@ -17,7 +18,6 @@ import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.Path;
import net.minecraft.pathfinding.PathNodeType;
@@ -41,7 +41,7 @@ public class Clairvoyance extends Spell {
public static final IStoredVariable<Integer> DIMENSION_KEY = IStoredVariable.StoredVariable.ofInt("clairvoyanceDimension", Persistence.ALWAYS);
public Clairvoyance(){
super("clairvoyance", EnumAction.BOW, false);
super("clairvoyance", SpellActions.POINT_UP, false);
addProperties(RANGE, DURATION);
WizardData.registerStoredVariables(LOCATION_KEY, DIMENSION_KEY);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.tileentity.TileEntityTimer;
@@ -8,7 +9,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -19,7 +19,7 @@ import java.util.List;
public class Cobwebs extends SpellRay {
public Cobwebs(){
super("cobwebs", false, EnumAction.NONE);
super("cobwebs", false, SpellActions.POINT);
this.ignoreLivingEntities(true);
addProperties(EFFECT_RADIUS, DURATION);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.tileentity.TileEntityTimer;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -20,7 +20,7 @@ public class ConjureBlock extends SpellRay {
private static final String BLOCK_LIFETIME = "block_lifetime";
public ConjureBlock(){
super("conjure_block", false, EnumAction.NONE);
super("conjure_block", false, SpellActions.POINT);
this.ignoreLivingEntities(true);
addProperties(BLOCK_LIFETIME);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.ParticleBuilder;
@@ -8,7 +9,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -18,7 +18,7 @@ import net.minecraft.world.World;
public class Containment extends SpellRay {
public Containment(){
super("containment", false, EnumAction.NONE);
super("containment", false, SpellActions.POINT);
this.soundValues(1, 1, 0.2f);
addProperties(EFFECT_DURATION, EFFECT_STRENGTH);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.ParticleBuilder;
@@ -8,7 +9,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -18,7 +18,7 @@ import net.minecraft.world.World;
public class CurseOfEnfeeblement extends SpellRay {
public CurseOfEnfeeblement(){
super("curse_of_enfeeblement", false, EnumAction.NONE);
super("curse_of_enfeeblement", false, SpellActions.POINT);
this.soundValues(1, 1.1f, 0.2f);
addProperties(EFFECT_STRENGTH);
}
@@ -4,6 +4,7 @@ import electroblob.wizardry.data.IStoredVariable;
import electroblob.wizardry.data.Persistence;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.integration.DamageSafetyChecker;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.*;
@@ -12,7 +13,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.potion.PotionEffect;
@@ -42,7 +42,7 @@ public class CurseOfSoulbinding extends SpellRay {
Persistence.DIMENSION_CHANGE);
public CurseOfSoulbinding(){
super("curse_of_soulbinding", false, EnumAction.NONE);
super("curse_of_soulbinding", false, SpellActions.POINT);
this.soundValues(1, 1.1f, 0.2f);
WizardData.registerStoredVariables(TARGETS_KEY);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -7,7 +8,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -17,7 +17,7 @@ import net.minecraft.world.World;
public class CurseOfUndeath extends SpellRay {
public CurseOfUndeath(){
super("curse_of_undeath", false, EnumAction.NONE);
super("curse_of_undeath", false, SpellActions.POINT);
this.soundValues(1, 1.1f, 0.2f);
addProperties(EFFECT_STRENGTH);
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.entity.living.EntityDecoy;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
@@ -16,7 +16,7 @@ public class Decoy extends Spell {
public static final String MOB_TRICK_CHANCE = "mob_trick_chance";
public Decoy(){
super("decoy", EnumAction.BOW, false);
super("decoy", SpellActions.SUMMON, false);
this.soundValues(1, 0.9f, 0.2f);
addProperties(DECOY_LIFETIME, MOB_TRICK_CHANCE);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -7,7 +8,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
@@ -22,7 +22,7 @@ public class Detonate extends SpellRay {
public static final String MAX_DAMAGE = "max_damage";
public Detonate(){
super("detonate", false, EnumAction.NONE);
super("detonate", false, SpellActions.POINT);
this.soundValues(4, 0.7f, 0.14f);
this.ignoreLivingEntities(true);
addProperties(MAX_DAMAGE, BLAST_RADIUS);
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.entity.projectile.EntityEmber;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -11,7 +12,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
@@ -26,7 +26,7 @@ public class Disintegration extends SpellRay {
public static final String EMBER_LIFETIME = "ember_lifetime";
public Disintegration(){
super("disintegration", false, EnumAction.NONE);
super("disintegration", false, SpellActions.POINT);
addProperties(DAMAGE, BURN_DURATION, EMBER_LIFETIME, EMBER_COUNT);
}
@@ -3,6 +3,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Settings;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.block.BlockCrystalOre;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.RelativeFacing;
@@ -13,7 +14,6 @@ import net.minecraft.block.BlockOre;
import net.minecraft.block.BlockRedstoneOre;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.EnumFacing;
@@ -22,7 +22,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Arrays;
import java.util.Comparator;
@@ -33,7 +32,7 @@ public class Divination extends Spell {
private static final float NUDGE_SPEED = 0.2f;
public Divination(){
super("divination", EnumAction.NONE, false);
super("divination", SpellActions.THRUST, false);
addProperties(RANGE);
}
@@ -2,6 +2,7 @@
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.construct.EntityEarthquake;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
@@ -9,7 +10,6 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
@@ -19,7 +19,7 @@
public static final String SPREAD_SPEED = "spread_speed";
public Earthquake(){
super("earthquake", EnumAction.NONE, EntityEarthquake::new, true);
super("earthquake", SpellActions.POINT_DOWN, EntityEarthquake::new, true);
this.soundValues(2, 1, 0);
this.overlap(true);
this.floor(true);
@@ -3,6 +3,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.event.SpellCastEvent;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.AllyDesignationSystem;
@@ -11,7 +12,6 @@ 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.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.MathHelper;
@@ -26,7 +26,7 @@ import java.util.List;
public class EmpoweringPresence extends Spell {
public EmpoweringPresence(){
super("empowering_presence", EnumAction.BOW, false);
super("empowering_presence", SpellActions.POINT_UP, false);
addProperties(EFFECT_RADIUS, EFFECT_DURATION, EFFECT_STRENGTH);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.entity.construct.EntityBubble;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -10,7 +11,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
@@ -22,7 +22,7 @@ public class Entrapment extends SpellRay {
public static final String DAMAGE_INTERVAL = "damage_interval";
public Entrapment(){
super("entrapment", false, EnumAction.NONE);
super("entrapment", false, SpellActions.POINT);
this.soundValues(1, 0.85f, 0.3f);
addProperties(EFFECT_DURATION, DAMAGE_INTERVAL);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -11,7 +12,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
@@ -22,7 +22,7 @@ import net.minecraft.world.World;
public class FireBreath extends SpellRay {
public FireBreath(){
super("fire_breath", true, EnumAction.NONE);
super("fire_breath", true, SpellActions.POINT);
this.particleVelocity(1);
this.particleJitter(0.3);
this.particleSpacing(0.25);
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -10,7 +11,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
@@ -21,7 +21,7 @@ import net.minecraft.world.World;
public class FlameRay extends SpellRay {
public FlameRay(){
super("flame_ray", true, EnumAction.NONE);
super("flame_ray", true, SpellActions.POINT);
this.particleVelocity(1);
this.particleSpacing(0.5);
addProperties(DAMAGE, BURN_DURATION);
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryEnchantments;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
@@ -10,7 +11,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
@@ -18,7 +18,7 @@ import net.minecraft.world.World;
public class FlamingWeapon extends Spell {
public FlamingWeapon(){
super("flaming_weapon", EnumAction.BOW, false);
super("flaming_weapon", SpellActions.IMBUE, false);
addProperties(EFFECT_DURATION);
}
@@ -1,11 +1,11 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
@@ -17,7 +17,7 @@ public class Flight extends Spell {
private static final double Y_NUDGE_ACCELERATION = 0.075;
public Flight(){
super("flight", EnumAction.NONE, true);
super("flight", SpellActions.POINT, true);
addProperties(SPEED, ACCELERATION);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.event.SpellCastEvent;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.AllyDesignationSystem;
@@ -9,7 +10,6 @@ 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.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.MathHelper;
@@ -22,7 +22,7 @@ import java.util.List;
public class FontOfMana extends Spell {
public FontOfMana(){
super("font_of_mana", EnumAction.BOW, false);
super("font_of_mana", SpellActions.POINT_UP, false);
this.soundValues(0.7f, 1.2f, 0.4f);
addProperties(EFFECT_RADIUS, EFFECT_DURATION, EFFECT_STRENGTH);
}
@@ -1,16 +1,16 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.entity.construct.EntityForcefield;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
public class Forcefield extends SpellConstruct<EntityForcefield> {
public Forcefield(){
super("forcefield", EnumAction.BOW, EntityForcefield::new, false);
super("forcefield", SpellActions.THRUST, EntityForcefield::new, false);
addProperties(Spell.EFFECT_RADIUS);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.block.BlockThorns;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.tileentity.TileEntityPlayerSaveTimed;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.util.EnumFacing;
@@ -25,7 +25,7 @@ import java.util.List;
public class ForestOfThorns extends Spell {
public ForestOfThorns(){
super("forest_of_thorns", EnumAction.BOW, false);
super("forest_of_thorns", SpellActions.SUMMON, false);
addProperties(EFFECT_RADIUS, DURATION, DAMAGE);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -9,14 +10,13 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class ForestsCurse extends SpellAreaEffect {
public ForestsCurse(){
super("forests_curse", EnumAction.BOW);
super("forests_curse", SpellActions.POINT_UP);
this.soundValues(1, 1.1f, 0.2f);
addProperties(DAMAGE, EFFECT_DURATION, EFFECT_STRENGTH);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.MagicDamage;
@@ -14,7 +15,6 @@ import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -25,7 +25,7 @@ import net.minecraft.world.World;
public class Freeze extends SpellRay {
public Freeze(){
super("freeze", false, EnumAction.NONE);
super("freeze", false, SpellActions.POINT);
this.soundValues(1, 1.4f, 0.4f);
addProperties(DAMAGE, EFFECT_DURATION, EFFECT_STRENGTH);
this.hitLiquids(true);
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryEnchantments;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
@@ -10,7 +11,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
@@ -24,7 +24,7 @@ public class FreezingWeapon extends Spell {
public static final String FREEZING_ARROW_NBT_KEY = "frostLevel";
public FreezingWeapon(){
super("freezing_weapon", EnumAction.BOW, false);
super("freezing_weapon", SpellActions.IMBUE, false);
addProperties(EFFECT_DURATION);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.MagicDamage;
@@ -13,7 +14,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundEvent;
@@ -25,7 +25,7 @@ import net.minecraft.world.World;
public class FrostRay extends SpellRay {
public FrostRay(){
super("frost_ray", true, EnumAction.NONE);
super("frost_ray", true, SpellActions.POINT);
this.particleVelocity(1);
this.particleSpacing(0.5);
addProperties(DAMAGE, EFFECT_DURATION, EFFECT_STRENGTH);
@@ -1,13 +1,13 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
@@ -18,7 +18,7 @@ public class Glide extends Spell {
public static final String ACCELERATION = "acceleration";
public Glide(){
super("glide", EnumAction.NONE, true);
super("glide", SpellActions.POINT_DOWN, true);
addProperties(SPEED, FALL_SPEED, ACCELERATION);
}
@@ -5,6 +5,7 @@ import electroblob.wizardry.data.IVariable;
import electroblob.wizardry.data.Persistence;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
@@ -17,7 +18,6 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.network.play.server.SPacketEntityVelocity;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.util.EnumFacing;
@@ -54,7 +54,7 @@ public class Grapple extends Spell {
protected static final double PARTICLE_JITTER = 0.04;
public Grapple(){
super("grapple", EnumAction.NONE, true);
super("grapple", SpellActions.GRAPPLE, true);
addProperties(RANGE, EXTENSION_SPEED, REEL_SPEED);
}
@@ -3,6 +3,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.EntityLevitatingBlock;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -14,7 +15,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.network.play.server.SPacketEntityVelocity;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.util.EnumFacing;
@@ -35,7 +35,7 @@ public class GreaterTelekinesis extends SpellRay {
private static final float UNDERSHOOT = 0.2f;
public GreaterTelekinesis(){
super("greater_telekinesis", true, EnumAction.NONE);
super("greater_telekinesis", true, SpellActions.POINT);
this.aimAssist(0.4f);
this.particleSpacing(1);
this.particleJitter(0.05);
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.AllyDesignationSystem;
import electroblob.wizardry.util.ParticleBuilder;
@@ -7,7 +8,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
@@ -16,7 +16,7 @@ import java.util.List;
public class GroupHeal extends Spell {
public GroupHeal(){
super("group_heal", EnumAction.BOW, false);
super("group_heal", SpellActions.POINT_UP, false);
this.soundValues(0.7f, 1.2f, 0.4f);
addProperties(EFFECT_RADIUS, HEALTH);
}
@@ -1,13 +1,13 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.block.IGrowable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemDye;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
@@ -18,7 +18,7 @@ import java.util.List;
public class GrowthAura extends Spell {
public GrowthAura(){
super("growth_aura", EnumAction.NONE, false);
super("growth_aura", SpellActions.POINT_DOWN, false);
addProperties(EFFECT_RADIUS);
soundValues(0.7f, 1.2f, 0.2f);
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -15,7 +15,7 @@ import net.minecraft.world.World;
public class HealAlly extends SpellRay {
public HealAlly(){
super("heal_ally", false, EnumAction.NONE);
super("heal_ally", false, SpellActions.POINT);
this.soundValues(0.7f, 1.2f, 0.4f);
addProperties(HEALTH);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.block.BlockStatue;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardrySounds;
@@ -11,7 +12,6 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
@@ -22,7 +22,7 @@ import java.util.List;
public class IceAge extends Spell {
public IceAge(){
super("ice_age", EnumAction.BOW, false);
super("ice_age", SpellActions.POINT_DOWN, false);
this.soundValues(0.7f, 1.0f, 0);
addProperties(EFFECT_RADIUS, EFFECT_DURATION);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.block.BlockStatue;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
@@ -19,7 +19,7 @@ import net.minecraft.world.World;
public class IceStatue extends SpellRay {
public IceStatue(){
super("ice_statue", false, EnumAction.NONE);
super("ice_statue", false, SpellActions.POINT);
this.soundValues(1, 1.4f, 0.4f);
addProperties(EFFECT_DURATION);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -9,7 +10,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
@@ -20,7 +20,7 @@ import net.minecraft.world.World;
public class Ignite extends SpellRay {
public Ignite(){
super("ignite", false, EnumAction.NONE);
super("ignite", false, SpellActions.POINT);
this.soundValues(1, 1, 0.4f);
addProperties(BURN_DURATION);
}
@@ -4,6 +4,7 @@ import electroblob.wizardry.Settings;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryEnchantments;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
@@ -12,20 +13,16 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Arrays;
public class ImbueWeapon extends Spell {
public ImbueWeapon(){
super("imbue_weapon", EnumAction.BOW, false);
super("imbue_weapon", SpellActions.IMBUE, false);
addProperties(EFFECT_DURATION);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.ParticleBuilder;
@@ -11,7 +12,6 @@ import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.RandomPositionGenerator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.potion.PotionEffect;
@@ -36,7 +36,7 @@ public class Intimidate extends Spell {
private static final double AVOID_DISTANCE_PER_LEVEL = 4;
public Intimidate(){
super("intimidate", EnumAction.BOW, false);
super("intimidate", SpellActions.SUMMON, false);
addProperties(EFFECT_RADIUS, EFFECT_DURATION, EFFECT_STRENGTH);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.AllyDesignationSystem;
import electroblob.wizardry.util.ParticleBuilder;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.MathHelper;
@@ -20,7 +20,7 @@ import java.util.List;
public class InvigoratingPresence extends Spell {
public InvigoratingPresence(){
super("invigorating_presence", EnumAction.BOW, false);
super("invigorating_presence", SpellActions.POINT_UP, false);
this.soundValues(0.7f, 1.2f, 0.4f);
addProperties(EFFECT_RADIUS, EFFECT_DURATION, EFFECT_STRENGTH);
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
@@ -18,7 +18,7 @@ public class InvokeWeather extends Spell {
public static final String THUNDERSTORM_CHANCE = "thunderstorm_chance";
public InvokeWeather(){
super("invoke_weather", EnumAction.BOW, false);
super("invoke_weather", SpellActions.POINT_UP, false);
addProperties(THUNDERSTORM_CHANCE);
soundValues(0.5f, 1, 0);
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.World;
@@ -17,7 +17,7 @@ public class Levitation extends Spell {
public static final String ACCELERATION = "acceleration";
public Levitation(){
super("levitation", EnumAction.BOW, true);
super("levitation", SpellActions.POINT_DOWN, true);
addProperties(SPEED, ACCELERATION);
soundValues(0.5f, 1, 0);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder;
@@ -8,7 +9,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
@@ -20,7 +20,7 @@ public class LifeDrain extends SpellRay {
public static final String HEAL_FACTOR = "heal_factor";
public LifeDrain(){
super("life_drain", true, EnumAction.NONE);
super("life_drain", true, SpellActions.POINT);
this.particleVelocity(-0.5);
this.particleSpacing(0.4);
addProperties(DAMAGE, HEAL_FACTOR);
@@ -1,13 +1,13 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.tileentity.TileEntityTimer;
import electroblob.wizardry.util.RayTracer;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
@@ -16,7 +16,7 @@ import net.minecraft.world.World;
public class Light extends Spell {
public Light(){
super("light", EnumAction.NONE, false);
super("light", SpellActions.POINT, false);
addProperties(RANGE, DURATION);
}
@@ -47,7 +47,6 @@ public class Light extends Spell {
}
}
caster.swingArm(hand);
this.playSound(world, caster, ticksInUse, -1, modifiers);
return true;
}
@@ -68,7 +67,7 @@ public class Light extends Spell {
((TileEntityTimer)world.getTileEntity(pos)).setLifetime(lifetime);
}
}
caster.swingArm(hand);
this.playSound(world, caster, ticksInUse, -1, modifiers);
return true;
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -20,7 +20,7 @@ public class LightningBolt extends SpellRay {
public static final String NBT_KEY = "summoningPlayer";
public LightningBolt(){
super("lightning_bolt", false, EnumAction.NONE);
super("lightning_bolt", false, SpellActions.POINT);
this.ignoreLivingEntities(true);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.*;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -7,7 +8,6 @@ import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.network.play.server.SPacketEntityVelocity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundEvent;
@@ -21,7 +21,7 @@ public class LightningPulse extends Spell {
public static final String REPULSION_VELOCITY = "repulsion_velocity";
public LightningPulse(){
super("lightning_pulse", EnumAction.NONE, false);
super("lightning_pulse", SpellActions.POINT_DOWN, false);
addProperties(EFFECT_RADIUS, DAMAGE, REPULSION_VELOCITY);
this.soundValues(2, 1, 0);
}
@@ -74,8 +74,7 @@ public class LightningPulse extends Spell {
+ WizardryUtilities.ANTI_Z_FIGHTING_OFFSET, caster.posZ)
.scale(modifiers.get(WizardryItems.blast_upgrade)).spawn(world);
}
caster.swingArm(hand);
this.playSound(world, caster, ticksInUse, -1, modifiers);
return true;
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
@@ -20,7 +20,7 @@ import net.minecraft.world.World;
public class LightningRay extends SpellRay {
public LightningRay(){
super("lightning_ray", true, EnumAction.NONE);
super("lightning_ray", true, SpellActions.POINT);
this.aimAssist(0.6f);
addProperties(DAMAGE);
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.*;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
@@ -29,7 +29,7 @@ public class LightningWeb extends SpellRay {
public static final String TERTIARY_MAX_TARGETS = "tertiary_max_targets"; // This is per secondary target
public LightningWeb(){
super("lightning_web", true, EnumAction.NONE);
super("lightning_web", true, SpellActions.POINT);
this.aimAssist(0.6f);
addProperties(PRIMARY_DAMAGE, SECONDARY_DAMAGE, TERTIARY_DAMAGE, SECONDARY_RANGE, TERTIARY_RANGE,
SECONDARY_MAX_TARGETS, TERTIARY_MAX_TARGETS);
@@ -4,6 +4,7 @@ import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.living.*;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.NBTExtras;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -14,7 +15,6 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.item.EnumAction;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -49,7 +49,7 @@ public class Metamorphosis extends SpellRay {
}
public Metamorphosis(){
super("metamorphosis", false, EnumAction.NONE);
super("metamorphosis", false, SpellActions.POINT);
this.soundValues(0.5f, 1f, 0);
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.entity.EntityMeteor;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -18,7 +18,7 @@ public class Meteor extends SpellRay {
public static final String BLAST_STRENGTH = "blast_strength";
public Meteor(){
super("meteor", false, EnumAction.NONE);
super("meteor", false, SpellActions.POINT);
this.soundValues(3, 1, 0);
this.ignoreLivingEntities(true);
addProperties(BLAST_STRENGTH);
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.living.EntityEvilWizard;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.registry.WizardrySounds;
@@ -15,7 +16,6 @@ import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
@@ -40,7 +40,7 @@ public class MindControl extends SpellRay {
public static final String NBT_KEY = "controllingEntity";
public MindControl(){
super("mind_control", false, EnumAction.NONE);
super("mind_control", false, SpellActions.POINT);
addProperties(EFFECT_DURATION);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.ParticleBuilder;
@@ -11,7 +12,6 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -26,7 +26,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class MindTrick extends SpellRay {
public MindTrick(){
super("mind_trick", false, EnumAction.NONE);
super("mind_trick", false, SpellActions.POINT);
this.soundValues(0.7f, 1, 0.4f);
addProperties(EFFECT_DURATION);
}
@@ -4,6 +4,7 @@ import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.item.ISpellCastingItem;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -15,7 +16,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -39,7 +39,7 @@ public class Mine extends SpellRay {
}
public Mine(){
super("mine", false, EnumAction.NONE);
super("mine", false, SpellActions.POINT);
this.ignoreLivingEntities(true);
this.particleSpacing(0.5);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
@@ -13,7 +14,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -34,7 +34,7 @@ public class Paralysis extends SpellRay {
private static final String CRITICAL_HEALTH = "critical_health";
public Paralysis(){
super("paralysis", false, EnumAction.NONE);
super("paralysis", false, SpellActions.POINT);
addProperties(DAMAGE, EFFECT_DURATION, CRITICAL_HEALTH);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.block.BlockStatue;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -21,7 +21,7 @@ public class Petrify extends SpellRay {
public static final String MINIMUM_EFFECT_DURATION = "minimum_effect_duration";
public Petrify(){
super("petrify", false, EnumAction.NONE);
super("petrify", false, SpellActions.POINT);
this.soundValues(1, 1.1f, 0.2f);
addProperties(MINIMUM_EFFECT_DURATION);
}
@@ -2,12 +2,12 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.RayTracer;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
@@ -21,7 +21,7 @@ public class PhaseStep extends Spell {
public static final String WALL_THICKNESS = "wall_thickness";
public PhaseStep(){
super("phase_step", EnumAction.NONE, false);
super("phase_step", SpellActions.POINT, false);
addProperties(RANGE, WALL_THICKNESS);
}
@@ -78,7 +78,6 @@ public class PhaseStep extends Spell {
caster.setPositionAndUpdate(pos1.getX() + 0.5, pos1.getY() + 0.5, pos1.getZ() + 0.5);
}
caster.swingArm(hand);
this.playSound(world, caster, ticksInUse, -1, modifiers);
return true;
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.*;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -9,7 +10,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
@@ -20,7 +20,7 @@ import java.util.List;
public class PlagueOfDarkness extends Spell {
public PlagueOfDarkness(){
super("plague_of_darkness", EnumAction.BOW, false);
super("plague_of_darkness", SpellActions.POINT_DOWN, false);
addProperties(EFFECT_RADIUS, DAMAGE, EFFECT_DURATION, EFFECT_STRENGTH);
soundValues(1, 1.1f, 0.2f);
}
@@ -2,10 +2,14 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Settings;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
@@ -16,7 +20,7 @@ public class PocketFurnace extends Spell {
public static final String ITEMS_SMELTED = "items_smelted";
public PocketFurnace(){
super("pocket_furnace", EnumAction.BOW, false);
super("pocket_furnace", SpellActions.IMBUE, false);
addProperties(ITEMS_SMELTED);
soundValues(1, 0.75f, 0);
}
@@ -2,16 +2,16 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.WizardryGuiHandler;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
public class PocketWorkbench extends Spell {
public PocketWorkbench(){
super("pocket_workbench", EnumAction.BOW, false);
super("pocket_workbench", SpellActions.IMBUE, false);
}
@Override
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -12,7 +13,6 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -23,7 +23,7 @@ import net.minecraft.world.World;
public class Poison extends SpellRay {
public Poison(){
super("poison", false, EnumAction.NONE);
super("poison", false, SpellActions.POINT);
this.soundValues(1, 1.1f, 0.2f);
addProperties(DAMAGE, EFFECT_DURATION, EFFECT_STRENGTH);
}
@@ -11,6 +11,7 @@ import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.entity.living.*;
import electroblob.wizardry.entity.projectile.*;
import electroblob.wizardry.integration.DamageSafetyChecker;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.packet.PacketControlInput;
import electroblob.wizardry.packet.PacketPossession;
import electroblob.wizardry.packet.WizardryPacketHandler;
@@ -38,7 +39,6 @@ import net.minecraft.init.Enchantments;
import net.minecraft.init.Items;
import net.minecraft.init.PotionTypes;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
@@ -121,7 +121,7 @@ public class Possession extends SpellRay {
}
public Possession(){
super("possession", false, EnumAction.NONE);
super("possession", false, SpellActions.POINT);
addProperties(EFFECT_DURATION, CRITICAL_HEALTH);
}
@@ -146,7 +146,7 @@ public class Possession extends SpellRay {
if(!shootSpell(world, origin, look, caster, ticksInUse, modifiers)) return false;
if(casterSwingsArm(world, caster, hand, ticksInUse, modifiers)) caster.swingArm(hand);
// if(casterSwingsArm(world, caster, hand, ticksInUse, modifiers)) caster.swingArm(hand);
this.playSound(world, caster, ticksInUse, -1, modifiers, "possess"); // TODO: There must be a better way...
return true;
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -11,7 +12,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundEvent;
@@ -27,7 +27,7 @@ public class RayOfPurification extends SpellRay {
public static final String UNDEAD_DAMAGE_MULTIPLIER = "undead_damage_multiplier";
public RayOfPurification(){
super("ray_of_purification", true, EnumAction.NONE);
super("ray_of_purification", true, SpellActions.POINT);
addProperties(DAMAGE, EFFECT_DURATION, BURN_DURATION, UNDEAD_DAMAGE_MULTIPLIER);
}
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.ISpellCastingItem;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.packet.PacketResurrection;
import electroblob.wizardry.packet.WizardryPacketHandler;
import electroblob.wizardry.registry.Spells;
@@ -10,7 +11,6 @@ import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.MathHelper;
@@ -28,7 +28,7 @@ public class Resurrection extends Spell {
private static final String POTION_CORE_FIX_NBT_KEY = "Potion Core - Health Fix";
public Resurrection(){
super("resurrection", EnumAction.NONE, false);
super("resurrection", SpellActions.SUMMON, false);
addProperties(EFFECT_RADIUS, WAIT_TIME);
}
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.util.EnumFacing;
@@ -24,7 +24,7 @@ public class Reversal extends SpellRay {
public static final String REVERSED_EFFECTS = "reversed_effects";
public Reversal(){
super("reversal", false, EnumAction.NONE);
super("reversal", false, SpellActions.POINT);
addProperties(REVERSED_EFFECTS);
}
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.*;
import electroblob.wizardry.util.MagicDamage.DamageType;
@@ -11,7 +12,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.network.play.server.SPacketEntityVelocity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
@@ -27,7 +27,7 @@ public class Shockwave extends Spell {
private static final double EPICENTRE_RADIUS = 1;
public Shockwave(){
super("shockwave", EnumAction.BOW, false);
super("shockwave", SpellActions.POINT_DOWN, false);
this.soundValues(2, 0.5f, 0);
addProperties(BLAST_RADIUS, DAMAGE, MAX_REPULSION_VELOCITY);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.NBTExtras;
import electroblob.wizardry.util.SpellModifiers;
@@ -10,7 +11,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityShulkerBullet;
import net.minecraft.item.EnumAction;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.tileentity.TileEntityDispenser;
@@ -26,7 +26,7 @@ import java.util.List;
public class ShulkerBullet extends Spell {
public ShulkerBullet(){
super("shulker_bullet", EnumAction.NONE, false);
super("shulker_bullet", SpellActions.POINT_DOWN, false);
this.soundValues(2, 1, 0.3f);
addProperties(RANGE);
}
@@ -2,11 +2,11 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
@@ -22,7 +22,7 @@ public class SixthSense extends Spell {
public static final ResourceLocation SHADER = new ResourceLocation(Wizardry.MODID, "shaders/post/sixth_sense.json");
public SixthSense(){
super("sixth_sense", EnumAction.BOW, false);
super("sixth_sense", SpellActions.POINT_UP, false);
addProperties(EFFECT_DURATION, EFFECT_RADIUS);
soundValues(1, 1.1f, 0.2f);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.entity.living.EntityMagicSlime;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -10,7 +11,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
@@ -21,7 +21,7 @@ import net.minecraft.world.World;
public class Slime extends SpellRay {
public Slime(){
super("slime", false, EnumAction.NONE);
super("slime", false, SpellActions.POINT);
addProperties(DURATION);
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.tileentity.TileEntityPlayerSave;
import electroblob.wizardry.util.ParticleBuilder;
@@ -8,7 +9,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -17,7 +17,7 @@ import net.minecraft.world.World;
public class Snare extends SpellRay {
public Snare(){
super("snare", false, EnumAction.NONE);
super("snare", false, SpellActions.POINT);
this.soundValues(1, 1.4f, 0.4f);
this.ignoreLivingEntities(true);
addProperties(DAMAGE, EFFECT_DURATION, EFFECT_STRENGTH);
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.tileentity.TileEntityTimer;
@@ -7,7 +8,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.AxisDirection;
import net.minecraft.util.EnumHand;
@@ -20,7 +20,7 @@ public class SpectralPathway extends Spell {
public static final String LENGTH = "length";
public SpectralPathway(){
super("spectral_pathway", EnumAction.BOW, false);
super("spectral_pathway", SpellActions.POINT, false);
addProperties(LENGTH, DURATION);
}
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.SpellModifiers;
@@ -8,7 +9,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ITickable;
@@ -32,7 +32,7 @@ public class SpeedTime extends Spell {
public static final String EXTRA_TICKS = "extra_ticks";
public SpeedTime(){
super("speed_time", EnumAction.BOW, true);
super("speed_time", SpellActions.POINT_UP, true);
addProperties(EFFECT_RADIUS, TIME_INCREMENT, EXTRA_TICKS);
}
@@ -4,13 +4,13 @@ import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.living.ISpellCaster;
import electroblob.wizardry.entity.projectile.EntityMagicArrow;
import electroblob.wizardry.entity.projectile.EntityMagicProjectile;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -56,7 +56,7 @@ public class SpellArrow<T extends EntityMagicArrow> extends Spell {
}
public SpellArrow(String modID, String name, Function<World, T> arrowFactory){
super(modID, name, EnumAction.NONE, false);
super(modID, name, SpellActions.POINT, false);
this.arrowFactory = arrowFactory;
this.addProperties(RANGE);
this.npcSelector((e, o) -> true);
@@ -101,8 +101,6 @@ public class SpellArrow<T extends EntityMagicArrow> extends Spell {
// Spawns the projectile in the world
world.spawnEntity(projectile);
}
caster.swingArm(hand);
this.playSound(world, caster, ticksInUse, -1, modifiers);
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -8,7 +9,6 @@ import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntityDispenser;
@@ -63,7 +63,7 @@ public class SpellBuff extends Spell {
@SafeVarargs
public SpellBuff(String modID, String name, float r, float g, float b, Supplier<Potion>... effects){
super(modID, name, EnumAction.BOW, false);
super(modID, name, SpellActions.POINT_UP, false);
this.effects = effects;
this.r = r;
this.g = g;
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.IConjuredItem;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
@@ -46,7 +46,7 @@ public class SpellConjuration extends Spell {
}
public SpellConjuration(String modID, String name, Item item){
super(modID, name, EnumAction.BOW, false);
super(modID, name, SpellActions.IMBUE, false);
this.item = item;
addProperties(ITEM_LIFETIME);
}
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.construct.EntityMagicConstruct;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.RayTracer;
import electroblob.wizardry.util.SpellModifiers;
@@ -9,7 +10,6 @@ import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -53,7 +53,7 @@ public class SpellConstructRanged<T extends EntityMagicConstruct> extends SpellC
}
public SpellConstructRanged(String modID, String name, Function<World, T> constructFactory, boolean permanent){
super(modID, name, EnumAction.NONE, constructFactory, permanent);
super(modID, name, SpellActions.POINT, constructFactory, permanent);
this.addProperties(RANGE);
this.npcSelector((e, o) -> true);
}
@@ -118,8 +118,7 @@ public class SpellConstructRanged<T extends EntityMagicConstruct> extends SpellC
}else{
return false;
}
caster.swingArm(hand);
this.playSound(world, caster, ticksInUse, -1, modifiers);
return true;
}
@@ -2,6 +2,7 @@ package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.living.ISummonedCreature;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
@@ -13,7 +14,6 @@ import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -64,7 +64,7 @@ public class SpellMinion<T extends EntityLiving & ISummonedCreature> extends Spe
}
public SpellMinion(String modID, String name, Function<World, T> minionFactory){
super(modID, name, EnumAction.BOW, false);
super(modID, name, SpellActions.SUMMON, false);
this.minionFactory = minionFactory;
addProperties(MINION_LIFETIME, MINION_COUNT, SUMMON_RADIUS);
this.npcSelector((e, o) -> true);
@@ -161,10 +161,13 @@ public abstract class SpellRay extends Spell {
Vec3d look = caster.getLookVec();
Vec3d origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight() - Y_OFFSET, caster.posZ);
if(!this.isContinuous && world.isRemote && !Wizardry.proxy.isFirstPerson(caster)){
origin = origin.add(look.scale(1.2));
}
if(!shootSpell(world, origin, look, caster, ticksInUse, modifiers)) return false;
if(casterSwingsArm(world, caster, hand, ticksInUse, modifiers)) caster.swingArm(hand);
//if(casterSwingsArm(world, caster, hand, ticksInUse, modifiers)) caster.swingArm(hand);
this.playSound(world, caster, ticksInUse, -1, modifiers);
return true;
}
@@ -249,7 +252,7 @@ public abstract class SpellRay extends Spell {
protected boolean casterSwingsArm(World world, EntityLivingBase caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
return !this.isContinuous;
}
/** Takes care of the shared stuff for the three casting methods. This is mainly for internal use. */
protected boolean shootSpell(World world, Vec3d origin, Vec3d direction, @Nullable EntityLivingBase caster, int ticksInUse, SpellModifiers modifiers){
@@ -267,6 +270,7 @@ public abstract class SpellRay extends Spell {
// Doesn't matter which way round these are, they're mutually exclusive
if(rayTrace.typeOfHit == RayTraceResult.Type.ENTITY){
// Do whatever the spell does when it hits an entity
// FIXME: Some spells (e.g. lightning web) seem to not render when aimed at item frames
flag = onEntityHit(world, rayTrace.entityHit, rayTrace.hitVec, caster, origin, ticksInUse, modifiers);
// If the spell succeeded, clip the particles to the correct distance so they don't go through the entity
if(flag) range = origin.distanceTo(rayTrace.hitVec);
@@ -1,12 +1,12 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.item.SpellActions;
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.monster.EntityIronGolem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -14,7 +14,7 @@ import net.minecraft.world.World;
public class SummonIronGolem extends Spell {
public SummonIronGolem(){
super("summon_iron_golem", EnumAction.BOW, false);
super("summon_iron_golem", SpellActions.SUMMON, false);
addProperties(SpellMinion.SUMMON_RADIUS);
soundValues(1, 1.1f, 0.2f);
}
@@ -1,13 +1,13 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.SpellActions;
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.monster.EntitySnowman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -15,7 +15,7 @@ import net.minecraft.world.World;
public class SummonSnowGolem extends Spell {
public SummonSnowGolem(){
super("summon_snow_golem", EnumAction.BOW, false);
super("summon_snow_golem", SpellActions.SUMMON, false);
this.soundValues(1, 1, 0.4f);
addProperties(SpellMinion.SUMMON_RADIUS);
}
@@ -4,6 +4,7 @@ import electroblob.wizardry.data.IStoredVariable;
import electroblob.wizardry.data.Persistence;
import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.entity.living.EntitySpiritHorse;
import electroblob.wizardry.item.SpellActions;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import electroblob.wizardry.util.WizardryUtilities.Operations;
@@ -13,7 +14,6 @@ import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttribute;
import net.minecraft.entity.passive.AbstractHorse;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -36,7 +36,7 @@ public class SummonSpiritHorse extends Spell {
public static final IStoredVariable<UUID> UUID_KEY = IStoredVariable.StoredVariable.ofUUID("spiritHorseUUID", Persistence.ALWAYS);
public SummonSpiritHorse(){
super("summon_spirit_horse", EnumAction.BOW, false);
super("summon_spirit_horse", SpellActions.SUMMON, false);
addProperties(SpellMinion.SUMMON_RADIUS);
soundValues(0.7f, 1.2f, 0.4f);
WizardData.registerStoredVariables(UUID_KEY);

Some files were not shown because too many files have changed in this diff Show More