-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compatibility for CITR emissives
- Rename BiomeView to ChunkRendererRegionExtension - Update Gradle
- Loading branch information
1 parent
1b6154c
commit 5f1bc3a
Showing
10 changed files
with
93 additions
and
14 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ntinuity/client/util/biome/BiomeView.java → ...terface/ChunkRendererRegionExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package me.pepperbell.continuity.client.util.biome; | ||
package me.pepperbell.continuity.client.mixinterface; | ||
|
||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.registry.RegistryEntry; | ||
import net.minecraft.world.biome.Biome; | ||
|
||
public interface BiomeView { | ||
public interface ChunkRendererRegionExtension { | ||
RegistryEntry<Biome> continuity$getBiome(BlockPos pos); | ||
} |
64 changes: 64 additions & 0 deletions
64
src/main/java/me/pepperbell/continuity/client/resource/EmissiveIdProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package me.pepperbell.continuity.client.resource; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.minecraft.util.Identifier; | ||
|
||
public final class EmissiveIdProvider { | ||
private static final Provider PROVIDER = createProvider(); | ||
|
||
private static Provider createProvider() { | ||
if (FabricLoader.getInstance().isModLoaded("citresewn-defaults")) { | ||
return EmissiveIdProvider::toEmissiveIdCITR; | ||
} | ||
|
||
return EmissiveIdProvider::toEmissiveIdStandard; | ||
} | ||
|
||
@Nullable | ||
public static Identifier toEmissiveId(Identifier spriteId, String emissiveSuffix) { | ||
return PROVIDER.toEmissiveId(spriteId, emissiveSuffix); | ||
} | ||
|
||
@ApiStatus.Internal | ||
public static void init() { | ||
} | ||
|
||
@Nullable | ||
private static Identifier toEmissiveIdStandard(Identifier spriteId, String emissiveSuffix) { | ||
String path = spriteId.getPath(); | ||
if (!path.endsWith(emissiveSuffix)) { | ||
return new Identifier(spriteId.getNamespace(), path + emissiveSuffix); | ||
} | ||
return null; | ||
} | ||
|
||
/** | ||
* Sprite identifiers never have an extension in vanilla. CIT Resewn adds a png extension to some identifiers and | ||
* changes SpriteAtlasTexture#getTexturePath to interpret those identifiers as absolute texture locations. This code | ||
* accounts for the possibility of the identifier having a png extension and appends the emissive suffix before it. | ||
*/ | ||
@Nullable | ||
private static Identifier toEmissiveIdCITR(Identifier spriteId, String emissiveSuffix) { | ||
String path = spriteId.getPath(); | ||
boolean hasExtension = path.endsWith(".png"); | ||
if (hasExtension) { | ||
path = path.substring(0, path.length() - 4); | ||
} | ||
if (!path.endsWith(emissiveSuffix)) { | ||
String emissivePath = path + emissiveSuffix; | ||
if (hasExtension) { | ||
emissivePath += ".png"; | ||
} | ||
return new Identifier(spriteId.getNamespace(), emissivePath); | ||
} | ||
return null; | ||
} | ||
|
||
private interface Provider { | ||
@Nullable | ||
Identifier toEmissiveId(Identifier spriteId, String emissiveSuffix); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters