Skip to content

Commit

Permalink
Assign the right render layers to text, end portals, and lightning
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbot16 committed Jan 24, 2021
1 parent d2bca6e commit fe122ea
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class MixinRenderLayer implements ProgramRenderLayer {
@Shadow @Final @Mutable private static RenderLayer DIRECT_ENTITY_GLINT;

@Shadow @Final @Mutable private static RenderLayer TRANSLUCENT_MOVING_BLOCK;
@Shadow @Final @Mutable private static RenderLayer LIGHTNING;

@Override
public Optional<GbufferProgram> getProgram() {
Expand Down Expand Up @@ -96,7 +97,7 @@ public Optional<GbufferProgram> getProgram() {
ENTITY_GLINT = wrapGlint("entity", ENTITY_GLINT);
DIRECT_ENTITY_GLINT = wrapGlint("direct_entity_glint", DIRECT_ENTITY_GLINT);

// TODO: crumbling, text, text_see_through, lightning, end_portal
LIGHTNING = wrap("iris:lightning", LIGHTNING, GbufferProgram.ENTITIES);
}

/**
Expand Down Expand Up @@ -140,6 +141,8 @@ private static RenderLayer wrap(RenderLayer wrapped, GbufferProgram program) {
"getEntityDecal(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;",
"getEntityNoOutline(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;",
"getEntityShadow(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;",
"getText(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;",
"getTextSeeThrough(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;",
}, cancellable = true)
private static void iris$wrapEntityRenderLayers(Identifier texture, CallbackInfoReturnable<RenderLayer> cir) {
RenderLayer base = cir.getReturnValue();
Expand Down Expand Up @@ -214,4 +217,13 @@ private static RenderLayer wrap(RenderLayer wrapped, GbufferProgram program) {

cir.setReturnValue(wrap(base, GbufferProgram.DAMAGED_BLOCKS));
}

@Inject(at = @At("RETURN"), method = {
"getEndPortal(I)Lnet/minecraft/client/render/RenderLayer;"
}, cancellable = true)
private static void iris$wrapEndPortalRenderLayer(int layer, CallbackInfoReturnable<RenderLayer> cir) {
RenderLayer base = cir.getReturnValue();

cir.setReturnValue(wrap(base, GbufferProgram.BLOCK_ENTITIES));
}
}

0 comments on commit fe122ea

Please sign in to comment.