From 99a9524ee792f4b88634d1cf4dff7194182b85d3 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Sun, 7 Jun 2020 23:05:50 +0100 Subject: [PATCH] Add config option to disable player animations --- src/main/java/electroblob/wizardry/Settings.java | 9 +++++++++ .../wizardry/client/animation/PlayerAnimator.java | 6 ++++++ src/main/resources/assets/ebwizardry/lang/en_gb.lang | 2 ++ src/main/resources/assets/ebwizardry/lang/en_us.lang | 2 ++ 4 files changed, 19 insertions(+) diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java index d39d65b1..c7b8a34e 100644 --- a/src/main/java/electroblob/wizardry/Settings.java +++ b/src/main/java/electroblob/wizardry/Settings.java @@ -334,6 +334,8 @@ public final class Settings { public boolean screenShake = true; /** [Client-only] Whether to use the screen blink effect for teleportation spells. */ public boolean blinkEffect = true; + /** [Client-only] Whether to use spellcasting animations for players. */ + public boolean spellcastingAnimations = true; /** [Client-only] The position of the spell HUD. */ public GuiPosition spellHUDPosition = GuiPosition.BOTTOM_LEFT; @@ -1002,6 +1004,13 @@ public final class Settings { blinkEffect = property.getBoolean(); propOrder.add(property.getName()); + property = config.get(CLIENT_CATEGORY, "spellcastingAnimations", true, "Whether to use custom animations for players casting spells. Disable this option if it conflicts with other mods that add player animations."); + property.setLanguageKey("config." + Wizardry.MODID + ".spellcasting_animations"); + property.setRequiresMcRestart(true); + Wizardry.proxy.setToNamedBooleanEntry(property); + spellcastingAnimations = property.getBoolean(); + propOrder.add(property.getName()); + config.setCategoryPropertyOrder(CLIENT_CATEGORY, propOrder); } diff --git a/src/main/java/electroblob/wizardry/client/animation/PlayerAnimator.java b/src/main/java/electroblob/wizardry/client/animation/PlayerAnimator.java index 71ea7e57..449fa650 100644 --- a/src/main/java/electroblob/wizardry/client/animation/PlayerAnimator.java +++ b/src/main/java/electroblob/wizardry/client/animation/PlayerAnimator.java @@ -77,6 +77,8 @@ public class PlayerAnimator { @SuppressWarnings("unchecked") public static void init(){ + if(!Wizardry.settings.spellcastingAnimations) return; + for(RenderPlayer renderer : Minecraft.getMinecraft().getRenderManager().getSkinMap().values()){ List models = new ArrayList<>(); @@ -182,6 +184,8 @@ public class PlayerAnimator { @SubscribeEvent public static void onRenderHandEvent(RenderSpecificHandEvent event){ + if(!Wizardry.settings.spellcastingAnimations) return; + AbstractClientPlayer player = Minecraft.getMinecraft().player; EnumAction action = event.getItemStack().getItemUseAction(); @@ -199,6 +203,8 @@ public class PlayerAnimator { @SubscribeEvent public static void onRenderPlayerPreEvent(RenderPlayerEvent.Pre event){ + if(!Wizardry.settings.spellcastingAnimations) return; + // boolean firstPerson = event.getEntityPlayer() == Minecraft.getMinecraft().player // && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0; diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index bb57b8fc..ddb92cc7 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -1465,6 +1465,8 @@ config.ebwizardry.screen_shake=Screen Shake config.ebwizardry.screen_shake.tooltip=Whether to use the screen shake effect for certain spells. config.ebwizardry.blink_effect=Blink Effect config.ebwizardry.blink_effect.tooltip=Whether to use the screen blink effect for teleportation spells. +config.ebwizardry.spellcasting_animations=Spellcasting Animations +config.ebwizardry.spellcasting_animations.tooltip=Whether to use custom animations for players casting spells. Disable this option if it conflicts with other mods that add player animations. config.ebwizardry.category.commands=Command Settings config.ebwizardry.category.commands.tooltip=Configure wizardry's commands diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index 16f3ccdc..6b582389 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -1465,6 +1465,8 @@ config.ebwizardry.screen_shake=Screen Shake config.ebwizardry.screen_shake.tooltip=Whether to use the screen shake effect for certain spells. config.ebwizardry.blink_effect=Blink Effect config.ebwizardry.blink_effect.tooltip=Whether to use the screen blink effect for teleportation spells. +config.ebwizardry.spellcasting_animations=Spellcasting Animations +config.ebwizardry.spellcasting_animations.tooltip=Whether to use custom animations for players casting spells. Disable this option if it conflicts with other mods that add player animations. config.ebwizardry.category.commands=Command Settings config.ebwizardry.category.commands.tooltip=Configure wizardry's commands