Skip to content

Commit c6dc0b0

Browse files
committed
Tile parsing fixes
- Tweak how matchTiles is parsed - Clean up resolveTiles - Rename some methods - Update buildscript, Gradle, and build dependencies
1 parent 8f786db commit c6dc0b0

7 files changed

Lines changed: 28 additions & 42 deletions

File tree

build.gradle

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies {
4545
}
4646

4747
modCompileOnly 'maven.modrinth:sodium:mc1.17.1-0.3.3'
48-
modCompileOnly 'io.vram:canvas-fabric-mc117-1.17:1.0.2195'
48+
modCompileOnly 'io.vram:canvas-fabric-mc117:1.0.2219'
4949
}
5050

5151
String getExtraBuildMetadata() {
@@ -65,12 +65,6 @@ processResources {
6565
}
6666

6767
tasks.withType(JavaCompile).configureEach {
68-
// ensure that the encoding is set to UTF-8, no matter what the system default is
69-
// this fixes some edge cases with special characters not displaying correctly
70-
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
71-
// If Javadoc is generated, this must be specified in that task too.
72-
it.options.encoding 'UTF-8'
73-
7468
// Minecraft 1.17 (21w19a) upwards uses Java 16.
7569
it.options.release.set(16)
7670
}
@@ -92,13 +86,7 @@ jar {
9286
publishing {
9387
publications {
9488
mavenJava(MavenPublication) {
95-
// add all the jars that should be included when publishing to maven
96-
artifact(remapJar) {
97-
builtBy remapJar
98-
}
99-
artifact(sourcesJar) {
100-
builtBy remapSourcesJar
101-
}
89+
from components.java
10290
}
10391
}
10492

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Done to increase the memory available to gradle.
1+
# Done to increase the memory available to Gradle.
22
org.gradle.jvmargs = -Xmx1G
33

44
# Fabric Properties
55
loom_version = 0.10-SNAPSHOT
66
minecraft_version = 1.17.1
7-
yarn_mappings = 1.17.1+build.64
8-
loader_version = 0.12.5
7+
yarn_mappings = 1.17.1+build.65
8+
loader_version = 0.12.8
99

1010
# Mod Properties
11-
mod_version = 1.0.2
11+
mod_version = 1.0.3
1212
mod_minecraft_version = 1.17
1313
maven_group = me.pepperbell
1414
archives_base_name = continuity
1515

1616
# Dependencies
17-
fabric_version = 0.43.0+1.17
17+
fabric_version = 0.44.0+1.17
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/me/pepperbell/continuity/client/properties/BaseCTMProperties.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public boolean affectsBlockState(BlockState state) {
109109
@Override
110110
public Set<SpriteIdentifier> getTextureDependencies() {
111111
if (textureDependencies == null) {
112-
processTiles();
112+
resolveTiles();
113113
}
114114
return textureDependencies;
115115
}
@@ -551,32 +551,30 @@ protected boolean isValid() {
551551
return valid;
552552
}
553553

554-
protected void processTiles() {
554+
protected void resolveTiles() {
555555
textureDependencies = new ObjectOpenHashSet<>();
556556
spriteIds = new ObjectArrayList<>();
557557
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
558558
for (Identifier tile : tiles) {
559-
SpriteIdentifier spriteId = null;
559+
SpriteIdentifier spriteId;
560560
if (tile.equals(SPECIAL_SKIP_ID)) {
561561
spriteId = SPECIAL_SKIP_SPRITE_ID;
562562
} else if (tile.equals(SPECIAL_DEFAULT_ID)) {
563563
spriteId = SPECIAL_DEFAULT_SPRITE_ID;
564-
}
565-
if (spriteId == null) {
566-
Identifier newTile;
567-
if (tile.getPath().startsWith("textures/")) {
568-
String newPath = tile.getPath().substring(9);
569-
if (newPath.endsWith(".png")) {
570-
newPath = newPath.substring(0, newPath.length() - 4);
564+
} else {
565+
String namespace = tile.getNamespace();
566+
String path = tile.getPath();
567+
if (path.startsWith("textures/")) {
568+
path = path.substring(9);
569+
if (path.endsWith(".png")) {
570+
path = path.substring(0, path.length() - 4);
571571
}
572-
newTile = new Identifier(tile.getNamespace(), newPath);
573572
} else {
574-
String newPath = getRedirectPath(tile.getPath());
575-
Identifier newId = new Identifier(tile.getNamespace(), "textures/" + newPath + ".png");
576-
ResourceRedirectHelper.addRedirect(resourceManager, newId, tile);
577-
newTile = new Identifier(tile.getNamespace(), newPath);
573+
path = getRedirectPath(path);
574+
Identifier redirectId = new Identifier(namespace, "textures/" + path + ".png");
575+
ResourceRedirectHelper.addRedirect(resourceManager, redirectId, tile);
578576
}
579-
spriteId = TextureUtil.toSpriteId(newTile);
577+
spriteId = TextureUtil.toSpriteId(new Identifier(namespace, path));
580578
textureDependencies.add(spriteId);
581579
}
582580
spriteIds.add(spriteId);
@@ -629,7 +627,7 @@ public Predicate<String> getBlockEntityNamePredicate() {
629627

630628
public List<SpriteIdentifier> getSpriteIds() {
631629
if (spriteIds == null) {
632-
processTiles();
630+
resolveTiles();
633631
}
634632
return spriteIds;
635633
}

src/main/java/me/pepperbell/continuity/client/resource/CTMLoadingContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void addMultipassDependent(CTMLoadingContainer<?> dependent) {
4242
multipassDependents.add(dependent);
4343
}
4444

45-
public void calculateRecursiveMultipassDependents(Set<CTMLoadingContainer<?>> traversedContainers) {
45+
public void resolveRecursiveMultipassDependents(Set<CTMLoadingContainer<?>> traversedContainers) {
4646
if (multipassDependents != null) {
4747
recursiveMultipassDependents = new ObjectOpenHashSet<>();
4848
addDependentsRecursively(this, traversedContainers);

src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static void loadAll(ResourceManager resourceManager) {
5050
packPriority++;
5151
}
5252
InvalidIdentifierHandler.disableInvalidPaths();
53-
calculateMultipassDependents();
53+
resolveMultipassDependents();
5454
}
5555

5656
private static void loadAll(ResourcePack pack, int packPriority) {
@@ -95,7 +95,7 @@ private static <T extends CTMProperties> void load(CTMLoader<T> loader, Properti
9595
}
9696
}
9797

98-
private static void calculateMultipassDependents() {
98+
private static void resolveMultipassDependents() {
9999
Object2ObjectOpenHashMap<Identifier, CTMLoadingContainer<?>> texture2ContainerMap = new Object2ObjectOpenHashMap<>();
100100
Object2ObjectOpenHashMap<Identifier, List<CTMLoadingContainer<?>>> texture2ContainerListMap = new Object2ObjectOpenHashMap<>();
101101

@@ -158,7 +158,7 @@ private static void calculateMultipassDependents() {
158158
Set<CTMLoadingContainer<?>> traversedContainers = new ObjectOpenHashSet<>();
159159
for (int i = 0; i < amount; i++) {
160160
CTMLoadingContainer<?> container = ALL.get(i);
161-
container.calculateRecursiveMultipassDependents(traversedContainers);
161+
container.resolveRecursiveMultipassDependents(traversedContainers);
162162
}
163163
}
164164

src/main/java/me/pepperbell/continuity/client/util/PropertiesParsingHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static ImmutableSet<Identifier> parseMatchTiles(Properties properties, St
6262
}
6363
if (path.startsWith("textures/")) {
6464
path = path.substring(9);
65-
} else {
65+
} else if (path.startsWith("optifine/")) {
6666
path = BaseCTMProperties.getRedirectPath(path + ".png");
6767
}
6868
try {

0 commit comments

Comments
 (0)