From ec76dd5c85c5cc463e94f53c63de5d3a1830f615 Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 6 Oct 2025 17:31:04 +0200 Subject: [PATCH] added boost charge when eating snacks --- .../game/stateless/types/turtleGame/TurtleGame.java | 2 +- .../stateless/types/turtleGame/gameObjects/Turtle.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/turtleGame/TurtleGame.java b/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/turtleGame/TurtleGame.java index a34ebab..3146a3a 100644 --- a/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/turtleGame/TurtleGame.java +++ b/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/turtleGame/TurtleGame.java @@ -122,6 +122,7 @@ class TurtleGame extends StatelessGame { this.snacks.remove(snack); snack.remove(); this.turtlePlayerMap.get(p).increaseScore(); + this.turtlePlayerMap.get(p).increaseBoostChargeLevel(0.02f); } protected void explode(Player p, Entity bomb) { @@ -184,7 +185,6 @@ class TurtleGame extends StatelessGame { meta.setBlock(this.snackBlock.withProperty("half", "upper")); meta.setCustomName(Component.text("Snack").color(NamedTextColor.WHITE)); meta.setCustomNameVisible(true); - meta.setHasGlowingEffect(true); snack.setInstance(this); Pos spawnPosition = this.newSpawnPosition(snack); if(spawnPosition == null) { diff --git a/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/turtleGame/gameObjects/Turtle.java b/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/turtleGame/gameObjects/Turtle.java index 7c75ef1..2f9328b 100644 --- a/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/turtleGame/gameObjects/Turtle.java +++ b/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/turtleGame/gameObjects/Turtle.java @@ -38,8 +38,7 @@ public class Turtle extends EntityCreature { public void startBoostRefill() { this.boostRefillTask = MinecraftServer.getSchedulerManager().scheduleTask(() -> { if(this.boostChargeLevel >= 1f) return; - this.boostChargeLevel = Math.min(1f, this.boostChargeLevel + 0.025f); - this.player.setExp(this.boostChargeLevel); + this.increaseBoostChargeLevel(0.02f); }, TaskSchedule.seconds(1), TaskSchedule.seconds(1)); } @@ -88,6 +87,11 @@ public class Turtle extends EntityCreature { this.boostSpeedMultiplier = 1; } + public void increaseBoostChargeLevel(float amount) { + this.boostChargeLevel = Math.min(1f, this.boostChargeLevel + amount); + this.player.setExp(this.boostChargeLevel); + } + public void addSpeed(double amount) { this.speed += amount; }