Strip all Phase references, TODO/FUTURE roadmap notes, and internal planning comments from the codebase. Run Prettier for consistent formatting across all Java files.
65 lines
1.9 KiB
Java
65 lines
1.9 KiB
Java
package com.tiedup.remake.client.state;
|
|
|
|
import com.tiedup.remake.v2.bondage.movement.MovementStyle;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
/**
|
|
* Client-side cache of active movement style per player UUID.
|
|
*
|
|
* <p>Populated by {@link com.tiedup.remake.network.sync.PacketSyncMovementStyle}.
|
|
* Read by {@link com.tiedup.remake.client.animation.context.AnimationContextResolver}
|
|
* and {@link com.tiedup.remake.client.animation.tick.AnimationTickHandler}.</p>
|
|
*
|
|
* <p>Thread-safe via ConcurrentHashMap (same pattern as
|
|
* {@link PetBedClientState}).</p>
|
|
*/
|
|
@OnlyIn(Dist.CLIENT)
|
|
public class MovementStyleClientState {
|
|
|
|
private static final Map<UUID, MovementStyle> styles =
|
|
new ConcurrentHashMap<>();
|
|
|
|
/**
|
|
* Set the active movement style for a player.
|
|
*
|
|
* @param uuid the player's UUID
|
|
* @param style the active style (must not be null; use {@link #clear} for no style)
|
|
*/
|
|
public static void set(UUID uuid, MovementStyle style) {
|
|
styles.put(uuid, style);
|
|
}
|
|
|
|
/**
|
|
* Get the active movement style for a player.
|
|
*
|
|
* @param uuid the player's UUID
|
|
* @return the active style, or null if no movement style is active
|
|
*/
|
|
@Nullable
|
|
public static MovementStyle get(UUID uuid) {
|
|
return styles.get(uuid);
|
|
}
|
|
|
|
/**
|
|
* Clear the movement style for a player (no style active).
|
|
*
|
|
* @param uuid the player's UUID
|
|
*/
|
|
public static void clear(UUID uuid) {
|
|
styles.remove(uuid);
|
|
}
|
|
|
|
/**
|
|
* Clear all cached movement styles.
|
|
* Called on world unload to prevent memory leaks and stale data.
|
|
*/
|
|
public static void clearAll() {
|
|
styles.clear();
|
|
}
|
|
}
|