From 3dab2d19a058bfcc1aa94817d99285a4584933b9 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:12:19 -0600 Subject: [PATCH] Naming fixes and backport misc. changes from 1.21 - Rename variables, fields, and methods to use "pack id" instead of "pack name" - Fix overlay CtmProperties naming variables and fields with "id" instead of "resourceId" - Use Identifier.withPath whenever possible - Add missing nullable annotations in BaseProcessingPredicate --- .../client/mixin/AtlasLoaderMixin.java | 2 +- .../AbstractQuadProcessorFactory.java | 4 +- .../processor/BaseProcessingPredicate.java | 2 + .../processor/CompactCtmQuadProcessor.java | 8 ++-- .../client/properties/BaseCtmProperties.java | 42 +++++++++---------- .../BasicConnectingCtmProperties.java | 2 +- .../CompactConnectingCtmProperties.java | 4 +- .../OrientedConnectingCtmProperties.java | 2 +- .../properties/PropertiesParsingHelper.java | 30 ++++++------- .../properties/RandomCtmProperties.java | 6 +-- .../properties/RepeatCtmProperties.java | 14 +++---- .../properties/TileAmountValidator.java | 4 +- .../overlay/BaseOverlayCtmProperties.java | 6 +-- ...rientedConnectingOverlayCtmProperties.java | 6 +-- .../overlay/OverlayPropertiesSection.java | 20 ++++----- .../overlay/RandomOverlayCtmProperties.java | 6 +-- .../overlay/RepeatOverlayCtmProperties.java | 6 +-- .../overlay/StandardOverlayCtmProperties.java | 10 ++--- .../client/resource/CustomBlockLayers.java | 4 +- .../resource/ResourceRedirectHandler.java | 2 +- .../client/util/biome/BiomeHolderManager.java | 2 +- 21 files changed, 92 insertions(+), 90 deletions(-) diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/AtlasLoaderMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/AtlasLoaderMixin.java index cc965c7..dcee9d6 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/AtlasLoaderMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/AtlasLoaderMixin.java @@ -63,7 +63,7 @@ abstract class AtlasLoaderMixin { Map emissiveIdMap = new Object2ObjectOpenHashMap<>(); suppliers.forEach((id, supplier) -> { if (!id.getPath().endsWith(emissiveSuffix)) { - Identifier emissiveId = new Identifier(id.getNamespace(), id.getPath() + emissiveSuffix); + Identifier emissiveId = id.withPath(id.getPath() + emissiveSuffix); if (!suppliers.containsKey(emissiveId)) { Identifier emissiveLocation = emissiveId.withPath("textures/" + emissiveId.getPath() + ".png"); Optional optionalResource = resourceManager.getResource(emissiveLocation); diff --git a/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessorFactory.java b/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessorFactory.java index 93d3a0a..be7bc6c 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessorFactory.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessorFactory.java @@ -19,7 +19,7 @@ public QuadProcessor createProcessor(T properties, Function textureAmount) { - ContinuityClient.LOGGER.warn("Method '" + properties.getMethod() + "' requires " + textureAmount + " tiles but " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.warn("Method '" + properties.getMethod() + "' requires " + textureAmount + " tiles but " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); max = textureAmount; } @@ -40,7 +40,7 @@ public QuadProcessor createProcessor(T properties, Function textureAmount) { if (replacementSprites == null) { - ContinuityClient.LOGGER.warn("Method '" + properties.getMethod() + "' requires " + textureAmount + " tiles but " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.warn("Method '" + properties.getMethod() + "' requires " + textureAmount + " tiles but " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); } max = textureAmount; } @@ -666,7 +666,7 @@ public QuadProcessor createProcessor(CompactConnectingCtmProperties properties, } if (provided < textureAmount) { - ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires at least " + textureAmount + " tiles but only " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires at least " + textureAmount + " tiles but only " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); for (int i = provided; i < textureAmount; i++) { sprites[i] = missingSprite; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/BaseCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/BaseCtmProperties.java index 0f687b8..8267449 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/BaseCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/BaseCtmProperties.java @@ -53,7 +53,7 @@ public class BaseCtmProperties implements CtmProperties { protected Properties properties; protected Identifier resourceId; - protected String packName; + protected String packId; protected int packPriority; protected ResourceManager resourceManager; protected String method; @@ -81,7 +81,7 @@ public class BaseCtmProperties implements CtmProperties { public BaseCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { this.properties = properties; this.resourceId = resourceId; - this.packName = pack.getName(); + this.packId = pack.getName(); this.packPriority = packPriority; this.resourceManager = resourceManager; this.method = method; @@ -135,14 +135,14 @@ public void init() { } protected void parseMatchTiles() { - matchTilesSet = PropertiesParsingHelper.parseMatchTiles(properties, "matchTiles", resourceId, packName, ResourceRedirectHandler.get(resourceManager)); + matchTilesSet = PropertiesParsingHelper.parseMatchTiles(properties, "matchTiles", resourceId, packId, ResourceRedirectHandler.get(resourceManager)); if (matchTilesSet != null && matchTilesSet.isEmpty()) { valid = false; } } protected void parseMatchBlocks() { - matchBlocksPredicate = PropertiesParsingHelper.parseBlockStates(properties, "matchBlocks", resourceId, packName); + matchBlocksPredicate = PropertiesParsingHelper.parseBlockStates(properties, "matchBlocks", resourceId, packId); if (matchBlocksPredicate == PropertiesParsingHelper.EMPTY_BLOCK_STATE_PREDICATE) { valid = false; } @@ -167,7 +167,7 @@ protected void detectMatches() { protected void validateMatches() { if (matchTilesSet == null && matchBlocksPredicate == null) { - ContinuityClient.LOGGER.error("No tile or block matches provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No tile or block matches provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; } } @@ -175,7 +175,7 @@ protected void validateMatches() { protected void parseTiles() { String tilesStr = properties.getProperty("tiles"); if (tilesStr == null) { - ContinuityClient.LOGGER.error("No 'tiles' value provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No 'tiles' value provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; return; } @@ -208,13 +208,13 @@ protected void parseTiles() { if (min <= max) { try { for (int tile = min; tile <= max; tile++) { - listBuilder.add(new Identifier(resourceId.getNamespace(), basePath + tile + ".png")); + listBuilder.add(resourceId.withPath(basePath + tile + ".png")); } } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'", e); } } else { - ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } continue; } catch (NumberFormatException e) { @@ -271,11 +271,11 @@ protected void parseTiles() { try { listBuilder.add(new Identifier(namespace, path)); } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'", e); } } } else { - ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } } @@ -313,7 +313,7 @@ protected void parseFaces() { try { faces.add(Direction.valueOf(faceStr1)); } catch (IllegalArgumentException e) { - ContinuityClient.LOGGER.warn("Unknown 'faces' element '" + faceStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown 'faces' element '" + faceStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } } } @@ -356,7 +356,7 @@ protected void parseBiomes() { Identifier biomeId = new Identifier(biomeStr.toLowerCase(Locale.ROOT)); biomeHolderSet.add(BiomeHolderManager.getOrCreateHolder(biomeId)); } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid 'biomes' element '" + biomeStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid 'biomes' element '" + biomeStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'", e); } } @@ -446,7 +446,7 @@ protected void parseHeights() { } } } - ContinuityClient.LOGGER.warn("Invalid 'heights' element '" + heightStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'heights' element '" + heightStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } if (!predicateList.isEmpty()) { @@ -480,7 +480,7 @@ protected void parseLegacyHeights() { try { min = Integer.parseInt(minHeightStr.trim()); } catch (NumberFormatException e) { - ContinuityClient.LOGGER.warn("Invalid 'minHeight' value '" + minHeightStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'minHeight' value '" + minHeightStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); hasMinHeight = false; } } @@ -488,7 +488,7 @@ protected void parseLegacyHeights() { try { max = Integer.parseInt(maxHeightStr.trim()); } catch (NumberFormatException e) { - ContinuityClient.LOGGER.warn("Invalid 'maxHeight' value '" + minHeightStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'maxHeight' value '" + minHeightStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); hasMaxHeight = false; } } @@ -586,7 +586,7 @@ protected void parseResourceCondition() { try { resourceId = new Identifier(resourceStr); } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid resource '" + resourceStr + "' in 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + this.resourceId + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid resource '" + resourceStr + "' in 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + this.resourceId + "' in pack '" + packId + "'", e); continue; } @@ -610,10 +610,10 @@ protected void parseResourceCondition() { break; } } else { - ContinuityClient.LOGGER.warn("Unknown pack '" + packStr + "' in 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + this.resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown pack '" + packStr + "' in 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + this.resourceId + "' in pack '" + packId + "'"); } } else { - ContinuityClient.LOGGER.warn("Invalid 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } } } @@ -666,8 +666,8 @@ public Identifier getResourceId() { return resourceId; } - public String getPackName() { - return packName; + public String getPackId() { + return packId; } public int getPackPriority() { diff --git a/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java index ee4ddf3..6e46feb 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java @@ -55,7 +55,7 @@ protected void detectConnect() { protected void validateConnect() { if (connectionPredicate == null) { - ContinuityClient.LOGGER.error("No valid connection type provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No valid connection type provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/CompactConnectingCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/CompactConnectingCtmProperties.java index e55b967..4420d74 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/CompactConnectingCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/CompactConnectingCtmProperties.java @@ -49,12 +49,12 @@ protected void parseTileReplacements() { try { value = Integer.parseInt(valueStr); } catch (NumberFormatException e) { - ContinuityClient.LOGGER.warn("Invalid '" + key + "' value '" + valueStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid '" + key + "' value '" + valueStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); continue; } // TODO: deduplicate code if (value < 0) { - ContinuityClient.LOGGER.warn("Invalid '" + key + "' value '" + valueStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid '" + key + "' value '" + valueStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); continue; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/OrientedConnectingCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/OrientedConnectingCtmProperties.java index 420f7a1..744e435 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/OrientedConnectingCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/OrientedConnectingCtmProperties.java @@ -26,7 +26,7 @@ public void init() { } protected void parseOrient() { - OrientationMode orientationMode = PropertiesParsingHelper.parseOrientationMode(properties, "orient", resourceId, packName); + OrientationMode orientationMode = PropertiesParsingHelper.parseOrientationMode(properties, "orient", resourceId, packId); if (orientationMode != null) { this.orientationMode = orientationMode; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java b/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java index ed914a4..1fe61a0 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java @@ -35,7 +35,7 @@ public final class PropertiesParsingHelper { public static final Predicate EMPTY_BLOCK_STATE_PREDICATE = state -> false; @Nullable - public static Set parseMatchTiles(Properties properties, String propertyKey, Identifier fileLocation, String packName, @Nullable ResourceRedirectHandler redirectHandler) { + public static Set parseMatchTiles(Properties properties, String propertyKey, Identifier fileLocation, String packId, @Nullable ResourceRedirectHandler redirectHandler) { String matchTilesStr = properties.getProperty(propertyKey); if (matchTilesStr == null) { return null; @@ -101,10 +101,10 @@ public static Set parseMatchTiles(Properties properties, String prop try { set.add(new Identifier(namespace, path)); } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + matchTileStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + matchTileStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'", e); } } else { - ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + matchTileStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + matchTileStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); } } @@ -115,7 +115,7 @@ public static Set parseMatchTiles(Properties properties, String prop } @Nullable - public static Predicate parseBlockStates(Properties properties, String propertyKey, Identifier fileLocation, String packName) { + public static Predicate parseBlockStates(Properties properties, String propertyKey, Identifier fileLocation, String packId) { String blockStatesStr = properties.getProperty(propertyKey); if (blockStatesStr == null) { return null; @@ -146,7 +146,7 @@ public static Predicate parseBlockStates(Properties properties, Stri startIndex = 2; } } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'", e); continue; } @@ -174,20 +174,20 @@ public static Predicate parseBlockStates(Properties properties, Stri if (optionalValue.isPresent()) { valueSet.add(optionalValue.get()); } else { - ContinuityClient.LOGGER.warn("Invalid block property value '" + propertyValueStr + "' for property '" + propertyName + "' for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid block property value '" + propertyValueStr + "' for property '" + propertyName + "' for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); continue Block; } } } else { - ContinuityClient.LOGGER.warn("Invalid block property definition for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid block property definition for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); continue Block; } } else { - ContinuityClient.LOGGER.warn("Unknown block property '" + propertyName + "' for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown block property '" + propertyName + "' for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); continue Block; } } else { - ContinuityClient.LOGGER.warn("Invalid block property definition for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid block property definition for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); continue Block; } } @@ -214,10 +214,10 @@ public static Predicate parseBlockStates(Properties properties, Stri } } } else { - ContinuityClient.LOGGER.warn("Unknown block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); } } else { - ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); } } @@ -266,7 +266,7 @@ public static Predicate parseBlockStates(Properties properties, Stri } @Nullable - public static Symmetry parseSymmetry(Properties properties, String propertyKey, Identifier fileLocation, String packName) { + public static Symmetry parseSymmetry(Properties properties, String propertyKey, Identifier fileLocation, String packId) { String symmetryStr = properties.getProperty(propertyKey); if (symmetryStr == null) { return null; @@ -275,13 +275,13 @@ public static Symmetry parseSymmetry(Properties properties, String propertyKey, try { return Symmetry.valueOf(symmetryStr.trim().toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { - ContinuityClient.LOGGER.warn("Unknown '" + propertyKey + "' value '" + symmetryStr + "' in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown '" + propertyKey + "' value '" + symmetryStr + "' in file '" + fileLocation + "' in pack '" + packId + "'"); } return null; } @Nullable - public static OrientationMode parseOrientationMode(Properties properties, String propertyKey, Identifier fileLocation, String packName) { + public static OrientationMode parseOrientationMode(Properties properties, String propertyKey, Identifier fileLocation, String packId) { String orientationModeStr = properties.getProperty(propertyKey); if (orientationModeStr == null) { return null; @@ -290,7 +290,7 @@ public static OrientationMode parseOrientationMode(Properties properties, String try { return OrientationMode.valueOf(orientationModeStr.trim().toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { - ContinuityClient.LOGGER.warn("Unknown '" + propertyKey + "' value '" + orientationModeStr + "' in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown '" + propertyKey + "' value '" + orientationModeStr + "' in file '" + fileLocation + "' in pack '" + packId + "'"); } return null; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/RandomCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/RandomCtmProperties.java index f7eea82..50352db 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/RandomCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/RandomCtmProperties.java @@ -67,7 +67,7 @@ protected void parseWeights() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.warn("Invalid 'weights' element '" + weightStr + "' at index '" + i + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'weights' element '" + weightStr + "' at index '" + i + "' in file '" + resourceId + "' in pack '" + packId + "'"); } if (!weights.isEmpty()) { @@ -91,11 +91,11 @@ protected void parseRandomLoops() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.warn("Invalid 'randomLoops' value '" + randomLoopsStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'randomLoops' value '" + randomLoopsStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); } protected void parseSymmetry() { - Symmetry symmetry = PropertiesParsingHelper.parseSymmetry(properties, "symmetry", resourceId, packName); + Symmetry symmetry = PropertiesParsingHelper.parseSymmetry(properties, "symmetry", resourceId, packId); if (symmetry != null) { this.symmetry = symmetry; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/RepeatCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/RepeatCtmProperties.java index 9f93c7f..fd6c71c 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/RepeatCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/RepeatCtmProperties.java @@ -31,7 +31,7 @@ public void init() { protected void parseWidth() { String widthStr = properties.getProperty("width"); if (widthStr == null) { - ContinuityClient.LOGGER.error("No 'width' value provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No 'width' value provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; return; } @@ -45,14 +45,14 @@ protected void parseWidth() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.error("Invalid 'width' value '" + widthStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("Invalid 'width' value '" + widthStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; } protected void parseHeight() { String heightStr = properties.getProperty("height"); if (heightStr == null) { - ContinuityClient.LOGGER.error("No 'height' value provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No 'height' value provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; return; } @@ -66,19 +66,19 @@ protected void parseHeight() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.error("Invalid 'height' value '" + heightStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("Invalid 'height' value '" + heightStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; } protected void parseSymmetry() { - Symmetry symmetry = PropertiesParsingHelper.parseSymmetry(properties, "symmetry", resourceId, packName); + Symmetry symmetry = PropertiesParsingHelper.parseSymmetry(properties, "symmetry", resourceId, packId); if (symmetry != null) { this.symmetry = symmetry; } } protected void parseOrient() { - OrientationMode orientationMode = PropertiesParsingHelper.parseOrientationMode(properties, "orient", resourceId, packName); + OrientationMode orientationMode = PropertiesParsingHelper.parseOrientationMode(properties, "orient", resourceId, packId); if (orientationMode != null) { this.orientationMode = orientationMode; } @@ -107,7 +107,7 @@ public boolean validateTileAmount(int amount, T properties) { if (amount == targetAmount) { return true; } - ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires exactly " + targetAmount + " tiles but " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires exactly " + targetAmount + " tiles but " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); return false; } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/TileAmountValidator.java b/src/main/java/me/pepperbell/continuity/client/properties/TileAmountValidator.java index 589e686..0636f3e 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/TileAmountValidator.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/TileAmountValidator.java @@ -31,7 +31,7 @@ public boolean validateTileAmount(int amount, T properties) { if (amount == targetAmount) { return true; } - ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires exactly " + targetAmount + " tiles but " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires exactly " + targetAmount + " tiles but " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); return false; } } @@ -48,7 +48,7 @@ public boolean validateTileAmount(int amount, T properties) { if (amount >= targetAmount) { return true; } - ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires at least " + targetAmount + " tiles but only " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires at least " + targetAmount + " tiles but only " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); return false; } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/BaseOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/BaseOverlayCtmProperties.java index a6769b0..9aa0772 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/BaseOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/BaseOverlayCtmProperties.java @@ -10,9 +10,9 @@ public class BaseOverlayCtmProperties extends BaseCtmProperties implements OverlayPropertiesSection.Provider { protected OverlayPropertiesSection overlaySection; - public BaseOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { - super(properties, id, pack, packPriority, resourceManager, method); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public BaseOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { + super(properties, resourceId, pack, packPriority, resourceManager, method); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } @Override diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/OrientedConnectingOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/OrientedConnectingOverlayCtmProperties.java index 5ad4de2..2c64394 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/OrientedConnectingOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/OrientedConnectingOverlayCtmProperties.java @@ -11,9 +11,9 @@ public class OrientedConnectingOverlayCtmProperties extends OrientedConnectingCtmProperties implements OverlayPropertiesSection.Provider { protected OverlayPropertiesSection overlaySection; - public OrientedConnectingOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method, OrientationMode defaultOrientationMode) { - super(properties, id, pack, packPriority, resourceManager, method, defaultOrientationMode); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public OrientedConnectingOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method, OrientationMode defaultOrientationMode) { + super(properties, resourceId, pack, packPriority, resourceManager, method, defaultOrientationMode); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } public OrientedConnectingOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/OverlayPropertiesSection.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/OverlayPropertiesSection.java index f05d185..46cb410 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/OverlayPropertiesSection.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/OverlayPropertiesSection.java @@ -15,18 +15,18 @@ public class OverlayPropertiesSection { protected Properties properties; - protected Identifier id; - protected String packName; + protected Identifier resourceId; + protected String packId; protected int tintIndex = -1; @Nullable protected BlockState tintBlock; protected BlendMode layer = BlendMode.CUTOUT_MIPPED; - public OverlayPropertiesSection(Properties properties, Identifier id, String packName) { + public OverlayPropertiesSection(Properties properties, Identifier resourceId, String packId) { this.properties = properties; - this.id = id; - this.packName = packName; + this.resourceId = resourceId; + this.packId = packId; } public void init() { @@ -50,7 +50,7 @@ protected void parseTintIndex() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.warn("Invalid 'tintIndex' value '" + tintIndexStr + "' in file '" + id + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'tintIndex' value '" + tintIndexStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); } protected void parseTintBlock() { @@ -69,7 +69,7 @@ protected void parseTintBlock() { blockId = new Identifier(parts[0], parts[1]); } } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid 'tintBlock' value '" + tintBlockStr + "' in file '" + id + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid 'tintBlock' value '" + tintBlockStr + "' in file '" + resourceId + "' in pack '" + packId + "'", e); return; } @@ -77,10 +77,10 @@ protected void parseTintBlock() { Block block = Registries.BLOCK.get(blockId); tintBlock = block.getDefaultState(); } else { - ContinuityClient.LOGGER.warn("Unknown block '" + blockId + "' in 'tintBlock' value '" + tintBlockStr + "' in file '" + id + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown block '" + blockId + "' in 'tintBlock' value '" + tintBlockStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); } } else { - ContinuityClient.LOGGER.warn("Invalid 'tintBlock' value '" + tintBlockStr + "' in file '" + id + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'tintBlock' value '" + tintBlockStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); } } @@ -95,7 +95,7 @@ protected void parseLayer() { case "cutout_mipped" -> layer = BlendMode.CUTOUT_MIPPED; case "cutout" -> layer = BlendMode.CUTOUT; case "translucent" -> layer = BlendMode.TRANSLUCENT; - default -> ContinuityClient.LOGGER.warn("Unknown 'layer' value '" + layerStr + " in file '" + id + "' in pack '" + packName + "'"); + default -> ContinuityClient.LOGGER.warn("Unknown 'layer' value '" + layerStr + " in file '" + resourceId + "' in pack '" + packId + "'"); } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/RandomOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/RandomOverlayCtmProperties.java index ed2100c..ba87d79 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/RandomOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/RandomOverlayCtmProperties.java @@ -10,9 +10,9 @@ public class RandomOverlayCtmProperties extends RandomCtmProperties implements OverlayPropertiesSection.Provider { protected OverlayPropertiesSection overlaySection; - public RandomOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { - super(properties, id, pack, packPriority, resourceManager, method); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public RandomOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { + super(properties, resourceId, pack, packPriority, resourceManager, method); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } @Override diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/RepeatOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/RepeatOverlayCtmProperties.java index 7e7d229..0960582 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/RepeatOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/RepeatOverlayCtmProperties.java @@ -10,9 +10,9 @@ public class RepeatOverlayCtmProperties extends RepeatCtmProperties implements OverlayPropertiesSection.Provider { protected OverlayPropertiesSection overlaySection; - public RepeatOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { - super(properties, id, pack, packPriority, resourceManager, method); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public RepeatOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { + super(properties, resourceId, pack, packPriority, resourceManager, method); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } @Override diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/StandardOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/StandardOverlayCtmProperties.java index a20fa43..aeba0f0 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/StandardOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/StandardOverlayCtmProperties.java @@ -21,9 +21,9 @@ public class StandardOverlayCtmProperties extends BasicConnectingCtmProperties i @Nullable protected Predicate connectBlocksPredicate; - public StandardOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { - super(properties, id, pack, packPriority, resourceManager, method); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public StandardOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { + super(properties, resourceId, pack, packPriority, resourceManager, method); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } @Override @@ -40,11 +40,11 @@ public OverlayPropertiesSection getOverlayPropertiesSection() { } protected void parseConnectTiles() { - connectTilesSet = PropertiesParsingHelper.parseMatchTiles(properties, "connectTiles", resourceId, packName, ResourceRedirectHandler.get(resourceManager)); + connectTilesSet = PropertiesParsingHelper.parseMatchTiles(properties, "connectTiles", resourceId, packId, ResourceRedirectHandler.get(resourceManager)); } protected void parseConnectBlocks() { - connectBlocksPredicate = PropertiesParsingHelper.parseBlockStates(properties, "connectBlocks", resourceId, packName); + connectBlocksPredicate = PropertiesParsingHelper.parseBlockStates(properties, "connectBlocks", resourceId, packId); } @Nullable diff --git a/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java b/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java index 0b16bf5..a1d502b 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java @@ -76,10 +76,10 @@ private static void reload(ResourceManager manager) { } } - private static void reload(Properties properties, Identifier fileLocation, String packName) { + private static void reload(Properties properties, Identifier fileLocation, String packId) { for (BlockLayer blockLayer : BlockLayer.VALUES) { String propertyKey = "layer." + blockLayer.getKey(); - Predicate predicate = PropertiesParsingHelper.parseBlockStates(properties, propertyKey, fileLocation, packName); + Predicate predicate = PropertiesParsingHelper.parseBlockStates(properties, propertyKey, fileLocation, packId); if (predicate != null && predicate != PropertiesParsingHelper.EMPTY_BLOCK_STATE_PREDICATE) { LAYER_PREDICATES[blockLayer.ordinal()] = predicate; empty = false; diff --git a/src/main/java/me/pepperbell/continuity/client/resource/ResourceRedirectHandler.java b/src/main/java/me/pepperbell/continuity/client/resource/ResourceRedirectHandler.java index 58cef42..a57b995 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/ResourceRedirectHandler.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/ResourceRedirectHandler.java @@ -88,7 +88,7 @@ public Identifier redirect(Identifier id) { BooleanState invalidIdentifierState = InvalidIdentifierStateHolder.get(); invalidIdentifierState.enable(); - Identifier newId = new Identifier(id.getNamespace(), newPath); + Identifier newId = id.withPath(newPath); invalidIdentifierState.disable(); return newId; diff --git a/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java b/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java index c80247d..d4fd669 100644 --- a/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java +++ b/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java @@ -44,7 +44,7 @@ public static void refreshHolders() { String path = id.getPath(); String compactPath = path.replace("_", ""); if (!path.equals(compactPath)) { - Identifier compactId = new Identifier(id.getNamespace(), compactPath); + Identifier compactId = id.withPath(compactPath); if (!biomeRegistry.containsId(compactId)) { compactIdMap.put(compactId, id); }