diff --git a/Common/src/main/java/dev/cammiescorner/icarus/client/ClientPlayerFallbackValues.java b/Common/src/main/java/dev/cammiescorner/icarus/client/ClientPlayerFallbackValues.java index f9b9f7d..4d48367 100644 --- a/Common/src/main/java/dev/cammiescorner/icarus/client/ClientPlayerFallbackValues.java +++ b/Common/src/main/java/dev/cammiescorner/icarus/client/ClientPlayerFallbackValues.java @@ -9,12 +9,14 @@ public class ClientPlayerFallbackValues extends ServerPlayerFallbackValues imple private final boolean armorSlows; private final float maxSlowedMultiplier; private final boolean canLoopDeLoop; + private final float requiredFoodAmount; - public ClientPlayerFallbackValues(float wingsSpeed, float maxSlowedMultiplier, boolean armorSlows, boolean canLoopDeLoop) { + public ClientPlayerFallbackValues(float wingsSpeed, float maxSlowedMultiplier, boolean armorSlows, boolean canLoopDeLoop, float requiredFoodAmount) { this.wingsSpeed = wingsSpeed; this.armorSlows = armorSlows; this.maxSlowedMultiplier = maxSlowedMultiplier; this.canLoopDeLoop = canLoopDeLoop; + this.requiredFoodAmount = requiredFoodAmount; } @Override @@ -36,4 +38,9 @@ public boolean armorSlows() { public boolean canLoopDeLoop() { return canLoopDeLoop; } + + @Override + public float requiredFoodAmount() { + return requiredFoodAmount; + } } diff --git a/Common/src/main/java/dev/cammiescorner/icarus/network/s2c/SyncConfigValuesPacket.java b/Common/src/main/java/dev/cammiescorner/icarus/network/s2c/SyncConfigValuesPacket.java index 2423724..e12faf8 100644 --- a/Common/src/main/java/dev/cammiescorner/icarus/network/s2c/SyncConfigValuesPacket.java +++ b/Common/src/main/java/dev/cammiescorner/icarus/network/s2c/SyncConfigValuesPacket.java @@ -11,7 +11,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; -public record SyncConfigValuesPacket(float wingsSpeed, float maxSlowedMultiplier, boolean armorSlows, boolean canLoopDeLoop) { +public record SyncConfigValuesPacket(float wingsSpeed, float maxSlowedMultiplier, boolean armorSlows, boolean canLoopDeLoop, float requiredFoodAmount) { public static final ResourceLocation ID = Icarus.id("sync_config_values"); public void encode(FriendlyByteBuf buf) { @@ -23,7 +23,7 @@ public void encode(FriendlyByteBuf buf) { public static void send(ServerPlayer player) { var cfg = new ServerPlayerFallbackValues(); - var packet = new SyncConfigValuesPacket(cfg.wingsSpeed(), cfg.maxSlowedMultiplier(), cfg.armorSlows(), cfg.canLoopDeLoop()); + var packet = new SyncConfigValuesPacket(cfg.wingsSpeed(), cfg.maxSlowedMultiplier(), cfg.armorSlows(), cfg.canLoopDeLoop(), cfg.requiredFoodAmount()); Dispatcher.sendToClient(packet, player); } @@ -32,8 +32,9 @@ public static SyncConfigValuesPacket decode(FriendlyByteBuf buf) { float maxSlowedMultiplier = buf.readFloat(); boolean armorSlows = buf.readBoolean(); boolean canLoopDeLoop = buf.readBoolean(); + float requiredFoodAmount = buf.readFloat(); - return new SyncConfigValuesPacket(wingsSpeed, maxSlowedMultiplier, armorSlows, canLoopDeLoop); + return new SyncConfigValuesPacket(wingsSpeed, maxSlowedMultiplier, armorSlows, canLoopDeLoop, requiredFoodAmount); } public static void handle(PacketContext ctx) { @@ -41,7 +42,8 @@ public static void handle(PacketContext ctx) { ctx.message().wingsSpeed(), ctx.message().maxSlowedMultiplier(), ctx.message().armorSlows(), - ctx.message().canLoopDeLoop() + ctx.message().canLoopDeLoop(), + ctx.message().requiredFoodAmount() )); } } diff --git a/Common/src/main/java/dev/cammiescorner/icarus/util/ServerPlayerFallbackValues.java b/Common/src/main/java/dev/cammiescorner/icarus/util/ServerPlayerFallbackValues.java index 94501d7..36dfb53 100644 --- a/Common/src/main/java/dev/cammiescorner/icarus/util/ServerPlayerFallbackValues.java +++ b/Common/src/main/java/dev/cammiescorner/icarus/util/ServerPlayerFallbackValues.java @@ -52,4 +52,9 @@ public TagKey noFlyingAllowedInDimensions() { public int maxHeightAboveWorld() { return IcarusConfig.maxHeightAboveWorld; } + + @Override + public float requiredFoodAmount() { + return IcarusConfig.requiredFoodAmount; + } }