make cards more card like instead of just layers of flat textures.
This commit is contained in:
@@ -27,12 +27,15 @@ import org.joml.Matrix4f;
|
|||||||
public final class TriadCardItemRenderer extends BlockEntityWithoutLevelRenderer {
|
public final class TriadCardItemRenderer extends BlockEntityWithoutLevelRenderer {
|
||||||
private static final float CARD_MIN = -0.42F;
|
private static final float CARD_MIN = -0.42F;
|
||||||
private static final float CARD_MAX = 0.42F;
|
private static final float CARD_MAX = 0.42F;
|
||||||
private static final float FRONT_Z = 0.024F;
|
private static final float CARD_DEPTH = 0.024F;
|
||||||
private static final float BACK_Z = -0.024F;
|
private static final float FRONT_Z = CARD_DEPTH;
|
||||||
private static final float BORDER_Z = 0.026F;
|
private static final float BACK_Z = -CARD_DEPTH;
|
||||||
private static final float VALUE_Z = 0.030F;
|
private static final float ART_Z = FRONT_Z + 0.004F;
|
||||||
|
private static final float BORDER_Z = FRONT_Z + 0.008F;
|
||||||
|
private static final float VALUE_Z = FRONT_Z + 0.012F;
|
||||||
private static final float INNER_MIN = -0.37F;
|
private static final float INNER_MIN = -0.37F;
|
||||||
private static final float INNER_MAX = 0.37F;
|
private static final float INNER_MAX = 0.37F;
|
||||||
|
private static final float[] EDGE_COLOR = new float[] {0.18F, 0.14F, 0.10F};
|
||||||
private static TriadCardItemRenderer INSTANCE;
|
private static TriadCardItemRenderer INSTANCE;
|
||||||
private static final CardPalette NEUTRAL_PALETTE = new CardPalette(
|
private static final CardPalette NEUTRAL_PALETTE = new CardPalette(
|
||||||
new float[] {0.97F, 0.93F, 0.80F},
|
new float[] {0.97F, 0.93F, 0.80F},
|
||||||
@@ -77,6 +80,7 @@ public final class TriadCardItemRenderer extends BlockEntityWithoutLevelRenderer
|
|||||||
CardDefinition card = cardData == null || cardData.equals(CardStackData.EMPTY) ? null : CardRegistry.get(cardData.cardId());
|
CardDefinition card = cardData == null || cardData.equals(CardStackData.EMPTY) ? null : CardRegistry.get(cardData.cardId());
|
||||||
|
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
|
drawCardBody(poseStack, buffer);
|
||||||
drawBack(poseStack, buffer);
|
drawBack(poseStack, buffer);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
drawFrontArt(poseStack, buffer, artTexture(card));
|
drawFrontArt(poseStack, buffer, artTexture(card));
|
||||||
@@ -94,6 +98,25 @@ public final class TriadCardItemRenderer extends BlockEntityWithoutLevelRenderer
|
|||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void drawCardBody(PoseStack poseStack, MultiBufferSource buffer) {
|
||||||
|
float r = EDGE_COLOR[0];
|
||||||
|
float g = EDGE_COLOR[1];
|
||||||
|
float b = EDGE_COLOR[2];
|
||||||
|
LevelRenderer.addChainedFilledBoxVertices(
|
||||||
|
poseStack,
|
||||||
|
buffer.getBuffer(RenderType.debugFilledBox()),
|
||||||
|
CARD_MIN,
|
||||||
|
CARD_MIN,
|
||||||
|
BACK_Z,
|
||||||
|
CARD_MAX,
|
||||||
|
CARD_MAX,
|
||||||
|
FRONT_Z,
|
||||||
|
r,
|
||||||
|
g,
|
||||||
|
b,
|
||||||
|
1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
private static String displayRank(int rank) {
|
private static String displayRank(int rank) {
|
||||||
return rank == 10 ? "A" : Integer.toString(rank);
|
return rank == 10 ? "A" : Integer.toString(rank);
|
||||||
}
|
}
|
||||||
@@ -161,7 +184,7 @@ public final class TriadCardItemRenderer extends BlockEntityWithoutLevelRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void drawFrontArt(PoseStack poseStack, MultiBufferSource buffer, ResourceLocation textureLocation) {
|
private static void drawFrontArt(PoseStack poseStack, MultiBufferSource buffer, ResourceLocation textureLocation) {
|
||||||
drawTexturedQuad(poseStack, buffer, textureLocation, FRONT_Z, false);
|
drawTexturedQuad(poseStack, buffer, textureLocation, ART_Z, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawTexturedQuad(PoseStack poseStack, MultiBufferSource buffer, ResourceLocation textureLocation, float z, boolean reverseWinding) {
|
private static void drawTexturedQuad(PoseStack poseStack, MultiBufferSource buffer, ResourceLocation textureLocation, float z, boolean reverseWinding) {
|
||||||
|
|||||||
Reference in New Issue
Block a user