From 36e6329f2ba06dd98f0875f7f89e0a97e4f202dd Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Mon, 26 Oct 2026 15:02:56 +0100 Subject: [PATCH] Redraw beating wings every tick only after a jump The wing beat touch no longer lowers the entry's interval. Its wings are drawn every tick during the beat and at their usual interval otherwise; the extra redraws do not count towards the slot budget. --- .../lobby/particle/design/Designs.java | 4 +- .../lobby/particle/elements/Wing.java | 2 +- .../particle/elements/touch/AfterJump.java | 46 +++++++++++++++++++ .../lobby/particle/slot/ParticleEntry.java | 7 ++- 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 LobbySystem/src/de/steamwar/lobby/particle/elements/touch/AfterJump.java diff --git a/LobbySystem/src/de/steamwar/lobby/particle/design/Designs.java b/LobbySystem/src/de/steamwar/lobby/particle/design/Designs.java index ede7e6b5..7cb0c534 100644 --- a/LobbySystem/src/de/steamwar/lobby/particle/design/Designs.java +++ b/LobbySystem/src/de/steamwar/lobby/particle/design/Designs.java @@ -140,8 +140,8 @@ public class Designs { @Override public void adjust(Parameter changed, ParameterValues values) { - if (changed != WING_MOTION && changed != EntryParameters.TOUCH) return; - boolean moving = values.get(WING_MOTION) != Wing.Motion.NONE || values.get(EntryParameters.TOUCH) == Touches.JUMP_WINGS; + if (changed != WING_MOTION) return; + boolean moving = values.get(WING_MOTION) != Wing.Motion.NONE; int interval = values.get(EntryParameters.INTERVAL); if (moving && interval > MOVING_WING_INTERVAL) { values.set(EntryParameters.INTERVAL, MOVING_WING_INTERVAL); diff --git a/LobbySystem/src/de/steamwar/lobby/particle/elements/Wing.java b/LobbySystem/src/de/steamwar/lobby/particle/elements/Wing.java index 1f1fd578..45c2d377 100644 --- a/LobbySystem/src/de/steamwar/lobby/particle/elements/Wing.java +++ b/LobbySystem/src/de/steamwar/lobby/particle/elements/Wing.java @@ -42,7 +42,7 @@ public class Wing extends DelegatingParticleElement { private static final double MOVING_OPEN_DEGREES = 15; private static final double FULL_OPEN_SPEED = 0.6; private static final double FLAP_DEGREES = 25; - private static final int JUMP_BEAT_TICKS = 10; + public static final int JUMP_BEAT_TICKS = 10; private double size; private WingDesign wingDesign; diff --git a/LobbySystem/src/de/steamwar/lobby/particle/elements/touch/AfterJump.java b/LobbySystem/src/de/steamwar/lobby/particle/elements/touch/AfterJump.java new file mode 100644 index 00000000..adf8c5ce --- /dev/null +++ b/LobbySystem/src/de/steamwar/lobby/particle/elements/touch/AfterJump.java @@ -0,0 +1,46 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2025 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package de.steamwar.lobby.particle.elements.touch; + +import de.steamwar.lobby.particle.BodyMotion; +import de.steamwar.lobby.particle.ParticleElement; +import de.steamwar.lobby.particle.ParticleTickData; +import de.steamwar.lobby.particle.elements.DelegatingParticleElement; + +// Ticks the element every tick for a while after each jump, and as usual otherwise +public class AfterJump extends DelegatingParticleElement { + + private final ParticleElement otherwise; + private final int ticks; + + public AfterJump(ParticleElement particleElement, ParticleElement otherwise, int ticks) { + super(particleElement); + this.otherwise = otherwise; + this.ticks = ticks; + } + + @Override + public void tick(ParticleTickData particleTickData) { + if (BodyMotion.ticksSinceJump(particleTickData.getPlayer()) <= ticks) { + particleElement.tick(particleTickData); + } else { + otherwise.tick(particleTickData); + } + } +} diff --git a/LobbySystem/src/de/steamwar/lobby/particle/slot/ParticleEntry.java b/LobbySystem/src/de/steamwar/lobby/particle/slot/ParticleEntry.java index 66d2ca57..2623497c 100644 --- a/LobbySystem/src/de/steamwar/lobby/particle/slot/ParticleEntry.java +++ b/LobbySystem/src/de/steamwar/lobby/particle/slot/ParticleEntry.java @@ -27,6 +27,7 @@ import de.steamwar.lobby.particle.ParticleTickData; import de.steamwar.lobby.particle.UnlockContext; import de.steamwar.lobby.particle.design.*; import de.steamwar.lobby.particle.elements.*; +import de.steamwar.lobby.particle.elements.touch.AfterJump; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; @@ -98,7 +99,11 @@ public class ParticleEntry { element = values.get(VISIBILITY).wrap(element); int interval = values.get(INTERVAL); - if (interval > 1) { + if (interval > 1 && design.absorbsTouch(values.get(TOUCH))) { + // The jump beat needs every tick to look smooth; outside of it the usual interval applies, and the + // extra redraws are not counted towards the budget + element = new AfterJump(element, new Delayed(element, interval), Wing.JUMP_BEAT_TICKS); + } else if (interval > 1) { element = new Delayed(element, interval); } if (values.get(TICK_MODE) == TickMode.ALWAYS) {