Skip to content

Commit

Permalink
Move RenderLayerUtil to kirin
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Jun 4, 2024
1 parent 7d739dc commit b6ae15f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.minelittlepony.common.util.render;

import java.util.Optional;
import net.minecraft.client.render.*;
import net.minecraft.client.render.VertexFormat.DrawMode;
import net.minecraft.util.Identifier;

public interface RenderLayerUtil {
static RenderLayer.MultiPhase layerOf(
Identifier name,
VertexFormat vertexFormat,
DrawMode drawMode,
int expectedBufferSize,
RenderLayer.MultiPhaseParameters phases) {
return RenderLayer.of(name.toString(), vertexFormat, drawMode, expectedBufferSize, phases);
}

static RenderLayer.MultiPhase layerOf(
Identifier name,
VertexFormat vertexFormat,
DrawMode drawMode,
int expectedBufferSize,
boolean crumbling,
boolean translucent,
RenderLayer.MultiPhaseParameters phases
) {
return RenderLayer.of(name.toString(), vertexFormat, drawMode, expectedBufferSize, crumbling, translucent, phases);
}

static Optional<Identifier> getTexture(RenderLayer layer) {
if (layer instanceof RenderLayer.MultiPhase multiphase) {
return multiphase.getPhases().texture.getId();
}
return Optional.empty();
}
}
9 changes: 9 additions & 0 deletions src/main/resources/kirin.aw
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ accessible method net/minecraft/client/gui/tooltip/TooltipState
extendable method net/minecraft/client/gui/tooltip/TooltipState createPositioner (Lnet/minecraft/client/gui/ScreenRect;ZZ)Lnet/minecraft/client/gui/tooltip/TooltipPositioner;
accessible field net/minecraft/client/gui/widget/ClickableWidget tooltip Lnet/minecraft/client/gui/tooltip/TooltipState;
mutable field net/minecraft/client/gui/widget/ClickableWidget tooltip Lnet/minecraft/client/gui/tooltip/TooltipState;

accessible method net/minecraft/client/render/RenderLayer of (Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;Lnet/minecraft/client/render/VertexFormat$DrawMode;ILnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;)Lnet/minecraft/client/render/RenderLayer$MultiPhase;
accessible method net/minecraft/client/render/RenderLayer of (Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;Lnet/minecraft/client/render/VertexFormat$DrawMode;IZZLnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;)Lnet/minecraft/client/render/RenderLayer$MultiPhase;

accessible class net/minecraft/client/render/RenderPhase$TextureBase

accessible method net/minecraft/client/render/RenderLayer$MultiPhase getPhases ()Lnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;
accessible method net/minecraft/client/render/RenderPhase$TextureBase getId ()Ljava/util/Optional;
accessible field net/minecraft/client/render/RenderLayer$MultiPhaseParameters texture Lnet/minecraft/client/render/RenderPhase$TextureBase;

0 comments on commit b6ae15f

Please sign in to comment.