pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -18,7 +18,6 @@
package appeng.client.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.*;
@@ -26,118 +25,89 @@ import net.minecraft.util.Direction;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.Vec3i;
/**
* TODO: Removed useless stuff.
*/
public enum FacingToRotation implements IStringSerializable
{
public enum FacingToRotation implements IStringSerializable {
// DUNSWE
// @formatter:off
DOWN_DOWN( new Vector3f( 0, 0, 0 ) ), // NOOP
DOWN_UP( new Vector3f( 0, 0, 0 ) ), // NOOP
DOWN_NORTH( new Vector3f( -90, 0, 0 ) ),
DOWN_SOUTH( new Vector3f( -90, 0, 180 ) ),
DOWN_WEST( new Vector3f( -90, 0, 90 ) ),
DOWN_EAST( new Vector3f( -90, 0, -90 ) ),
UP_DOWN( new Vector3f( 0, 0, 0 ) ), // NOOP
UP_UP( new Vector3f( 0, 0, 0 ) ), // NOOP
UP_NORTH( new Vector3f( 90, 0, 180 ) ),
UP_SOUTH( new Vector3f( 90, 0, 0 ) ),
UP_WEST( new Vector3f( 90, 0, 90 ) ),
UP_EAST( new Vector3f( 90, 0, -90 ) ),
NORTH_DOWN( new Vector3f( 0, 0, 180 ) ),
NORTH_UP( new Vector3f( 0, 0, 0 ) ),
NORTH_NORTH( new Vector3f( 0, 0, 0 ) ), // NOOP
NORTH_SOUTH( new Vector3f( 0, 0, 0 ) ), // NOOP
NORTH_WEST( new Vector3f( 0, 0, 90 ) ),
NORTH_EAST( new Vector3f( 0, 0, -90 ) ),
SOUTH_DOWN( new Vector3f( 0, 180, 180 ) ),
SOUTH_UP( new Vector3f( 0, 180, 0 ) ),
SOUTH_NORTH( new Vector3f( 0, 0, 0 ) ), // NOOP
SOUTH_SOUTH( new Vector3f( 0, 0, 0 ) ), // NOOP
SOUTH_WEST( new Vector3f( 0, 180, -90 ) ),
SOUTH_EAST( new Vector3f( 0, 180, 90 ) ),
WEST_DOWN( new Vector3f( 0, 90, 180 ) ),
WEST_UP( new Vector3f( 0, 90, 0 ) ),
WEST_NORTH( new Vector3f( 0, 90, -90 ) ),
WEST_SOUTH( new Vector3f( 0, 90, 90 ) ),
WEST_WEST( new Vector3f( 0, 0, 0 ) ), // NOOP
WEST_EAST( new Vector3f( 0, 0, 0 ) ), // NOOP
EAST_DOWN( new Vector3f( 0, -90, 180 ) ),
EAST_UP( new Vector3f( 0, -90, 0 ) ),
EAST_NORTH( new Vector3f( 0, -90, 90 ) ),
EAST_SOUTH( new Vector3f( 0, -90, -90 ) ),
EAST_WEST( new Vector3f( 0, 0, 0 ) ), // NOOP
EAST_EAST( new Vector3f( 0, 0, 0 ) ); // NOOP
// @formatter:on
// DUNSWE
// @formatter:off
DOWN_DOWN(new Vector3f(0, 0, 0)), // NOOP
DOWN_UP(new Vector3f(0, 0, 0)), // NOOP
DOWN_NORTH(new Vector3f(-90, 0, 0)), DOWN_SOUTH(new Vector3f(-90, 0, 180)), DOWN_WEST(new Vector3f(-90, 0, 90)),
DOWN_EAST(new Vector3f(-90, 0, -90)), UP_DOWN(new Vector3f(0, 0, 0)), // NOOP
UP_UP(new Vector3f(0, 0, 0)), // NOOP
UP_NORTH(new Vector3f(90, 0, 180)), UP_SOUTH(new Vector3f(90, 0, 0)), UP_WEST(new Vector3f(90, 0, 90)),
UP_EAST(new Vector3f(90, 0, -90)), NORTH_DOWN(new Vector3f(0, 0, 180)), NORTH_UP(new Vector3f(0, 0, 0)),
NORTH_NORTH(new Vector3f(0, 0, 0)), // NOOP
NORTH_SOUTH(new Vector3f(0, 0, 0)), // NOOP
NORTH_WEST(new Vector3f(0, 0, 90)), NORTH_EAST(new Vector3f(0, 0, -90)), SOUTH_DOWN(new Vector3f(0, 180, 180)),
SOUTH_UP(new Vector3f(0, 180, 0)), SOUTH_NORTH(new Vector3f(0, 0, 0)), // NOOP
SOUTH_SOUTH(new Vector3f(0, 0, 0)), // NOOP
SOUTH_WEST(new Vector3f(0, 180, -90)), SOUTH_EAST(new Vector3f(0, 180, 90)), WEST_DOWN(new Vector3f(0, 90, 180)),
WEST_UP(new Vector3f(0, 90, 0)), WEST_NORTH(new Vector3f(0, 90, -90)), WEST_SOUTH(new Vector3f(0, 90, 90)),
WEST_WEST(new Vector3f(0, 0, 0)), // NOOP
WEST_EAST(new Vector3f(0, 0, 0)), // NOOP
EAST_DOWN(new Vector3f(0, -90, 180)), EAST_UP(new Vector3f(0, -90, 0)), EAST_NORTH(new Vector3f(0, -90, 90)),
EAST_SOUTH(new Vector3f(0, -90, -90)), EAST_WEST(new Vector3f(0, 0, 0)), // NOOP
EAST_EAST(new Vector3f(0, 0, 0)); // NOOP
// @formatter:on
private final Vector3f rot;
private final Quaternion xRot;
private final Quaternion yRot;
private final Quaternion zRot;
private final Matrix4f mat;
private final Vector3f rot;
private final Quaternion xRot;
private final Quaternion yRot;
private final Quaternion zRot;
private final Matrix4f mat;
private FacingToRotation( Vector3f rot )
{
this.rot = rot;
this.mat = new Matrix4f();
this.mat.setIdentity();
this.mat.mul( xRot = Vector3f.XP.rotationDegrees( rot.getX() ) );
this.mat.mul( yRot = Vector3f.YP.rotationDegrees( rot.getY() ) );
this.mat.mul( zRot = Vector3f.ZP.rotationDegrees( rot.getZ() ) );
}
private FacingToRotation(Vector3f rot) {
this.rot = rot;
this.mat = new Matrix4f();
this.mat.setIdentity();
this.mat.mul(xRot = Vector3f.XP.rotationDegrees(rot.getX()));
this.mat.mul(yRot = Vector3f.YP.rotationDegrees(rot.getY()));
this.mat.mul(zRot = Vector3f.ZP.rotationDegrees(rot.getZ()));
}
public boolean isRedundant()
{
return rot.getX() == 0 && rot.getY() == 0 && rot.getZ() == 0;
}
public boolean isRedundant() {
return rot.getX() == 0 && rot.getY() == 0 && rot.getZ() == 0;
}
public Vector3f getRot()
{
return this.rot;
}
public Vector3f getRot() {
return this.rot;
}
public Matrix4f getMat()
{
return new Matrix4f( this.mat );
}
public Matrix4f getMat() {
return new Matrix4f(this.mat);
}
public void push( MatrixStack mStack )
{
mStack.rotate( xRot );
mStack.rotate( yRot );
mStack.rotate( zRot );
}
public void push(MatrixStack mStack) {
mStack.rotate(xRot);
mStack.rotate(yRot);
mStack.rotate(zRot);
}
public Direction rotate( Direction facing )
{
Vec3i dir = facing.getDirectionVec();
Vector4f vec = new Vector4f( dir.getX(), dir.getY(), dir.getZ(), 1 );
vec.transform( mat );
return Direction.getFacingFromVector( vec.getX(), vec.getY(), vec.getZ() );
}
public Direction rotate(Direction facing) {
Vec3i dir = facing.getDirectionVec();
Vector4f vec = new Vector4f(dir.getX(), dir.getY(), dir.getZ(), 1);
vec.transform(mat);
return Direction.getFacingFromVector(vec.getX(), vec.getY(), vec.getZ());
}
public Direction resultingRotate( Direction facing )
{
for( Direction face : Direction.values() )
{
if( this.rotate( face ) == facing )
{
return face;
}
}
return null;
}
public Direction resultingRotate(Direction facing) {
for (Direction face : Direction.values()) {
if (this.rotate(face) == facing) {
return face;
}
}
return null;
}
public static FacingToRotation get( Direction forward, Direction up )
{
return values()[forward.ordinal() * 6 + up.ordinal()];
}
public static FacingToRotation get(Direction forward, Direction up) {
return values()[forward.ordinal() * 6 + up.ordinal()];
}
@Override
public String getName() {
return name().toLowerCase();
}
@Override
public String getName() {
return name().toLowerCase();
}
}