Skip to content

Commit

Permalink
Rename some mixins, change mixin list order
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Sep 11, 2021
1 parent fb22e63 commit 8120675
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.List;

@Mixin(DebugScreenOverlay.class)
public abstract class MixinDebugHud {
public abstract class MixinDebugScreenOverlay {
@Inject(method = "getGameInformation", at = @At("RETURN"))
private void batchedentityrendering$appendStats(CallbackInfoReturnable<List<String>> cir) {
List<String> messages = cir.getReturnValue();
Expand Down
50 changes: 0 additions & 50 deletions src/main/java/net/coderbot/iris/mixin/MixinSpriteAtlasTexture.java

This file was deleted.

28 changes: 24 additions & 4 deletions src/main/java/net/coderbot/iris/mixin/MixinTextureAtlas.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package net.coderbot.iris.mixin;

import com.mojang.blaze3d.systems.RenderSystem;
import net.coderbot.iris.texunits.TextureAtlasInterface;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.Stitcher;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.world.phys.Vec2;
import org.lwjgl.opengl.GL20C;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -14,17 +17,34 @@
import java.util.List;

@Mixin(TextureAtlas.class)
public class MixinTextureAtlas implements TextureAtlasInterface {
public abstract class MixinTextureAtlas extends AbstractTexture implements TextureAtlasInterface {
private Vec2 atlasSize;

@Inject(method = "getLoadedSprites", at = @At("HEAD"))
private void getAtlasSize(ResourceManager resourceManager, Stitcher textureStitcher, int maxLevel, CallbackInfoReturnable<List<TextureAtlasSprite>> cir) {
atlasSize = new Vec2(textureStitcher.getWidth(), textureStitcher.getHeight());
private void getAtlasSize(ResourceManager resourceManager, Stitcher stitcher, int i, CallbackInfoReturnable<List<TextureAtlasSprite>> cir) {
this.atlasSize = new Vec2(stitcher.getWidth(), stitcher.getHeight());
}

@Override
public Vec2 getAtlasSize() {
return atlasSize;
if (this.atlasSize == null) {
// support for DashLoader (and other mods which might mess with the other code path)
int glId = this.getId();

// Keep track of what texture was bound before
int existingGlId = GL20C.glGetInteger(GL20C.GL_TEXTURE_BINDING_2D);

// Bind this texture and grab the atlas size from it.
RenderSystem.bindTexture(glId);
int width = GL20C.glGetTexLevelParameteri(GL20C.GL_TEXTURE_2D, 0, GL20C.GL_TEXTURE_WIDTH);
int height = GL20C.glGetTexLevelParameteri(GL20C.GL_TEXTURE_2D, 0, GL20C.GL_TEXTURE_HEIGHT);
this.atlasSize = new Vec2(width, height);

// Make sure to re-bind the previous texture to avoid issues.
RenderSystem.bindTexture(existingGlId);
}

return this.atlasSize;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* because they implement their own lighting effects, which visually clash with vanilla's directional shading lighting.
*/
@Mixin(ClientLevel.class)
public class MixinClientWorld {
public class MixinClientLevel {
@ModifyVariable(method = "getShade", at = @At("HEAD"))
private boolean iris$maybeDisableDirectionalShading(boolean shaded) {
if (BlockRenderingSettings.INSTANCE.shouldDisableDirectionalShading()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"MixinBufferBuilder",
"MixinBufferBuilder_SegmentRendering",
"MixinRenderBuffers",
"MixinDebugHud",
"MixinDebugScreenOverlay",
"MixinTheEndPortalRenderer",
"MixinMultiBufferSourceChild",
"MixinCompositeRenderType",
Expand Down
34 changes: 17 additions & 17 deletions src/main/resources/mixins.iris.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,47 @@
"plugin": "net.coderbot.iris.mixin.shadows.IrisShadowsMixinPlugin",
"compatibilityLevel": "JAVA_8",
"client": [
"DimensionTypeAccessor",
"LevelRendererAccessor",
"MixinBlockStateBehavior",
"MixinFogRenderer",
"MixinClientLanguage",
"MixinDebugScreenOverlay",
"MixinTheEndPortalRenderer",
"MixinEntityRenderDispatcher",
"MixinFogRenderer",
"MixinGameRenderer",
"MixinGlStateManager",
"MixinMultiBufferSourceChild",
"MixinLevelRenderer",
"MixinLivingEntityRenderer",
"MixinModelViewBobbing",
"MixinMultiBufferSourceChild",
"MixinParticleEngine",
"MixinSpriteAtlasTexture",
"MixinTextureAtlas",
"MixinTheEndPortalRenderer",
"MixinTitleScreen",
"MixinTntMinecartEntityRenderer",
"MixinClientLanguage",
"MixinTweakFarPlane",
"MixinLevelRenderer",
"LevelRendererAccessor",
"entity_render_context.MixinBlockEntityRenderDispatcher",
"entity_render_context.MixinEntityRenderDispatcher",
"fabulous.MixinDisableFabulousGraphics",
"fabulous.MixinOption",
"gui.MixinGui",
"gui.MixinVideoSettingsScreen",
"math.MixinMatrix4f",
"entity_render_context.MixinBlockEntityRenderDispatcher",
"entity_render_context.MixinEntityRenderDispatcher",
"rendertype.MixinFixEyesTranslucency",
"rendertype.MixinRenderType",
"rendertype.RenderTypeAccessor",
"rendertype.RenderStateShardAccessor",
"rendertype.RenderTypeAccessor",
"shadows.MixinBeaconRenderer",
"shadows.MixinPreventRebuildNearInShadowPass",
"shadows.MixinLevelRenderer",
"texunits.MixinBufferVertexConsumer",
"texunits.MixinGlStateManager",
"texunits.MixinLightTexture",
"texunits.MixinOverlayTexture",
"texunits.MixinDefaultVertexFormat",
"shadows.MixinPreventRebuildNearInShadowPass",
"statelisteners.CapabilityTrackerAccessor",
"statelisteners.GlStateManagerAccessor",
"statelisteners.MixinGlStateManager",
"DimensionTypeAccessor"
"texunits.MixinBufferVertexConsumer",
"texunits.MixinDefaultVertexFormat",
"texunits.MixinGlStateManager",
"texunits.MixinLightTexture",
"texunits.MixinOverlayTexture"
],
"injectors": {
"defaultRequire": 1
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mixins.iris.vertexformat.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MixinVertexFormat",
"block_rendering.MixinBufferBuilder_SeparateAo",
"block_rendering.MixinChunkRebuildTask",
"block_rendering.MixinClientWorld"
"block_rendering.MixinClientLevel"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 8120675

Please sign in to comment.