diff --git a/src/main/java/electroblob/wizardry/CommonProxy.java b/src/main/java/electroblob/wizardry/CommonProxy.java index ff568f0a..7a452957 100644 --- a/src/main/java/electroblob/wizardry/CommonProxy.java +++ b/src/main/java/electroblob/wizardry/CommonProxy.java @@ -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 getSpellHUDSkins(){ return null; diff --git a/src/main/java/electroblob/wizardry/Wizardry.java b/src/main/java/electroblob/wizardry/Wizardry.java index 07ce43cf..0c9d7b50 100644 --- a/src/main/java/electroblob/wizardry/Wizardry.java +++ b/src/main/java/electroblob/wizardry/Wizardry.java @@ -174,6 +174,7 @@ public class Wizardry { @EventHandler public void postInit(FMLPostInitializationEvent event){ proxy.initialiseLayers(); + proxy.initialiseAnimations(); } @EventHandler diff --git a/src/main/java/electroblob/wizardry/client/ClientProxy.java b/src/main/java/electroblob/wizardry/client/ClientProxy.java index d4d68860..c64b918d 100644 --- a/src/main/java/electroblob/wizardry/client/ClientProxy.java +++ b/src/main/java/electroblob/wizardry/client/ClientProxy.java @@ -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(){ diff --git a/src/main/java/electroblob/wizardry/client/animation/ActionAnimation.java b/src/main/java/electroblob/wizardry/client/animation/ActionAnimation.java new file mode 100644 index 00000000..c6eeeeb8 --- /dev/null +++ b/src/main/java/electroblob/wizardry/client/animation/ActionAnimation.java @@ -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); + } + } + }); + + } + +} diff --git a/src/main/java/electroblob/wizardry/client/animation/Animation.java b/src/main/java/electroblob/wizardry/client/animation/Animation.java new file mode 100644 index 00000000..71be8a42 --- /dev/null +++ b/src/main/java/electroblob/wizardry/client/animation/Animation.java @@ -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. 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. + * @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; + } + +} diff --git a/src/main/java/electroblob/wizardry/client/animation/ModelRendererExtended.java b/src/main/java/electroblob/wizardry/client/animation/ModelRendererExtended.java new file mode 100644 index 00000000..ba6cc2cb --- /dev/null +++ b/src/main/java/electroblob/wizardry/client/animation/ModelRendererExtended.java @@ -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. + *

+ * {@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 is unable to change any + * individual {@link ModelRenderer} fields - 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); + } + +} diff --git a/src/main/java/electroblob/wizardry/client/animation/PlayerAnimator.java b/src/main/java/electroblob/wizardry/client/animation/PlayerAnimator.java new file mode 100644 index 00000000..71ea7e57 --- /dev/null +++ b/src/main/java/electroblob/wizardry/client/animation/PlayerAnimator.java @@ -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 animations = new ArrayList<>(); + + /** Stores all registered layer renderers for lazy-loading of armour models later. */ + private static final Map>> playerLayers = new HashMap<>(); + /** Stores the main model for each renderer plus all models for registered layer renderers. */ + private static final Map> 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 models = new ArrayList<>(); + ModelRendererExtended.wrap(renderer.getMainModel()); + models.add(renderer.getMainModel()); + + try { + + List> layers = (List>)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 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 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? +// } + +} diff --git a/src/main/java/electroblob/wizardry/client/model/BakedModelGenerateOverrides.java b/src/main/java/electroblob/wizardry/client/model/BakedModelGenerateOverrides.java new file mode 100644 index 00000000..32d08e4a --- /dev/null +++ b/src/main/java/electroblob/wizardry/client/model/BakedModelGenerateOverrides.java @@ -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. + *

+ * To use this system in a model file:

+ * 1. Make a base model file and define the item overrides in it. This model must be placed in the folder + * {@code models/item/override_generators} (unfortunately the folder has to be predefined, see below).
+ * 2. Make the model files your overrides point to. These should define everything about the model except textures.
+ * 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).
+ *

+ * 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 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 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 overrides = vanillaRefModel.getOverrides(); + Map 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(); + } + +} diff --git a/src/main/java/electroblob/wizardry/client/model/ItemOverrideListMapped.java b/src/main/java/electroblob/wizardry/client/model/ItemOverrideListMapped.java new file mode 100644 index 00000000..2e8837bc --- /dev/null +++ b/src/main/java/electroblob/wizardry/client/model/ItemOverrideListMapped.java @@ -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 replacementMap; + + public ItemOverrideListMapped(List overrides, Map 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; + } +} diff --git a/src/main/java/electroblob/wizardry/client/model/WizardryModels.java b/src/main/java/electroblob/wizardry/client/model/WizardryModels.java index eae2ecc9..5dc88bc8 100644 --- a/src/main/java/electroblob/wizardry/client/model/WizardryModels.java +++ b/src/main/java/electroblob/wizardry/client/model/WizardryModels.java @@ -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")); } } diff --git a/src/main/java/electroblob/wizardry/client/particle/ParticleTargeted.java b/src/main/java/electroblob/wizardry/client/particle/ParticleTargeted.java index cd89d0af..b7942a75 100644 --- a/src/main/java/electroblob/wizardry/client/particle/ParticleTargeted.java +++ b/src/main/java/electroblob/wizardry/client/particle/ParticleTargeted.java @@ -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 instead of overriding {@code renderParticle} directly, and inside render the particle along diff --git a/src/main/java/electroblob/wizardry/client/particle/ParticleVine.java b/src/main/java/electroblob/wizardry/client/particle/ParticleVine.java index 79c9d872..21f336f2 100644 --- a/src/main/java/electroblob/wizardry/client/particle/ParticleVine.java +++ b/src/main/java/electroblob/wizardry/client/particle/ParticleVine.java @@ -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){ diff --git a/src/main/java/electroblob/wizardry/item/ItemWand.java b/src/main/java/electroblob/wizardry/item/ItemWand.java index 8c80cb75..71c00ecb 100644 --- a/src/main/java/electroblob/wizardry/item/ItemWand.java +++ b/src/main/java/electroblob/wizardry/item/ItemWand.java @@ -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 diff --git a/src/main/java/electroblob/wizardry/item/SpellActions.java b/src/main/java/electroblob/wizardry/item/SpellActions.java new file mode 100644 index 00000000..fe8aa7c0 --- /dev/null +++ b/src/main/java/electroblob/wizardry/item/SpellActions.java @@ -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 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 getSpellActions(){ + return Collections.unmodifiableList(spellActions); + } + +} diff --git a/src/main/java/electroblob/wizardry/registry/Spells.java b/src/main/java/electroblob/wizardry/registry/Spells.java index 85ee05a1..d81fd47d 100644 --- a/src/main/java/electroblob/wizardry/registry/Spells.java +++ b/src/main/java/electroblob/wizardry/registry/Spells.java @@ -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()); diff --git a/src/main/java/electroblob/wizardry/spell/Arc.java b/src/main/java/electroblob/wizardry/spell/Arc.java index adfe2670..ab961d1c 100644 --- a/src/main/java/electroblob/wizardry/spell/Arc.java +++ b/src/main/java/electroblob/wizardry/spell/Arc.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/ArcaneJammer.java b/src/main/java/electroblob/wizardry/spell/ArcaneJammer.java index cbf02353..7f2121d1 100644 --- a/src/main/java/electroblob/wizardry/spell/ArcaneJammer.java +++ b/src/main/java/electroblob/wizardry/spell/ArcaneJammer.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/ArcaneLock.java b/src/main/java/electroblob/wizardry/spell/ArcaneLock.java index a93264e2..6d22d37a 100644 --- a/src/main/java/electroblob/wizardry/spell/ArcaneLock.java +++ b/src/main/java/electroblob/wizardry/spell/ArcaneLock.java @@ -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; } diff --git a/src/main/java/electroblob/wizardry/spell/Banish.java b/src/main/java/electroblob/wizardry/spell/Banish.java index e12fe1ff..50cd6701 100644 --- a/src/main/java/electroblob/wizardry/spell/Banish.java +++ b/src/main/java/electroblob/wizardry/spell/Banish.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Blink.java b/src/main/java/electroblob/wizardry/spell/Blink.java index fcc4975e..841b025b 100644 --- a/src/main/java/electroblob/wizardry/spell/Blink.java +++ b/src/main/java/electroblob/wizardry/spell/Blink.java @@ -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; } diff --git a/src/main/java/electroblob/wizardry/spell/Bubble.java b/src/main/java/electroblob/wizardry/spell/Bubble.java index 2ac47406..499b4ca0 100644 --- a/src/main/java/electroblob/wizardry/spell/Bubble.java +++ b/src/main/java/electroblob/wizardry/spell/Bubble.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/ChainLightning.java b/src/main/java/electroblob/wizardry/spell/ChainLightning.java index 83b3df2f..1a31f86f 100644 --- a/src/main/java/electroblob/wizardry/spell/ChainLightning.java +++ b/src/main/java/electroblob/wizardry/spell/ChainLightning.java @@ -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, diff --git a/src/main/java/electroblob/wizardry/spell/Charge.java b/src/main/java/electroblob/wizardry/spell/Charge.java index d6e9a4df..20725625 100644 --- a/src/main/java/electroblob/wizardry/spell/Charge.java +++ b/src/main/java/electroblob/wizardry/spell/Charge.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Clairvoyance.java b/src/main/java/electroblob/wizardry/spell/Clairvoyance.java index c5ffba8b..a2d7c868 100644 --- a/src/main/java/electroblob/wizardry/spell/Clairvoyance.java +++ b/src/main/java/electroblob/wizardry/spell/Clairvoyance.java @@ -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 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); } diff --git a/src/main/java/electroblob/wizardry/spell/Cobwebs.java b/src/main/java/electroblob/wizardry/spell/Cobwebs.java index 9d2367a1..857f7317 100644 --- a/src/main/java/electroblob/wizardry/spell/Cobwebs.java +++ b/src/main/java/electroblob/wizardry/spell/Cobwebs.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/ConjureBlock.java b/src/main/java/electroblob/wizardry/spell/ConjureBlock.java index 50ce61d1..c4a3bc56 100644 --- a/src/main/java/electroblob/wizardry/spell/ConjureBlock.java +++ b/src/main/java/electroblob/wizardry/spell/ConjureBlock.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Containment.java b/src/main/java/electroblob/wizardry/spell/Containment.java index cc9c0b71..ddedbe53 100644 --- a/src/main/java/electroblob/wizardry/spell/Containment.java +++ b/src/main/java/electroblob/wizardry/spell/Containment.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/CurseOfEnfeeblement.java b/src/main/java/electroblob/wizardry/spell/CurseOfEnfeeblement.java index a6a5f2e1..29fcc938 100644 --- a/src/main/java/electroblob/wizardry/spell/CurseOfEnfeeblement.java +++ b/src/main/java/electroblob/wizardry/spell/CurseOfEnfeeblement.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java b/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java index e47b7865..e36bbc36 100644 --- a/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java +++ b/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/CurseOfUndeath.java b/src/main/java/electroblob/wizardry/spell/CurseOfUndeath.java index f97e1148..eec32c73 100644 --- a/src/main/java/electroblob/wizardry/spell/CurseOfUndeath.java +++ b/src/main/java/electroblob/wizardry/spell/CurseOfUndeath.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Decoy.java b/src/main/java/electroblob/wizardry/spell/Decoy.java index 46f21c4e..a667e8a7 100644 --- a/src/main/java/electroblob/wizardry/spell/Decoy.java +++ b/src/main/java/electroblob/wizardry/spell/Decoy.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Detonate.java b/src/main/java/electroblob/wizardry/spell/Detonate.java index 34a28d4f..08692d80 100644 --- a/src/main/java/electroblob/wizardry/spell/Detonate.java +++ b/src/main/java/electroblob/wizardry/spell/Detonate.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/Disintegration.java b/src/main/java/electroblob/wizardry/spell/Disintegration.java index 45d89781..36afaa0c 100644 --- a/src/main/java/electroblob/wizardry/spell/Disintegration.java +++ b/src/main/java/electroblob/wizardry/spell/Disintegration.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Divination.java b/src/main/java/electroblob/wizardry/spell/Divination.java index 79c69440..be21e09f 100644 --- a/src/main/java/electroblob/wizardry/spell/Divination.java +++ b/src/main/java/electroblob/wizardry/spell/Divination.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Earthquake.java b/src/main/java/electroblob/wizardry/spell/Earthquake.java index 2c9ae2b8..50c7f901 100644 --- a/src/main/java/electroblob/wizardry/spell/Earthquake.java +++ b/src/main/java/electroblob/wizardry/spell/Earthquake.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/EmpoweringPresence.java b/src/main/java/electroblob/wizardry/spell/EmpoweringPresence.java index 7fcbaf18..093124e5 100644 --- a/src/main/java/electroblob/wizardry/spell/EmpoweringPresence.java +++ b/src/main/java/electroblob/wizardry/spell/EmpoweringPresence.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Entrapment.java b/src/main/java/electroblob/wizardry/spell/Entrapment.java index 7f20fbd8..107eba36 100644 --- a/src/main/java/electroblob/wizardry/spell/Entrapment.java +++ b/src/main/java/electroblob/wizardry/spell/Entrapment.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/FireBreath.java b/src/main/java/electroblob/wizardry/spell/FireBreath.java index 338f375d..f4242e29 100644 --- a/src/main/java/electroblob/wizardry/spell/FireBreath.java +++ b/src/main/java/electroblob/wizardry/spell/FireBreath.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/FlameRay.java b/src/main/java/electroblob/wizardry/spell/FlameRay.java index b13e2e45..35cf6ca6 100644 --- a/src/main/java/electroblob/wizardry/spell/FlameRay.java +++ b/src/main/java/electroblob/wizardry/spell/FlameRay.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/FlamingWeapon.java b/src/main/java/electroblob/wizardry/spell/FlamingWeapon.java index b77f4e9a..6fbfcd61 100644 --- a/src/main/java/electroblob/wizardry/spell/FlamingWeapon.java +++ b/src/main/java/electroblob/wizardry/spell/FlamingWeapon.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Flight.java b/src/main/java/electroblob/wizardry/spell/Flight.java index 9e2d0d8a..175070e7 100644 --- a/src/main/java/electroblob/wizardry/spell/Flight.java +++ b/src/main/java/electroblob/wizardry/spell/Flight.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/FontOfMana.java b/src/main/java/electroblob/wizardry/spell/FontOfMana.java index 4dc20f74..abf10b97 100644 --- a/src/main/java/electroblob/wizardry/spell/FontOfMana.java +++ b/src/main/java/electroblob/wizardry/spell/FontOfMana.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Forcefield.java b/src/main/java/electroblob/wizardry/spell/Forcefield.java index bfc298b2..f3413c30 100644 --- a/src/main/java/electroblob/wizardry/spell/Forcefield.java +++ b/src/main/java/electroblob/wizardry/spell/Forcefield.java @@ -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 { public Forcefield(){ - super("forcefield", EnumAction.BOW, EntityForcefield::new, false); + super("forcefield", SpellActions.THRUST, EntityForcefield::new, false); addProperties(Spell.EFFECT_RADIUS); } diff --git a/src/main/java/electroblob/wizardry/spell/ForestOfThorns.java b/src/main/java/electroblob/wizardry/spell/ForestOfThorns.java index 9a8a6e49..8368924c 100644 --- a/src/main/java/electroblob/wizardry/spell/ForestOfThorns.java +++ b/src/main/java/electroblob/wizardry/spell/ForestOfThorns.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/ForestsCurse.java b/src/main/java/electroblob/wizardry/spell/ForestsCurse.java index edb3f8d4..a618609b 100644 --- a/src/main/java/electroblob/wizardry/spell/ForestsCurse.java +++ b/src/main/java/electroblob/wizardry/spell/ForestsCurse.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Freeze.java b/src/main/java/electroblob/wizardry/spell/Freeze.java index d0d59939..3d0b1cf2 100644 --- a/src/main/java/electroblob/wizardry/spell/Freeze.java +++ b/src/main/java/electroblob/wizardry/spell/Freeze.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/FreezingWeapon.java b/src/main/java/electroblob/wizardry/spell/FreezingWeapon.java index 46cc6111..a4862ffe 100644 --- a/src/main/java/electroblob/wizardry/spell/FreezingWeapon.java +++ b/src/main/java/electroblob/wizardry/spell/FreezingWeapon.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/FrostRay.java b/src/main/java/electroblob/wizardry/spell/FrostRay.java index 7f4dbcaa..556d2b8d 100644 --- a/src/main/java/electroblob/wizardry/spell/FrostRay.java +++ b/src/main/java/electroblob/wizardry/spell/FrostRay.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/Glide.java b/src/main/java/electroblob/wizardry/spell/Glide.java index 8239f676..4551c6d7 100644 --- a/src/main/java/electroblob/wizardry/spell/Glide.java +++ b/src/main/java/electroblob/wizardry/spell/Glide.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Grapple.java b/src/main/java/electroblob/wizardry/spell/Grapple.java index 437b27b7..a61e46e0 100644 --- a/src/main/java/electroblob/wizardry/spell/Grapple.java +++ b/src/main/java/electroblob/wizardry/spell/Grapple.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/GreaterTelekinesis.java b/src/main/java/electroblob/wizardry/spell/GreaterTelekinesis.java index 1bc1e45b..b7a7c17c 100644 --- a/src/main/java/electroblob/wizardry/spell/GreaterTelekinesis.java +++ b/src/main/java/electroblob/wizardry/spell/GreaterTelekinesis.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/GroupHeal.java b/src/main/java/electroblob/wizardry/spell/GroupHeal.java index cc2677e0..75ec5df3 100644 --- a/src/main/java/electroblob/wizardry/spell/GroupHeal.java +++ b/src/main/java/electroblob/wizardry/spell/GroupHeal.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/GrowthAura.java b/src/main/java/electroblob/wizardry/spell/GrowthAura.java index 929c803f..09dfa81c 100644 --- a/src/main/java/electroblob/wizardry/spell/GrowthAura.java +++ b/src/main/java/electroblob/wizardry/spell/GrowthAura.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/HealAlly.java b/src/main/java/electroblob/wizardry/spell/HealAlly.java index 2a31ad2e..0b375381 100644 --- a/src/main/java/electroblob/wizardry/spell/HealAlly.java +++ b/src/main/java/electroblob/wizardry/spell/HealAlly.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/IceAge.java b/src/main/java/electroblob/wizardry/spell/IceAge.java index 8c94d203..5086207f 100644 --- a/src/main/java/electroblob/wizardry/spell/IceAge.java +++ b/src/main/java/electroblob/wizardry/spell/IceAge.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/IceStatue.java b/src/main/java/electroblob/wizardry/spell/IceStatue.java index 35665491..6bdebce9 100644 --- a/src/main/java/electroblob/wizardry/spell/IceStatue.java +++ b/src/main/java/electroblob/wizardry/spell/IceStatue.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Ignite.java b/src/main/java/electroblob/wizardry/spell/Ignite.java index b686d89d..63561d53 100644 --- a/src/main/java/electroblob/wizardry/spell/Ignite.java +++ b/src/main/java/electroblob/wizardry/spell/Ignite.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/ImbueWeapon.java b/src/main/java/electroblob/wizardry/spell/ImbueWeapon.java index 631b9222..b3c881b4 100644 --- a/src/main/java/electroblob/wizardry/spell/ImbueWeapon.java +++ b/src/main/java/electroblob/wizardry/spell/ImbueWeapon.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Intimidate.java b/src/main/java/electroblob/wizardry/spell/Intimidate.java index 6c9889ea..408d0304 100644 --- a/src/main/java/electroblob/wizardry/spell/Intimidate.java +++ b/src/main/java/electroblob/wizardry/spell/Intimidate.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/InvigoratingPresence.java b/src/main/java/electroblob/wizardry/spell/InvigoratingPresence.java index a90b7a44..503d80f9 100644 --- a/src/main/java/electroblob/wizardry/spell/InvigoratingPresence.java +++ b/src/main/java/electroblob/wizardry/spell/InvigoratingPresence.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/InvokeWeather.java b/src/main/java/electroblob/wizardry/spell/InvokeWeather.java index e62718ac..45b711dc 100644 --- a/src/main/java/electroblob/wizardry/spell/InvokeWeather.java +++ b/src/main/java/electroblob/wizardry/spell/InvokeWeather.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Levitation.java b/src/main/java/electroblob/wizardry/spell/Levitation.java index f70e8f29..2d08335d 100644 --- a/src/main/java/electroblob/wizardry/spell/Levitation.java +++ b/src/main/java/electroblob/wizardry/spell/Levitation.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/LifeDrain.java b/src/main/java/electroblob/wizardry/spell/LifeDrain.java index a4cf6add..3d5d9751 100644 --- a/src/main/java/electroblob/wizardry/spell/LifeDrain.java +++ b/src/main/java/electroblob/wizardry/spell/LifeDrain.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/Light.java b/src/main/java/electroblob/wizardry/spell/Light.java index 95571fb5..216da264 100644 --- a/src/main/java/electroblob/wizardry/spell/Light.java +++ b/src/main/java/electroblob/wizardry/spell/Light.java @@ -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; } diff --git a/src/main/java/electroblob/wizardry/spell/LightningBolt.java b/src/main/java/electroblob/wizardry/spell/LightningBolt.java index 461cb126..7cb37cf9 100644 --- a/src/main/java/electroblob/wizardry/spell/LightningBolt.java +++ b/src/main/java/electroblob/wizardry/spell/LightningBolt.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/LightningPulse.java b/src/main/java/electroblob/wizardry/spell/LightningPulse.java index 42b8037b..f916d0b6 100644 --- a/src/main/java/electroblob/wizardry/spell/LightningPulse.java +++ b/src/main/java/electroblob/wizardry/spell/LightningPulse.java @@ -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; } diff --git a/src/main/java/electroblob/wizardry/spell/LightningRay.java b/src/main/java/electroblob/wizardry/spell/LightningRay.java index 21bb5c0b..273b4e04 100644 --- a/src/main/java/electroblob/wizardry/spell/LightningRay.java +++ b/src/main/java/electroblob/wizardry/spell/LightningRay.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/LightningWeb.java b/src/main/java/electroblob/wizardry/spell/LightningWeb.java index 759ea581..5587cba8 100644 --- a/src/main/java/electroblob/wizardry/spell/LightningWeb.java +++ b/src/main/java/electroblob/wizardry/spell/LightningWeb.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/Metamorphosis.java b/src/main/java/electroblob/wizardry/spell/Metamorphosis.java index 2270da29..a0689642 100644 --- a/src/main/java/electroblob/wizardry/spell/Metamorphosis.java +++ b/src/main/java/electroblob/wizardry/spell/Metamorphosis.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Meteor.java b/src/main/java/electroblob/wizardry/spell/Meteor.java index a89f1173..e26ec67b 100644 --- a/src/main/java/electroblob/wizardry/spell/Meteor.java +++ b/src/main/java/electroblob/wizardry/spell/Meteor.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/MindControl.java b/src/main/java/electroblob/wizardry/spell/MindControl.java index 039b642c..7f9d27d2 100644 --- a/src/main/java/electroblob/wizardry/spell/MindControl.java +++ b/src/main/java/electroblob/wizardry/spell/MindControl.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/MindTrick.java b/src/main/java/electroblob/wizardry/spell/MindTrick.java index 7aeb5cde..45abead1 100644 --- a/src/main/java/electroblob/wizardry/spell/MindTrick.java +++ b/src/main/java/electroblob/wizardry/spell/MindTrick.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Mine.java b/src/main/java/electroblob/wizardry/spell/Mine.java index d1f4a666..93e445de 100644 --- a/src/main/java/electroblob/wizardry/spell/Mine.java +++ b/src/main/java/electroblob/wizardry/spell/Mine.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Paralysis.java b/src/main/java/electroblob/wizardry/spell/Paralysis.java index 795a884a..490cac00 100644 --- a/src/main/java/electroblob/wizardry/spell/Paralysis.java +++ b/src/main/java/electroblob/wizardry/spell/Paralysis.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Petrify.java b/src/main/java/electroblob/wizardry/spell/Petrify.java index de5e6d4b..a6f05d4b 100644 --- a/src/main/java/electroblob/wizardry/spell/Petrify.java +++ b/src/main/java/electroblob/wizardry/spell/Petrify.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/PhaseStep.java b/src/main/java/electroblob/wizardry/spell/PhaseStep.java index 9f21eac8..8dbe25df 100644 --- a/src/main/java/electroblob/wizardry/spell/PhaseStep.java +++ b/src/main/java/electroblob/wizardry/spell/PhaseStep.java @@ -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; } diff --git a/src/main/java/electroblob/wizardry/spell/PlagueOfDarkness.java b/src/main/java/electroblob/wizardry/spell/PlagueOfDarkness.java index bf1c9d32..fc1e4501 100644 --- a/src/main/java/electroblob/wizardry/spell/PlagueOfDarkness.java +++ b/src/main/java/electroblob/wizardry/spell/PlagueOfDarkness.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/PocketFurnace.java b/src/main/java/electroblob/wizardry/spell/PocketFurnace.java index 29a2bdb8..8e24e4d6 100644 --- a/src/main/java/electroblob/wizardry/spell/PocketFurnace.java +++ b/src/main/java/electroblob/wizardry/spell/PocketFurnace.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/PocketWorkbench.java b/src/main/java/electroblob/wizardry/spell/PocketWorkbench.java index fb4ea0d1..7341e885 100644 --- a/src/main/java/electroblob/wizardry/spell/PocketWorkbench.java +++ b/src/main/java/electroblob/wizardry/spell/PocketWorkbench.java @@ -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 diff --git a/src/main/java/electroblob/wizardry/spell/Poison.java b/src/main/java/electroblob/wizardry/spell/Poison.java index 0e747f0f..48a28e1d 100644 --- a/src/main/java/electroblob/wizardry/spell/Poison.java +++ b/src/main/java/electroblob/wizardry/spell/Poison.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Possession.java b/src/main/java/electroblob/wizardry/spell/Possession.java index c94d26dc..79d2c6f6 100644 --- a/src/main/java/electroblob/wizardry/spell/Possession.java +++ b/src/main/java/electroblob/wizardry/spell/Possession.java @@ -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; } diff --git a/src/main/java/electroblob/wizardry/spell/RayOfPurification.java b/src/main/java/electroblob/wizardry/spell/RayOfPurification.java index 4367fd39..d1262e96 100644 --- a/src/main/java/electroblob/wizardry/spell/RayOfPurification.java +++ b/src/main/java/electroblob/wizardry/spell/RayOfPurification.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Resurrection.java b/src/main/java/electroblob/wizardry/spell/Resurrection.java index a28d0fe9..f5511d56 100644 --- a/src/main/java/electroblob/wizardry/spell/Resurrection.java +++ b/src/main/java/electroblob/wizardry/spell/Resurrection.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Reversal.java b/src/main/java/electroblob/wizardry/spell/Reversal.java index c763fe91..3af6848a 100644 --- a/src/main/java/electroblob/wizardry/spell/Reversal.java +++ b/src/main/java/electroblob/wizardry/spell/Reversal.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Shockwave.java b/src/main/java/electroblob/wizardry/spell/Shockwave.java index 2d3d89c7..a7a0f6e0 100644 --- a/src/main/java/electroblob/wizardry/spell/Shockwave.java +++ b/src/main/java/electroblob/wizardry/spell/Shockwave.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/ShulkerBullet.java b/src/main/java/electroblob/wizardry/spell/ShulkerBullet.java index 7998a426..69599b6e 100644 --- a/src/main/java/electroblob/wizardry/spell/ShulkerBullet.java +++ b/src/main/java/electroblob/wizardry/spell/ShulkerBullet.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/SixthSense.java b/src/main/java/electroblob/wizardry/spell/SixthSense.java index e8f5f926..46eae1ac 100644 --- a/src/main/java/electroblob/wizardry/spell/SixthSense.java +++ b/src/main/java/electroblob/wizardry/spell/SixthSense.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Slime.java b/src/main/java/electroblob/wizardry/spell/Slime.java index 14bbfaf0..9497f838 100644 --- a/src/main/java/electroblob/wizardry/spell/Slime.java +++ b/src/main/java/electroblob/wizardry/spell/Slime.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/Snare.java b/src/main/java/electroblob/wizardry/spell/Snare.java index 4b70e60d..9bf5a698 100644 --- a/src/main/java/electroblob/wizardry/spell/Snare.java +++ b/src/main/java/electroblob/wizardry/spell/Snare.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/SpectralPathway.java b/src/main/java/electroblob/wizardry/spell/SpectralPathway.java index adc6c73d..9c667462 100644 --- a/src/main/java/electroblob/wizardry/spell/SpectralPathway.java +++ b/src/main/java/electroblob/wizardry/spell/SpectralPathway.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/SpeedTime.java b/src/main/java/electroblob/wizardry/spell/SpeedTime.java index 4692b176..8caaf5eb 100644 --- a/src/main/java/electroblob/wizardry/spell/SpeedTime.java +++ b/src/main/java/electroblob/wizardry/spell/SpeedTime.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/SpellArrow.java b/src/main/java/electroblob/wizardry/spell/SpellArrow.java index ca26c045..4d967d65 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellArrow.java +++ b/src/main/java/electroblob/wizardry/spell/SpellArrow.java @@ -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 extends Spell { } public SpellArrow(String modID, String name, Function 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 extends Spell { // Spawns the projectile in the world world.spawnEntity(projectile); } - - caster.swingArm(hand); this.playSound(world, caster, ticksInUse, -1, modifiers); diff --git a/src/main/java/electroblob/wizardry/spell/SpellBuff.java b/src/main/java/electroblob/wizardry/spell/SpellBuff.java index 2e3faec2..b39e1549 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellBuff.java +++ b/src/main/java/electroblob/wizardry/spell/SpellBuff.java @@ -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... effects){ - super(modID, name, EnumAction.BOW, false); + super(modID, name, SpellActions.POINT_UP, false); this.effects = effects; this.r = r; this.g = g; diff --git a/src/main/java/electroblob/wizardry/spell/SpellConjuration.java b/src/main/java/electroblob/wizardry/spell/SpellConjuration.java index 1d86c527..88034e57 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellConjuration.java +++ b/src/main/java/electroblob/wizardry/spell/SpellConjuration.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java b/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java index 04b5059c..2ef4670a 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java +++ b/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java @@ -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 extends SpellC } public SpellConstructRanged(String modID, String name, Function 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 extends SpellC }else{ return false; } - - caster.swingArm(hand); + this.playSound(world, caster, ticksInUse, -1, modifiers); return true; } diff --git a/src/main/java/electroblob/wizardry/spell/SpellMinion.java b/src/main/java/electroblob/wizardry/spell/SpellMinion.java index 21dcf505..c9e8b1ed 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellMinion.java +++ b/src/main/java/electroblob/wizardry/spell/SpellMinion.java @@ -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 extends Spe } public SpellMinion(String modID, String name, Function 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); diff --git a/src/main/java/electroblob/wizardry/spell/SpellRay.java b/src/main/java/electroblob/wizardry/spell/SpellRay.java index df5d4ab4..123b655c 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellRay.java +++ b/src/main/java/electroblob/wizardry/spell/SpellRay.java @@ -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); diff --git a/src/main/java/electroblob/wizardry/spell/SummonIronGolem.java b/src/main/java/electroblob/wizardry/spell/SummonIronGolem.java index 9feaca7d..fc7329f4 100644 --- a/src/main/java/electroblob/wizardry/spell/SummonIronGolem.java +++ b/src/main/java/electroblob/wizardry/spell/SummonIronGolem.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/SummonSnowGolem.java b/src/main/java/electroblob/wizardry/spell/SummonSnowGolem.java index 8e7c9476..67b5abe5 100644 --- a/src/main/java/electroblob/wizardry/spell/SummonSnowGolem.java +++ b/src/main/java/electroblob/wizardry/spell/SummonSnowGolem.java @@ -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); } diff --git a/src/main/java/electroblob/wizardry/spell/SummonSpiritHorse.java b/src/main/java/electroblob/wizardry/spell/SummonSpiritHorse.java index a9f02984..8e775f51 100644 --- a/src/main/java/electroblob/wizardry/spell/SummonSpiritHorse.java +++ b/src/main/java/electroblob/wizardry/spell/SummonSpiritHorse.java @@ -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_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); diff --git a/src/main/java/electroblob/wizardry/spell/SummonSpiritWolf.java b/src/main/java/electroblob/wizardry/spell/SummonSpiritWolf.java index f4a8d6eb..59c7286c 100644 --- a/src/main/java/electroblob/wizardry/spell/SummonSpiritWolf.java +++ b/src/main/java/electroblob/wizardry/spell/SummonSpiritWolf.java @@ -4,6 +4,7 @@ import electroblob.wizardry.data.IStoredVariable; import electroblob.wizardry.data.Persistence; import electroblob.wizardry.data.WizardData; import electroblob.wizardry.entity.living.EntitySpiritWolf; +import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.util.SpellModifiers; import electroblob.wizardry.util.WizardryUtilities; import electroblob.wizardry.util.WizardryUtilities.Operations; @@ -11,7 +12,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; 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; @@ -26,7 +26,7 @@ public class SummonSpiritWolf extends Spell { public static final IStoredVariable UUID_KEY = IStoredVariable.StoredVariable.ofUUID("spiritWolfUUID", Persistence.ALWAYS); public SummonSpiritWolf(){ - super("summon_spirit_wolf", EnumAction.BOW, false); + super("summon_spirit_wolf", SpellActions.SUMMON, false); addProperties(SpellMinion.SUMMON_RADIUS); soundValues(0.7f, 1.2f, 0.4f); WizardData.registerStoredVariables(UUID_KEY); diff --git a/src/main/java/electroblob/wizardry/spell/Telekinesis.java b/src/main/java/electroblob/wizardry/spell/Telekinesis.java index 9d97aaa6..507a2f2f 100644 --- a/src/main/java/electroblob/wizardry/spell/Telekinesis.java +++ b/src/main/java/electroblob/wizardry/spell/Telekinesis.java @@ -1,13 +1,13 @@ package electroblob.wizardry.spell; import electroblob.wizardry.Wizardry; +import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.util.SpellModifiers; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -18,7 +18,7 @@ import net.minecraft.world.World; public class Telekinesis extends SpellRay { public Telekinesis(){ - super("telekinesis", false, EnumAction.NONE); + super("telekinesis", false, SpellActions.POINT); } @Override public boolean requiresPacket(){ return false; } diff --git a/src/main/java/electroblob/wizardry/spell/Thunderstorm.java b/src/main/java/electroblob/wizardry/spell/Thunderstorm.java index 05e7884f..4b5bd2a6 100644 --- a/src/main/java/electroblob/wizardry/spell/Thunderstorm.java +++ b/src/main/java/electroblob/wizardry/spell/Thunderstorm.java @@ -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; @@ -8,7 +9,6 @@ import net.minecraft.entity.EntityLiving; 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.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -32,7 +32,7 @@ public class Thunderstorm extends Spell { private static final float CENTRE_RADIUS_FRACTION = 0.5f; public Thunderstorm(){ - super("thunderstorm", EnumAction.BOW, false); + super("thunderstorm", SpellActions.POINT_UP, false); this.soundValues(1, 1.7f, 0.2f); addProperties(EFFECT_RADIUS, LIGHTNING_BOLTS, SECONDARY_DAMAGE, TERTIARY_DAMAGE, SECONDARY_RANGE, TERTIARY_RANGE, SECONDARY_MAX_TARGETS, TERTIARY_MAX_TARGETS); diff --git a/src/main/java/electroblob/wizardry/spell/Tornado.java b/src/main/java/electroblob/wizardry/spell/Tornado.java index b79d3f0b..b9378c6f 100644 --- a/src/main/java/electroblob/wizardry/spell/Tornado.java +++ b/src/main/java/electroblob/wizardry/spell/Tornado.java @@ -1,9 +1,9 @@ package electroblob.wizardry.spell; import electroblob.wizardry.entity.construct.EntityTornado; +import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.util.SpellModifiers; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.EnumAction; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.Vec3d; @@ -13,7 +13,7 @@ public class Tornado extends SpellConstruct { public static final String UPWARD_ACCELERATION = "upward_acceleration"; public Tornado(){ - super("tornado", EnumAction.NONE, EntityTornado::new, false); + super("tornado", SpellActions.POINT, EntityTornado::new, false); addProperties(EFFECT_RADIUS, SPEED, DAMAGE, UPWARD_ACCELERATION); } diff --git a/src/main/java/electroblob/wizardry/spell/Transience.java b/src/main/java/electroblob/wizardry/spell/Transience.java index e20f1ac5..e6f17353 100644 --- a/src/main/java/electroblob/wizardry/spell/Transience.java +++ b/src/main/java/electroblob/wizardry/spell/Transience.java @@ -1,13 +1,13 @@ package electroblob.wizardry.spell; import electroblob.wizardry.Wizardry; +import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.registry.WizardryItems; import electroblob.wizardry.registry.WizardryPotions; import electroblob.wizardry.util.SpellModifiers; 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.DamageSource; import net.minecraft.util.EnumHand; @@ -26,7 +26,7 @@ public class Transience extends Spell { public static final ResourceLocation SHADER = new ResourceLocation(Wizardry.MODID, "shaders/post/transience.json"); public Transience(){ - super("transience", EnumAction.BOW, false); + super("transience", SpellActions.POINT_UP, false); addProperties(EFFECT_DURATION); } diff --git a/src/main/java/electroblob/wizardry/spell/Transportation.java b/src/main/java/electroblob/wizardry/spell/Transportation.java index 07e7d9a6..2992b06c 100644 --- a/src/main/java/electroblob/wizardry/spell/Transportation.java +++ b/src/main/java/electroblob/wizardry/spell/Transportation.java @@ -5,6 +5,7 @@ import electroblob.wizardry.data.IStoredVariable; import electroblob.wizardry.data.Persistence; import electroblob.wizardry.data.WizardData; import electroblob.wizardry.item.ItemArtefact; +import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.packet.PacketTransportation; import electroblob.wizardry.packet.WizardryPacketHandler; import electroblob.wizardry.registry.WizardryItems; @@ -14,7 +15,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.nbt.NBTTagList; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumHand; @@ -41,7 +41,7 @@ public class Transportation extends Spell { public static final IStoredVariable COUNTDOWN_KEY = IStoredVariable.StoredVariable.ofInt("tpCountdown", Persistence.NEVER).withTicker(Transportation::update); public Transportation(){ - super("transportation", EnumAction.BOW, false); + super("transportation", SpellActions.POINT_UP, false); addProperties(TELEPORT_COUNTDOWN); WizardData.registerStoredVariables(LOCATIONS_KEY, COUNTDOWN_KEY); } diff --git a/src/main/java/electroblob/wizardry/spell/VanishingBox.java b/src/main/java/electroblob/wizardry/spell/VanishingBox.java index 471450de..06c57933 100644 --- a/src/main/java/electroblob/wizardry/spell/VanishingBox.java +++ b/src/main/java/electroblob/wizardry/spell/VanishingBox.java @@ -1,16 +1,16 @@ package electroblob.wizardry.spell; +import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.util.SpellModifiers; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.InventoryEnderChest; -import net.minecraft.item.EnumAction; import net.minecraft.util.EnumHand; import net.minecraft.world.World; public class VanishingBox extends Spell { public VanishingBox(){ - super("vanishing_box", EnumAction.BOW, false); + super("vanishing_box", SpellActions.POINT_UP, false); } @Override public boolean requiresPacket(){ return false; } diff --git a/src/main/java/electroblob/wizardry/spell/WallOfFrost.java b/src/main/java/electroblob/wizardry/spell/WallOfFrost.java index 2c059bef..8bdc50a7 100644 --- a/src/main/java/electroblob/wizardry/spell/WallOfFrost.java +++ b/src/main/java/electroblob/wizardry/spell/WallOfFrost.java @@ -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 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.SoundEvent; import net.minecraft.util.math.BlockPos; @@ -23,7 +23,7 @@ public class WallOfFrost extends SpellRay { private static final int MINIMUM_PLACEMENT_RANGE = 2; public WallOfFrost(){ - super("wall_of_frost", true, EnumAction.NONE); + super("wall_of_frost", true, SpellActions.POINT); this.particleVelocity(1); this.particleSpacing(0.5); addProperties(DURATION); diff --git a/src/main/java/electroblob/wizardry/spell/Whirlwind.java b/src/main/java/electroblob/wizardry/spell/Whirlwind.java index 733c891a..772d9a97 100644 --- a/src/main/java/electroblob/wizardry/spell/Whirlwind.java +++ b/src/main/java/electroblob/wizardry/spell/Whirlwind.java @@ -2,13 +2,13 @@ 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.SpellModifiers; 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.network.play.server.SPacketEntityVelocity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; @@ -22,7 +22,7 @@ public class Whirlwind extends SpellRay { public static final String REPULSION_VELOCITY = "repulsion_velocity"; public Whirlwind(){ - super("whirlwind", false, EnumAction.NONE); + super("whirlwind", false, SpellActions.POINT); this.soundValues(0.8f, 0.7f, 0.2f); addProperties(REPULSION_VELOCITY); } diff --git a/src/main/java/electroblob/wizardry/spell/Wither.java b/src/main/java/electroblob/wizardry/spell/Wither.java index f649d9b8..0b1667b0 100644 --- a/src/main/java/electroblob/wizardry/spell/Wither.java +++ b/src/main/java/electroblob/wizardry/spell/Wither.java @@ -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.math.BlockPos; @@ -22,7 +22,7 @@ import net.minecraft.world.World; public class Wither extends SpellRay { public Wither(){ - super("wither", false, EnumAction.NONE); + super("wither", false, SpellActions.POINT); this.soundValues(1, 1.1f, 0.2f); addProperties(DAMAGE, EFFECT_DURATION, EFFECT_STRENGTH); } diff --git a/src/main/java/electroblob/wizardry/util/WizardryUtilities.java b/src/main/java/electroblob/wizardry/util/WizardryUtilities.java index 870803a9..4d899a5f 100644 --- a/src/main/java/electroblob/wizardry/util/WizardryUtilities.java +++ b/src/main/java/electroblob/wizardry/util/WizardryUtilities.java @@ -37,6 +37,7 @@ import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import javax.annotation.Nullable; +import java.lang.reflect.Field; import java.util.*; import java.util.function.BiPredicate; import java.util.function.Predicate; @@ -793,6 +794,21 @@ public final class WizardryUtilities { return hotbar; } + /** Returns which {@link EnumHandSide} the given {@link EnumHand} is on for the given entity. */ + public static EnumHandSide getSideForHand(EntityLivingBase entity, EnumHand hand){ + return hand == EnumHand.MAIN_HAND ? entity.getPrimaryHand() : entity.getPrimaryHand().opposite(); + } + + /** Returns which {@link EnumHand} is on the given {@link EnumHandSide} for the given entity. */ + public static EnumHand getHandForSide(EntityLivingBase entity, EnumHandSide side){ + return side == entity.getPrimaryHand() ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND; + } + + /** Returns the opposite {@link EnumHand} to the one given. */ + public static EnumHand getOpposite(EnumHand hand){ + return hand == EnumHand.OFF_HAND ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND; + } + /** * Tests whether the specified player has any of the specified item in their entire inventory, including armour * slots and offhand. @@ -1008,4 +1024,15 @@ public final class WizardryUtilities { // return iterator.next(); // } + /** + * Returns a list of all fields belonging to the given class and all those belonging to all of its superclasses. + * @param c The class to query + * @return The resulting {@link List} of fields + */ + public static List getAllFields(Class c){ + List fields = new ArrayList<>(Arrays.asList(c.getDeclaredFields())); + if(c.getSuperclass() != null) fields.addAll(getAllFields(c.getSuperclass())); + return fields; + } + } diff --git a/src/main/resources/assets/ebwizardry/models/item/advanced_earth_wand.json b/src/main/resources/assets/ebwizardry/models/item/advanced_earth_wand.json index cf039f84..c096a218 100644 --- a/src/main/resources/assets/ebwizardry/models/item/advanced_earth_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/advanced_earth_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_advanced_earth" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/advanced_fire_wand.json b/src/main/resources/assets/ebwizardry/models/item/advanced_fire_wand.json index a71872f0..e3ee972b 100644 --- a/src/main/resources/assets/ebwizardry/models/item/advanced_fire_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/advanced_fire_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_advanced_fire" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/advanced_healing_wand.json b/src/main/resources/assets/ebwizardry/models/item/advanced_healing_wand.json index bf0096f6..0854d2a9 100644 --- a/src/main/resources/assets/ebwizardry/models/item/advanced_healing_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/advanced_healing_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_advanced_healing" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/advanced_ice_wand.json b/src/main/resources/assets/ebwizardry/models/item/advanced_ice_wand.json index 0c4eccd5..a3c64272 100644 --- a/src/main/resources/assets/ebwizardry/models/item/advanced_ice_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/advanced_ice_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_advanced_ice" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/advanced_lightning_wand.json b/src/main/resources/assets/ebwizardry/models/item/advanced_lightning_wand.json index 7be6ebe9..bfd46bfd 100644 --- a/src/main/resources/assets/ebwizardry/models/item/advanced_lightning_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/advanced_lightning_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_advanced_lightning" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/advanced_necromancy_wand.json b/src/main/resources/assets/ebwizardry/models/item/advanced_necromancy_wand.json index 6f0856fe..8604ea87 100644 --- a/src/main/resources/assets/ebwizardry/models/item/advanced_necromancy_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/advanced_necromancy_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_advanced_necromancy" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/advanced_sorcery_wand.json b/src/main/resources/assets/ebwizardry/models/item/advanced_sorcery_wand.json index 73de0258..32b308f6 100644 --- a/src/main/resources/assets/ebwizardry/models/item/advanced_sorcery_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/advanced_sorcery_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_advanced_sorcery" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/advanced_wand.json b/src/main/resources/assets/ebwizardry/models/item/advanced_wand.json index ceb0b2e0..2852b87f 100644 --- a/src/main/resources/assets/ebwizardry/models/item/advanced_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/advanced_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_advanced" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/apprentice_earth_wand.json b/src/main/resources/assets/ebwizardry/models/item/apprentice_earth_wand.json index dc0c9748..448931cc 100644 --- a/src/main/resources/assets/ebwizardry/models/item/apprentice_earth_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/apprentice_earth_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_apprentice_earth" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/apprentice_fire_wand.json b/src/main/resources/assets/ebwizardry/models/item/apprentice_fire_wand.json index 49568c5b..12f60681 100644 --- a/src/main/resources/assets/ebwizardry/models/item/apprentice_fire_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/apprentice_fire_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_apprentice_fire" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/apprentice_healing_wand.json b/src/main/resources/assets/ebwizardry/models/item/apprentice_healing_wand.json index bdfd6ceb..3478e831 100644 --- a/src/main/resources/assets/ebwizardry/models/item/apprentice_healing_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/apprentice_healing_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_apprentice_healing" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/apprentice_ice_wand.json b/src/main/resources/assets/ebwizardry/models/item/apprentice_ice_wand.json index 9f83e3e1..a3fb8819 100644 --- a/src/main/resources/assets/ebwizardry/models/item/apprentice_ice_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/apprentice_ice_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_apprentice_ice" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/apprentice_lightning_wand.json b/src/main/resources/assets/ebwizardry/models/item/apprentice_lightning_wand.json index ad2565e1..8c28070c 100644 --- a/src/main/resources/assets/ebwizardry/models/item/apprentice_lightning_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/apprentice_lightning_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_apprentice_lightning" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/apprentice_necromancy_wand.json b/src/main/resources/assets/ebwizardry/models/item/apprentice_necromancy_wand.json index 3750104a..d5f28f6f 100644 --- a/src/main/resources/assets/ebwizardry/models/item/apprentice_necromancy_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/apprentice_necromancy_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_apprentice_necromancy" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/apprentice_sorcery_wand.json b/src/main/resources/assets/ebwizardry/models/item/apprentice_sorcery_wand.json index debce2e4..dd4169be 100644 --- a/src/main/resources/assets/ebwizardry/models/item/apprentice_sorcery_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/apprentice_sorcery_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_apprentice_sorcery" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/apprentice_wand.json b/src/main/resources/assets/ebwizardry/models/item/apprentice_wand.json index d3baa0fe..c35d3d43 100644 --- a/src/main/resources/assets/ebwizardry/models/item/apprentice_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/apprentice_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_apprentice" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/festive_wand.json b/src/main/resources/assets/ebwizardry/models/item/festive_wand.json index b31af7dd..5ce21ed9 100644 --- a/src/main/resources/assets/ebwizardry/models/item/festive_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/festive_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_festive" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/magic_wand.json b/src/main/resources/assets/ebwizardry/models/item/magic_wand.json index 59387cf7..04e194f2 100644 --- a/src/main/resources/assets/ebwizardry/models/item/magic_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/magic_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_novice" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/master_earth_wand.json b/src/main/resources/assets/ebwizardry/models/item/master_earth_wand.json index 65b2b9a5..d8c92322 100644 --- a/src/main/resources/assets/ebwizardry/models/item/master_earth_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/master_earth_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_master_earth" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/master_fire_wand.json b/src/main/resources/assets/ebwizardry/models/item/master_fire_wand.json index a66856d3..0055168f 100644 --- a/src/main/resources/assets/ebwizardry/models/item/master_fire_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/master_fire_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_master_fire" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/master_healing_wand.json b/src/main/resources/assets/ebwizardry/models/item/master_healing_wand.json index 3f4c37cb..e7882b9a 100644 --- a/src/main/resources/assets/ebwizardry/models/item/master_healing_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/master_healing_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_master_healing" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/master_ice_wand.json b/src/main/resources/assets/ebwizardry/models/item/master_ice_wand.json index 5f98c5b5..803b8bb0 100644 --- a/src/main/resources/assets/ebwizardry/models/item/master_ice_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/master_ice_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_master_ice" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/master_lightning_wand.json b/src/main/resources/assets/ebwizardry/models/item/master_lightning_wand.json index 14659d01..5c480232 100644 --- a/src/main/resources/assets/ebwizardry/models/item/master_lightning_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/master_lightning_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_master_lightning" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/master_necromancy_wand.json b/src/main/resources/assets/ebwizardry/models/item/master_necromancy_wand.json index ebf1ae67..57165e31 100644 --- a/src/main/resources/assets/ebwizardry/models/item/master_necromancy_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/master_necromancy_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_master_necromancy" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/master_sorcery_wand.json b/src/main/resources/assets/ebwizardry/models/item/master_sorcery_wand.json index eabb2af3..47d27356 100644 --- a/src/main/resources/assets/ebwizardry/models/item/master_sorcery_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/master_sorcery_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_master_sorcery" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/master_wand.json b/src/main/resources/assets/ebwizardry/models/item/master_wand.json index c0c29b76..b298e38b 100644 --- a/src/main/resources/assets/ebwizardry/models/item/master_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/master_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_master" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/novice_earth_wand.json b/src/main/resources/assets/ebwizardry/models/item/novice_earth_wand.json index 7431443b..f893f16a 100644 --- a/src/main/resources/assets/ebwizardry/models/item/novice_earth_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/novice_earth_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_novice_earth" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/novice_fire_wand.json b/src/main/resources/assets/ebwizardry/models/item/novice_fire_wand.json index 27055741..15bab228 100644 --- a/src/main/resources/assets/ebwizardry/models/item/novice_fire_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/novice_fire_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_novice_fire" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/novice_healing_wand.json b/src/main/resources/assets/ebwizardry/models/item/novice_healing_wand.json index e9095bf3..4f9d16c5 100644 --- a/src/main/resources/assets/ebwizardry/models/item/novice_healing_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/novice_healing_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_novice_healing" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/novice_ice_wand.json b/src/main/resources/assets/ebwizardry/models/item/novice_ice_wand.json index feb24c4c..a60b71b2 100644 --- a/src/main/resources/assets/ebwizardry/models/item/novice_ice_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/novice_ice_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_novice_ice" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/novice_lightning_wand.json b/src/main/resources/assets/ebwizardry/models/item/novice_lightning_wand.json index ce044666..925a23a4 100644 --- a/src/main/resources/assets/ebwizardry/models/item/novice_lightning_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/novice_lightning_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_novice_lightning" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/novice_necromancy_wand.json b/src/main/resources/assets/ebwizardry/models/item/novice_necromancy_wand.json index ab64fb68..5f1a07d0 100644 --- a/src/main/resources/assets/ebwizardry/models/item/novice_necromancy_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/novice_necromancy_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_novice_necromancy" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/novice_sorcery_wand.json b/src/main/resources/assets/ebwizardry/models/item/novice_sorcery_wand.json index 968ff38e..7db5be49 100644 --- a/src/main/resources/assets/ebwizardry/models/item/novice_sorcery_wand.json +++ b/src/main/resources/assets/ebwizardry/models/item/novice_sorcery_wand.json @@ -2,5 +2,13 @@ "parent": "item/handheld", "textures": { "layer0": "ebwizardry:items/wand_novice_sorcery" - } + }, + "overrides": [ + { + "predicate": { + "this_gets_ignored": 1 + }, + "model": "ebwizardry:item/override_generators/wand" + } + ] } diff --git a/src/main/resources/assets/ebwizardry/models/item/override_generators/wand.json b/src/main/resources/assets/ebwizardry/models/item/override_generators/wand.json new file mode 100644 index 00000000..bcdf7d94 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/models/item/override_generators/wand.json @@ -0,0 +1,11 @@ +{ + "parent": "item/handheld", + "overrides": [ + { + "predicate": { + "pointing": 1 + }, + "model": "ebwizardry:item/wand_point" + } + ] +} diff --git a/src/main/resources/assets/ebwizardry/models/item/wand_point.json b/src/main/resources/assets/ebwizardry/models/item/wand_point.json new file mode 100644 index 00000000..67d781b2 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/models/item/wand_point.json @@ -0,0 +1,25 @@ +{ + "parent": "item/handheld", + "display": { + "thirdperson_righthand": { + "rotation": [0, -90, 105], + "translation": [0, 0, -3.25], + "scale": [0.85, 0.85, 0.85] + }, + "thirdperson_lefthand": { + "rotation": [0, 90, -105], + "translation": [0, 0, -3.25], + "scale": [0.85, 0.85, 0.85] + }, + "firstperson_righthand": { + "rotation": [0, -90, 105], + "translation": [1.13, 3.2, 0.5], + "scale": [0.68, 0.68, 0.68] + }, + "firstperson_lefthand": { + "rotation": [0, 90, -105], + "translation": [1.13, 3.2, 0.5], + "scale": [0.68, 0.68, 0.68] + } + } +}