-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not apply optimizations to sprites with special tickers
- Loading branch information
1 parent
ffb8cba
commit 07ce020
Showing
4 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
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
5 changes: 5 additions & 0 deletions
5
...feinemc/mods/sodium/client/render/chunk/compile/pipeline/TextureAtlasSpriteExtension.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,5 @@ | ||
package net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline; | ||
|
||
public interface TextureAtlasSpriteExtension { | ||
boolean sodium$hasUnknownImageContents(); | ||
} |
33 changes: 33 additions & 0 deletions
33
...java/net/caffeinemc/mods/sodium/mixin/features/textures/scan/TextureAtlasSpriteMixin.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,33 @@ | ||
package net.caffeinemc.mods.sodium.mixin.features.textures.scan; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.TextureAtlasSpriteExtension; | ||
import net.minecraft.client.renderer.texture.SpriteContents; | ||
import net.minecraft.client.renderer.texture.SpriteTicker; | ||
import net.minecraft.client.renderer.texture.TextureAtlasSprite; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(TextureAtlasSprite.class) | ||
public class TextureAtlasSpriteMixin implements TextureAtlasSpriteExtension { | ||
@Unique | ||
private boolean hasUnknownImageContents; | ||
|
||
@WrapOperation(method = "createTicker", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/SpriteContents;createTicker()Lnet/minecraft/client/renderer/texture/SpriteTicker;")) | ||
private SpriteTicker hookTickerInstantiation(SpriteContents instance, Operation<SpriteTicker> original) { | ||
var ticker = original.call(instance); | ||
|
||
if (ticker != null && !(ticker instanceof SpriteContents.Ticker)) { | ||
this.hasUnknownImageContents = true; | ||
} | ||
|
||
return ticker; | ||
} | ||
|
||
@Override | ||
public boolean sodium$hasUnknownImageContents() { | ||
return this.hasUnknownImageContents; | ||
} | ||
} |
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