Skip to content

Commit

Permalink
add clientside config for loop-de-loops
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed May 21, 2024
1 parent 0daea1b commit ebd1300
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import com.teamresourceful.resourcefulconfig.common.annotations.Config;
import com.teamresourceful.resourcefulconfig.common.annotations.ConfigEntry;
import com.teamresourceful.resourcefulconfig.common.annotations.InlineCategory;
import com.teamresourceful.resourcefulconfig.common.config.EntryType;
import com.teamresourceful.resourcefulconfig.web.annotations.Link;
import com.teamresourceful.resourcefulconfig.web.annotations.WebInfo;
import dev.cammiescorner.icarus.client.IcarusClientConfig;

@WebInfo(
title = "Icarus",
Expand All @@ -30,7 +32,7 @@
@Config(Icarus.MODID)
public final class IcarusConfig {

@ConfigEntry(id = "can_loop_de_loop", type = EntryType.BOOLEAN, translation = "config.icarus.can_loop_de_loop")
@ConfigEntry(id = "can_loop_de_loop", type = EntryType.BOOLEAN, translation = "config.icarus.can_loop_de_loop_server")
public static boolean canLoopDeLoop = true;
@ConfigEntry(id = "armor_slows", type = EntryType.BOOLEAN, translation = "config.icarus.armor_slows")
public static boolean armorSlows = true;
Expand All @@ -54,4 +56,7 @@ public final class IcarusConfig {
public static int maxHeightAboveWorld = 64;
@ConfigEntry(id = "flying_target_radius", type = EntryType.FLOAT, translation = "config.icarus.flying_target_radius")
public static float flyingTargetRadius = 0.25f;

@InlineCategory
public static IcarusClientConfig client;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.cammiescorner.icarus.client;

import dev.cammiescorner.icarus.IcarusConfig;
import dev.cammiescorner.icarus.api.IcarusPlayerValues;
import dev.cammiescorner.icarus.util.ServerPlayerFallbackValues;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package dev.cammiescorner.icarus.client;

import com.teamresourceful.resourcefulconfig.common.annotations.Category;
import com.teamresourceful.resourcefulconfig.common.annotations.ConfigEntry;
import com.teamresourceful.resourcefulconfig.common.config.EntryType;

@Category(id = "client", translation = "config_category.icarus.client")
public final class IcarusClientConfig {

@ConfigEntry(id = "can_loop_de_loop", type = EntryType.BOOLEAN, translation = "config.icarus.can_loop_de_loop_client")
public static boolean canLoopDeLoop = true;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.cammiescorner.icarus.mixin.client;

import dev.cammiescorner.icarus.IcarusConfig;
import dev.cammiescorner.icarus.client.IcarusClientConfig;
import dev.cammiescorner.icarus.util.IcarusHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.MouseHandler;
Expand All @@ -18,7 +20,7 @@ public class MouseHandlerMixin {

@ModifyArg(method = "turnPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;turn(DD)V"), index = 0)
public double changeLookDirectionX(double x) {
if (minecraft.player != null && minecraft.player.isFallFlying() && IcarusHelper.hasWings(minecraft.player) && IcarusHelper.getConfigValues(minecraft.player).canLoopDeLoop() && (minecraft.player.getXRot() > 90 || minecraft.player.getXRot() < -90))
if (minecraft.player != null && minecraft.player.isFallFlying() && IcarusClientConfig.canLoopDeLoop && IcarusHelper.hasWings(minecraft.player) && IcarusHelper.getConfigValues(minecraft.player).canLoopDeLoop() && (minecraft.player.getXRot() > 90 || minecraft.player.getXRot() < -90))
return -x;

return x;
Expand Down
4 changes: 3 additions & 1 deletion Common/src/main/resources/assets/icarus/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"item.icarus.discords_wings": "Discord's Wings",
"item.icarus.zanzas_wings": "Zanza's Wings",

"config.icarus.can_loop_de_loop": "Can the player do loop-de-loops?",
"config.icarus.can_loop_de_loop_server": "Can players do loop-de-loops?",
"config.icarus.can_loop_de_loop_client": "Can you do loop-de-loops?",
"config.icarus.armor_slows": "Does armor slow the player down?",
"config.icarus.can_slow_fall": "Can the player slow-fall by Sneaking while flying?",
"config.icarus.max_slowed_multiplier": "Maximum multiplier armor can slow you by.",
Expand All @@ -102,6 +103,7 @@
"config.icarus.max_height_enabled": "Whether or not to prevent flight above the maximum height allowed",
"config.icarus.max_height_above_world": "Maximum height above the world build limit that players can fly to",
"config.icarus.flying_target_radius": "How much the targeting hitbox of a flying player is increased by",
"config_category.icarus.client": "Client Settings",

"effect.icarus.flightless": "Flightless",

Expand Down
4 changes: 3 additions & 1 deletion Common/src/main/resources/assets/icarus/lang/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"item.icarus.discords_wings": "Asas do Discord",
"item.icarus.zanzas_wings": "Asas da Zanza",

"config.icarus.can_loop_de_loop": "O jogador consegue fazer loop-de-loops?",
"config.icarus.can_loop_de_loop_server": "O jogador consegue fazer loop-de-loops?",
"config.icarus.can_loop_de_loop_client": "Can you do loop-de-loops?",
"config.icarus.armor_slows": "A armadura desacelera o jogador?",
"config.icarus.can_slow_fall": "O jogador pode cair lentamente se ele apertar Shift enquanto caí?",
"config.icarus.max_slowed_multiplier": "Multiplicador Máximo de lentidão recebido por armadura.",
Expand All @@ -102,6 +103,7 @@
"config.icarus.max_height_enabled": "Whether or not to prevent flight above the maximum height allowed",
"config.icarus.max_height_above_world": "Maximum height above the world build limit that players can fly to",
"config.icarus.flying_target_radius": "How much the targeting hitbox of a flying player is increased by",
"config_category.icarus.client": "Client Settings",

"effect.icarus.flightless": "Flightless",

Expand Down

0 comments on commit ebd1300

Please sign in to comment.