1.15 port

This commit is contained in:
yueh
2020-05-18 14:02:45 +02:00
parent 0ea86c939c
commit 16d6d55d7f
630 changed files with 4211 additions and 12664 deletions
@@ -73,10 +73,10 @@ public class CachedFormat
public CachedFormat( VertexFormat format )
{
this.format = format;
this.elementCount = format.getElementCount();
this.elementCount = format.getElements().size();
for( int i = 0; i < this.elementCount; i++ )
{
VertexFormatElement element = format.getElement( i );
VertexFormatElement element = format.getElements().get( i );
switch( element.getUsage() )
{
case POSITION:
@@ -19,18 +19,16 @@
package appeng.thirdparty.codechicken.lib.model;
import javax.vecmath.Vector3f;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.IVertexProducer;
import net.minecraftforge.client.model.pipeline.LightUtil;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import appeng.thirdparty.codechicken.lib.math.InterpHelper;
@@ -46,7 +44,7 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
public CachedFormat format;
public int tintIndex = -1;
public EnumFacing orientation;
public Direction orientation;
public boolean diffuseLighting = true;
public TextureAtlasSprite sprite;
@@ -91,7 +89,7 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
}
@Override
public void setQuadOrientation( EnumFacing orientation )
public void setQuadOrientation( Direction orientation )
{
this.orientation = orientation;
}
@@ -129,10 +127,10 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
{
this.vertexIndex = 0;
this.full = true;
if(orientation == null)
if( this.orientation == null )
{
calculateOrientation(false);
}
this.calculateOrientation( false );
}
}
}
}
@@ -198,40 +196,41 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
vec[1] = (float) MathHelper.clamp( vec[1], bb.minY, bb.maxY );
vec[2] = (float) MathHelper.clamp( vec[2], bb.minZ, bb.maxZ );
}
calculateOrientation(true);
this.calculateOrientation( true );
}
/**
* Re-calculates the Orientation of this quad,
* optionally the normal vector.
*
* @param setNormal If the normal vector should be updated.
*/
/**
* Re-calculates the Orientation of this quad,
* optionally the normal vector.
*
* @param setNormal If the normal vector should be updated.
*/
public void calculateOrientation( boolean setNormal )
{
this.v1.set( this.vertices[3].vec );
this.t.set( this.vertices[1].vec );
this.v1.sub( this.t );
{
this.v1.set( this.vertices[3].vec );
this.t.set( this.vertices[1].vec );
this.v1.sub( this.t );
this.v2.set( this.vertices[2].vec );
this.t.set( this.vertices[0].vec );
this.v2.sub( this.t );
this.v2.set( this.vertices[2].vec );
this.t.set( this.vertices[0].vec );
this.v2.sub( this.t );
this.normal.cross( this.v2, this.v1 );
this.normal.normalize();
this.normal.set( this.v2.getX(), this.v2.getY(), this.v2.getZ() );
this.normal.cross( this.v1 );
this.normal.normalize();
if( this.format.hasNormal && setNormal)
{
for( Vertex vertex : this.vertices )
{
vertex.normal[0] = this.normal.x;
vertex.normal[1] = this.normal.y;
vertex.normal[2] = this.normal.z;
vertex.normal[3] = 0;
}
}
this.orientation = EnumFacing.getFacingFromVector( this.normal.x, this.normal.y, this.normal.z );
}
if( this.format.hasNormal && setNormal )
{
for( Vertex vertex : this.vertices )
{
vertex.normal[0] = this.normal.getX();
vertex.normal[1] = this.normal.getY();
vertex.normal[2] = this.normal.getZ();
vertex.normal[3] = 0;
}
}
this.orientation = Direction.getFacingFromVector( this.normal.getX(), this.normal.getY(), this.normal.getZ() );
}
/**
* Used to create a new quad complete copy of this one.
@@ -27,9 +27,8 @@ import java.util.stream.Collectors;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import appeng.thirdparty.codechicken.lib.model.CachedFormat;
import appeng.thirdparty.codechicken.lib.model.ISmartVertexConsumer;
@@ -223,7 +222,7 @@ public class BakedPipeline implements ISmartVertexConsumer
}
@Override
public void setQuadOrientation( EnumFacing orientation )
public void setQuadOrientation( Direction orientation )
{
this.check();
this.unpacker.setQuadOrientation( orientation );
@@ -23,7 +23,7 @@ import javax.annotation.OverridingMethodsMustInvokeSuper;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import appeng.thirdparty.codechicken.lib.model.CachedFormat;
@@ -108,7 +108,7 @@ public abstract class QuadTransformer implements IVertexConsumer, ISmartVertexCo
}
@Override
public void setQuadOrientation( EnumFacing orientation )
public void setQuadOrientation( Direction orientation )
{
this.quad.setQuadOrientation( orientation );
}
@@ -19,11 +19,11 @@
package appeng.thirdparty.codechicken.lib.model.pipeline.transformers;
import static net.minecraft.util.EnumFacing.AxisDirection.NEGATIVE;
import static net.minecraft.util.EnumFacing.AxisDirection.POSITIVE;
import static net.minecraft.util.Direction.AxisDirection.NEGATIVE;
import static net.minecraft.util.Direction.AxisDirection.POSITIVE;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.AxisDirection;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3i;
@@ -140,7 +140,7 @@ public class QuadCornerKicker extends QuadTransformer
float z = vertex.vec[2];
if( epsComp( x, corner.pX( this.box ) ) && epsComp( y, corner.pY( this.box ) ) && epsComp( z, corner.pZ( this.box ) ) )
{
Vec3i vec = EnumFacing.VALUES[hoz].getDirectionVec();
Vec3i vec = Direction.values()[hoz].getDirectionVec();
x -= vec.getX() * this.thickness;
y -= vec.getY() * this.thickness;
z -= vec.getZ() * this.thickness;
@@ -19,9 +19,9 @@
package appeng.thirdparty.codechicken.lib.model.pipeline.transformers;
import static net.minecraft.util.EnumFacing.AxisDirection.POSITIVE;
import static net.minecraft.util.Direction.AxisDirection.POSITIVE;
import net.minecraft.util.EnumFacing.AxisDirection;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;