@@ -56,6 +56,7 @@ public final class LoopDeLoopActive {
5656 private final List <LoopDeLoopWinner > finished ;
5757 private final LoopDeLoopSpawnLogic spawnLogic ;
5858 private final LoopDeLoopTimerBar timerBar = new LoopDeLoopTimerBar ();
59+ // Only stores flying players, i.e non-completed players
5960 private final Object2ObjectMap <ServerPlayerEntity , LoopDeLoopPlayer > player_states ;
6061 @ Nullable
6162 private ServerPlayerEntity lastCompleter ;
@@ -231,6 +232,7 @@ private void tickPlayers(long time) {
231232 if (nextHoop >= this .map .hoops .size ()) {
232233 iterator .remove ();
233234 this .finished .add (new LoopDeLoopWinner (player .getEntityName (), time ));
235+ this .player_states .remove (player );
234236 int idx = this .finished .size ();
235237 player .sendMessage (new LiteralText ("You finished in " + ordinal (idx ) + " place!" ), true );
236238 player .playSound (SoundEvents .ENTITY_PLAYER_LEVELUP , SoundCategory .PLAYERS , 1.0F , 1.0F );
@@ -239,6 +241,10 @@ private void tickPlayers(long time) {
239241 continue ;
240242 }
241243
244+ if (state .lastHoop != -1 && player .isOnGround ()) {
245+ this .failHoop (player , state , time );
246+ }
247+
242248 LoopDeLoopHoop hoop = this .map .hoops .get (nextHoop );
243249
244250 int lastHoopZ ;
@@ -263,27 +269,20 @@ private void tickPlayers(long time) {
263269 player .getX () > Math .max (centre .getX (), lastHoopX ) + 30 ||
264270 player .getX () < Math .min (centre .getX (), lastHoopX ) - 30 ;
265271
266- // The two parts of the `or` here represent the two paths: the player is moving fast, or they are moving slow
267- //
268- // If they are moving fast, the line segment connecting their past and present movement will intersect the
269- // hoop's circle and the first part will be true.
270- //
271- // If they are moving slow, there may not be enough precision to detect this, so the slow path is fallen back
272- // to, simply checking if the end coordinate is inside of the hoop.
273272 if (hoop .intersectsSegment (state .lastPos , player .getPos ())) {
274273 player .playSound (SoundEvents .ENTITY_EXPERIENCE_ORB_PICKUP , SoundCategory .PLAYERS , 1.0F , 1.0F );
275274 giveRocket (player , 1 );
276275 state .lastHoop += 1 ;
277- } else if (( time - state . lastFailTp > 5 ) && outOfBounds ) {
278- this .failHoop (player , state , time );
276+ } else if (outOfBounds ) {
277+ this .failHoop (player , state , time );
279278 }
280279
281280 state .lastPos = player .getPos ();
282281 }
283282 }
284283
285284 private void failHoop (ServerPlayerEntity player , LoopDeLoopPlayer state , long time ) {
286- if (time - state .lastFailTp < 5 ) {
285+ if (time - state .lastFailTp < 20 ) {
287286 return ;
288287 }
289288
0 commit comments