Add config options to disable the screen shake and blink effects

We're all about that accessibility here!
This commit is contained in:
Electroblob77
2020-04-13 18:48:30 +01:00
parent 7f31fc6259
commit 41d575c9c9
4 changed files with 42 additions and 8 deletions
@@ -300,6 +300,10 @@ public final class Settings {
public boolean booksPauseGame = true;
/** <b>[Client-only]</b> Whether to use custom shaders for certain spells. */
public boolean useShaders = true;
/** <b>[Client-only]</b> Whether to use the screen shake effect for certain spells. */
public boolean screenShake = true;
/** <b>[Client-only]</b> Whether to use the screen blink effect for teleportation spells. */
public boolean blinkEffect = true;
/** <b>[Client-only]</b> The position of the spell HUD. */
public GuiPosition spellHUDPosition = GuiPosition.BOTTOM_LEFT;
@@ -878,6 +882,18 @@ public final class Settings {
useShaders = property.getBoolean();
propOrder.add(property.getName());
property = config.get(CLIENT_CATEGORY, "screenShake", true, "Whether to use the screen shake effect for certain spells.");
property.setLanguageKey("config." + Wizardry.MODID + ".screen_shake");
Wizardry.proxy.setToNamedBooleanEntry(property);
screenShake = property.getBoolean();
propOrder.add(property.getName());
property = config.get(CLIENT_CATEGORY, "blinkEffect", true, "Whether to use the screen blink effect for teleportation spells.");
property.setLanguageKey("config." + Wizardry.MODID + ".blink_effect");
Wizardry.proxy.setToNamedBooleanEntry(property);
blinkEffect = property.getBoolean();
propOrder.add(property.getName());
config.setCategoryPropertyOrder(CLIENT_CATEGORY, propOrder);
}
@@ -75,13 +75,15 @@ public final class WizardryClientEventHandler {
/** Starts the first-person blink overlay effect. */
public static void playBlinkEffect(){
blinkEffectTimer = BLINK_EFFECT_DURATION;
if(Wizardry.settings.blinkEffect) blinkEffectTimer = BLINK_EFFECT_DURATION;
}
/** Starts the client-side screen shake effect. */
public static void shakeScreen(float intensity){
screenShakeCounter = (int)(intensity / SHAKINESS);
Minecraft.getMinecraft().player.rotationPitch -= intensity * 0.5f; // Start halfway down
if(Wizardry.settings.screenShake){
screenShakeCounter = (int)(intensity / SHAKINESS);
Minecraft.getMinecraft().player.rotationPitch -= intensity * 0.5f; // Start halfway down
}
}
@SubscribeEvent
@@ -89,12 +91,20 @@ public final class WizardryClientEventHandler {
if(event.player == Minecraft.getMinecraft().player && event.phase == TickEvent.Phase.END){
if(blinkEffectTimer > 0) blinkEffectTimer--;
if(Wizardry.settings.blinkEffect){
if(blinkEffectTimer > 0) blinkEffectTimer--;
}else{
blinkEffectTimer = 0;
}
if(screenShakeCounter > 0){
float magnitude = screenShakeCounter * SHAKINESS;
Minecraft.getMinecraft().player.rotationPitch += screenShakeCounter % 2 == 0 ? magnitude : -magnitude;
screenShakeCounter--;
if(Wizardry.settings.screenShake){
if(screenShakeCounter > 0){
float magnitude = screenShakeCounter * SHAKINESS;
Minecraft.getMinecraft().player.rotationPitch += screenShakeCounter % 2 == 0 ? magnitude : -magnitude;
screenShakeCounter--;
}
}else{
screenShakeCounter = 0;
}
// Only seems to work here...
@@ -1234,6 +1234,10 @@ config.ebwizardry.use_shaders=Use Custom Shaders
config.ebwizardry.use_shaders.tooltip=Whether to use custom shaders for certain spells. These use the vanilla shader system (like mob spectating shaders) and shouldn't have much of an effect on performance in most cases, but they may conflict with other shaders.
config.ebwizardry.use_shaders.true=Yes - gimme those sweet shaders!
config.ebwizardry.use_shaders.false=No - I'm running this on a potato
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.category.commands=Command Settings
config.ebwizardry.category.commands.tooltip=Configure wizardry's commands
@@ -1234,6 +1234,10 @@ config.ebwizardry.use_shaders=Use Custom Shaders
config.ebwizardry.use_shaders.tooltip=Whether to use custom shaders for certain spells. These use the vanilla shader system (like mob spectating shaders) and shouldn't have much of an effect on performance in most cases, but they may conflict with other shaders.
config.ebwizardry.use_shaders.true=Yes - gimme those sweet shaders!
config.ebwizardry.use_shaders.false=No - I'm running this on a potato
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.category.commands=Command Settings
config.ebwizardry.category.commands.tooltip=Configure wizardry's commands