Fix item quads not using the existing vertex color when applying tint colors.

This commit is contained in:
David Quintana 2019-12-20 04:50:40 +01:00
parent 503d277033
commit c3b1f47754
2 changed files with 25 additions and 4 deletions

View file

@ -38,6 +38,15 @@
}
p_229111_4_.func_227865_b_();
@@ -129,7 +133,7 @@
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
- p_229112_2_.func_227889_a_(matrixstack$entry, bakedquad, f, f1, f2, p_229112_5_, p_229112_6_);
+ p_229112_2_.addVertexData(matrixstack$entry, bakedquad, f, f1, f2, p_229112_5_, p_229112_6_, true);
}
}
@@ -216,6 +220,7 @@
crashreportcategory.func_189529_a("Item Type", () -> {
return String.valueOf((Object)p_184391_2_.func_77973_b());

View file

@ -34,13 +34,25 @@ import java.nio.IntBuffer;
public interface IForgeVertexBuilder
{
default IVertexBuilder getVertexBuilder() { return (IVertexBuilder)this; }
// Copy of func_227889_a_, but enables tinting
default void addVertexData(MatrixStack.Entry matrixStack, BakedQuad bakedQuad, float red, float green, float blue, int lightmapCoord, int overlayColor, boolean readExistingColor) {
getVertexBuilder().func_227890_a_(matrixStack, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, readExistingColor);
}
// Copy of func_227889_a_ with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColkor) {
addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColkor, false);
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor) {
addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, false);
}
// Copy of func_227889_a_ with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor, boolean readExistingColor) {
addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, readExistingColor);
}
// Copy of func_227890_a_ with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean p_227890_9_) {
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) {
int[] aint = bakedQuad.getVertexData();
Vec3i faceNormal = bakedQuad.getFace().getDirectionVec();
Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ());
@ -63,7 +75,7 @@ public interface IForgeVertexBuilder
float cg;
float cb;
float ca;
if (p_227890_9_) {
if (readExistingColor) {
float r = (float)(bytebuffer.get(12) & 255) / 255.0F;
float g = (float)(bytebuffer.get(13) & 255) / 255.0F;
float b = (float)(bytebuffer.get(14) & 255) / 255.0F;