Updated ForgeDev MCP Mapping Version (#6532)

This commit is contained in:
DaemonUmbra authored and GitHub committed 2020-02-25 19:45:14 -08:00
1 parent aca45340bf
commit 2ce4f5ece5
83 files changed
+392 -379

No files matched your search

@@ -35,6 +35,6 @@ public interface IForgeModelTransform
*/
default TransformationMatrix getPartTransformation(Object part)
{
return TransformationMatrix.func_227983_a_();
return TransformationMatrix.identity();
}
}
@@ -36,22 +36,22 @@ public interface IForgeTransformationMatrix
default boolean isIdentity()
{
return getTransformaion().equals(TransformationMatrix.func_227983_a_());
return getTransformaion().equals(TransformationMatrix.identity());
}
default void push(MatrixStack stack)
{
stack.func_227860_a_();
stack.push();
Vector3f trans = getTransformaion().getTranslation();
stack.func_227861_a_(trans.getX(), trans.getY(), trans.getZ());
stack.translate(trans.getX(), trans.getY(), trans.getZ());
stack.func_227863_a_(getTransformaion().func_227989_d_());
stack.rotate(getTransformaion().getRotationLeft());
Vector3f scale = getTransformaion().getScale();
stack.func_227862_a_(scale.getX(), scale.getY(), scale.getZ());
stack.scale(scale.getX(), scale.getY(), scale.getZ());
stack.func_227863_a_(getTransformaion().getRightRot());
stack.rotate(getTransformaion().getRightRot());
}
@@ -59,33 +59,33 @@ public interface IForgeTransformationMatrix
{
if (getTransformaion().isIdentity()) return other;
if (other.isIdentity()) return getTransformaion();
Matrix4f m = getTransformaion().func_227988_c_();
m.func_226595_a_(other.func_227988_c_());
Matrix4f m = getTransformaion().getMatrix();
m.mul(other.getMatrix());
return new TransformationMatrix(m);
}
default TransformationMatrix inverse()
{
if (isIdentity()) return getTransformaion();
Matrix4f m = getTransformaion().func_227988_c_().func_226601_d_();
m.func_226600_c_();
Matrix4f m = getTransformaion().getMatrix().copy();
m.invert();
return new TransformationMatrix(m);
}
default void transformPosition(Vector4f position)
{
position.func_229372_a_(getTransformaion().func_227988_c_());
position.transform(getTransformaion().getMatrix());
}
default void transformNormal(Vector3f normal)
{
normal.func_229188_a_(getTransformaion().getNormalMatrix());
normal.func_229194_d_();
normal.transform(getTransformaion().getNormalMatrix());
normal.normalize();
}
default Direction rotateTransform(Direction facing)
{
return Direction.func_229385_a_(getTransformaion().func_227988_c_(), facing);
return Direction.rotateFace(getTransformaion().getMatrix(), facing);
}
/**
@@ -94,14 +94,14 @@ public interface IForgeTransformationMatrix
default TransformationMatrix blockCenterToCorner()
{
TransformationMatrix transform = getTransformaion();
if (transform.isIdentity()) return TransformationMatrix.func_227983_a_();
if (transform.isIdentity()) return TransformationMatrix.identity();
Matrix4f ret = transform.func_227988_c_();
Matrix4f tmp = Matrix4f.func_226599_b_(.5f, .5f, .5f);
Matrix4f ret = transform.getMatrix();
Matrix4f tmp = Matrix4f.makeTranslate(.5f, .5f, .5f);
ret.multiplyBackward(tmp);
tmp.func_226591_a_();
tmp.setIdentity();
tmp.setTranslation(-.5f, -.5f, -.5f);
ret.func_226595_a_(tmp);
ret.mul(tmp);
return new TransformationMatrix(ret);
}
@@ -111,14 +111,14 @@ public interface IForgeTransformationMatrix
default TransformationMatrix blockCornerToCenter()
{
TransformationMatrix transform = getTransformaion();
if (transform.isIdentity()) return TransformationMatrix.func_227983_a_();
if (transform.isIdentity()) return TransformationMatrix.identity();
Matrix4f ret = transform.func_227988_c_();
Matrix4f tmp = Matrix4f.func_226599_b_(-.5f, -.5f, -.5f);
Matrix4f ret = transform.getMatrix();
Matrix4f tmp = Matrix4f.makeTranslate(-.5f, -.5f, -.5f);
ret.multiplyBackward(tmp);
tmp.func_226591_a_();
tmp.setIdentity();
tmp.setTranslation(.5f, .5f, .5f);
ret.func_226595_a_(tmp);
ret.mul(tmp);
return new TransformationMatrix(ret);
}
@@ -43,7 +43,7 @@ public interface IForgeVertexBuilder
// 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);
getVertexBuilder().addQuad(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
@@ -56,13 +56,13 @@ public interface IForgeVertexBuilder
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
// Copy of addQuad 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 readExistingColor) {
int[] aint = bakedQuad.getVertexData();
Vec3i faceNormal = bakedQuad.getFace().getDirectionVec();
Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ());
Matrix4f matrix4f = matrixEntry.func_227870_a_();
normal.func_229188_a_(matrixEntry.func_227872_b_());
Matrix4f matrix4f = matrixEntry.getMatrix();
normal.transform(matrixEntry.getNormal());
int intSize = DefaultVertexFormats.BLOCK.getIntegerSize();
int vertexCount = aint.length / intSize;
@@ -100,22 +100,22 @@ public interface IForgeVertexBuilder
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
Vector4f pos = new Vector4f(f, f1, f2, 1.0F);
pos.func_229372_a_(matrix4f);
applyBakedNormals(normal, bytebuffer, matrixEntry.func_227872_b_());
((IVertexBuilder)this).func_225588_a_(pos.getX(), pos.getY(), pos.getZ(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.getX(), normal.getY(), normal.getZ());
pos.transform(matrix4f);
applyBakedNormals(normal, bytebuffer, matrixEntry.getNormal());
((IVertexBuilder)this).addVertex(pos.getX(), pos.getY(), pos.getZ(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.getX(), normal.getY(), normal.getZ());
}
}
}
default int applyBakedLighting(int lightmapCoord, ByteBuffer data) {
int bl = LightTexture.func_228450_a_(lightmapCoord);
int sl = LightTexture.func_228454_b_(lightmapCoord);
int bl = LightTexture.getLightBlock(lightmapCoord);
int sl = LightTexture.getLightSky(lightmapCoord);
int offset = LightUtil.getLightOffset(0) * 4; // int offset for vertex 0 * 4 bytes per int
int blBaked = Short.toUnsignedInt(data.getShort(offset)) >> 4;
int slBaked = Short.toUnsignedInt(data.getShort(offset + 2)) >> 4;
bl = Math.max(bl, blBaked);
sl = Math.max(sl, slBaked);
return LightTexture.func_228451_a_(bl, sl);
return LightTexture.packLight(bl, sl);
}
default void applyBakedNormals(Vector3f generated, ByteBuffer data, Matrix3f normalTransform) {
@@ -124,7 +124,7 @@ public interface IForgeVertexBuilder
byte nz = data.get(30);
if (nx != 0 || ny != 0 || nz != 0) {
generated.set(nx / 127f, ny / 127f, nz / 127f);
generated.func_229188_a_(normalTransform);
generated.transform(normalTransform);
}
}
}