refactor: simplify rendering logic, remove redundant cases, and replace bounds checks with Math.clamp

This commit is contained in:
MineTec committed 2026-06-21 18:09:11 +02:00
1 parent 1d3040610e
commit dce7804fed
10 files changed
+30 -34

No files matched your search

@@ -77,7 +77,7 @@ public final class CameraItems {
/** Returns a copy of {@code camera} with its film count set to {@code newCount} and lore refreshed. */
public static ItemStack withFilmCount(ItemStack camera, int newCount) {
int count = Math.max(0, Math.min(MAX_FILM, newCount));
int count = Math.clamp(newCount, 0, MAX_FILM);
ItemStack copy = camera.clone();
SkullMeta meta = (SkullMeta) copy.getItemMeta();
meta.getPersistentDataContainer().set(Main.getInstance().filmCountKey, PersistentDataType.INTEGER, count);
@@ -129,7 +129,7 @@ public class CraftingListener implements Listener {
return SurvivalRecipes.LOAD.equals(key) || SurvivalRecipes.COPY.equals(key);
}
/** A second photo referencing the same {@link MapView} and picture id as {@code photo}. */
/** A second photo referencing the same {@link org.bukkit.map.MapView} and picture id as {@code photo}. */
private static ItemStack buildPhotoCopy(ItemStack photo) {
MapMeta src = (MapMeta) photo.getItemMeta();
if (!src.hasMapView() || src.getMapView() == null) return null;