src/main/java/net/azagwen/atbyw/client/render/model/ModelUtil.java
public static void emitBox(QuadEmitter emitter, Vec3f from, Vec3f to, Map<Direction, Face> faceData) {
        var xFrom = from.getX();
        var yFrom = from.getY();
        var zFrom = from.getZ();
        var xTo = to.getX();
        var yTo = to.getY();
        var zTo = to.getZ();

        for (var direction : Direction.values()) {
            if (faceData.containsKey(direction)) {
                var sprite = faceData.get(direction).sprite();
                var isFaceEmissive = faceData.get(direction).emissive();
                var u1 = faceData.get(direction).u1();
                var v1 = faceData.get(direction).v1();
                var u2 = faceData.get(direction).u2();
                var v2 = faceData.get(direction).v2();

                var depth = 0.0F;
                switch (direction) {
                    case UP -> depth = (16 - yTo);
                    case DOWN -> depth = yFrom;
                    case NORTH -> depth = zFrom;
                    case SOUTH -> depth = (16 - zTo);
                    case EAST -> depth = (16 - xTo);
                    case WEST -> depth = xFrom;
                }
                switch (direction) {
                    case NORTH -> emitQuad(emitter, direction, Math.abs(xTo - 16), yFrom, Math.abs(xFrom - 16), yTo, depth);
                    case SOUTH -> emitQuad(emitter, direction, xFrom, yFrom, xTo, yTo, depth);
                    case EAST -> emitQuad(emitter, direction, Math.abs(zTo - 16), yFrom, Math.abs(zFrom - 16), yTo, depth);
                    case WEST -> emitQuad(emitter, direction, zFrom, yFrom, zTo, yTo, depth);
                    case UP, DOWN -> emitQuad(emitter, direction, xFrom, Math.abs(zTo - 16), xTo, Math.abs(zFrom - 16), depth);
                }
                emitter.spriteBake(0, sprite, MutableQuadView.BAKE_ROTATE_NONE);
                setUvOnSprite(emitter, sprite, u1, v1, u2, v2);
                emitTexturedData(emitter, isFaceEmissive);
            }
        }
    }
/**
     * Creates a box using the same input that a JSON model would use.
     * @see Face
     *
     * @param emitter   The Quad Emitter being used.
     * @param from      3D Vector of the origin point.
     * @param to        3D Vector of the end point.
     * @param faceData  Map of a direction and a Face instance which stores the face data.
     */
Creates a box using the same input that a JSON model would use.
@see Face

@param emitter   The Quad Emitter being used.
@param from      3D Vector of the origin point.
@param to        3D Vector of the end point.
@param faceData  Map of a direction and a Face instance which stores the face data.
Creates a box using the same input that a JSON model would use . @see Face @param emitter The Quad Emitter being used . @param from 3D Vector of the origin point . @param to 3D Vector of the end point . @param faceData Map of a direction and a Face instance which stores the face data .
public static void emitBox(QuadEmitter emitter, Vec3f from, Vec3f to, Map<Direction, Face> faceData) {
        var xFrom = from.getX();
        var yFrom = from.getY();
        var zFrom = from.getZ();
        var xTo = to.getX();
        var yTo = to.getY();
        var zTo = to.getZ();
        for (var direction : Direction.values()) {
            if (faceData.containsKey(direction)) {
                var sprite = faceData.get(direction).sprite();
                var isFaceEmissive = faceData.get(direction).emissive();
                var u1 = faceData.get(direction).u1();
                var v1 = faceData.get(direction).v1();
                var u2 = faceData.get(direction).u2();
                var v2 = faceData.get(direction).v2();
                var depth = 0.0F;
                switch (direction) {
                    case UP -> depth = (16 - yTo);
                    case DOWN -> depth = yFrom;
                    case NORTH -> depth = zFrom;
                    case SOUTH -> depth = (16 - zTo);
                    case EAST -> depth = (16 - xTo);
                    case WEST -> depth = xFrom;
                }
                switch (direction) {
                    case NORTH -> emitQuad(emitter, direction, Math.abs(xTo - 16), yFrom, Math.abs(xFrom - 16), yTo, depth);
                    case SOUTH -> emitQuad(emitter, direction, xFrom, yFrom, xTo, yTo, depth);
                    case EAST -> emitQuad(emitter, direction, Math.abs(zTo - 16), yFrom, Math.abs(zFrom - 16), yTo, depth);
                    case WEST -> emitQuad(emitter, direction, zFrom, yFrom, zTo, yTo, depth);
                    case UP, DOWN -> emitQuad(emitter, direction, xFrom, Math.abs(zTo - 16), xTo, Math.abs(zFrom - 16), depth);
                }
                emitter.spriteBake(0, sprite, MutableQuadView.BAKE_ROTATE_NONE);
                setUvOnSprite(emitter, sprite, u1, v1, u2, v2);
                emitTexturedData(emitter, isFaceEmissive);
            }
        }
    }
public static void emitBox ( QuadEmitter emitter , Vec3f from , Vec3f to , Map < Direction , Face > faceData ) { var xFrom = from . getX ( ) ; var yFrom = from . getY ( ) ; var zFrom = from . getZ ( ) ; var xTo = to . getX ( ) ; var yTo = to . getY ( ) ; var zTo = to . getZ ( ) ; for ( var direction : Direction . values ( ) ) { if ( faceData . containsKey ( direction ) ) { var sprite = faceData . get ( direction ) . sprite ( ) ; var isFaceEmissive = faceData . get ( direction ) . emissive ( ) ; var u1 = faceData . get ( direction ) . u1 ( ) ; var v1 = faceData . get ( direction ) . v1 ( ) ; var u2 = faceData . get ( direction ) . u2 ( ) ; var v2 = faceData . get ( direction ) . v2 ( ) ; var depth = 0.0F ; switch ( direction ) { case UP -> depth = ( 16 - yTo ) ; case DOWN -> depth = yFrom ; case NORTH -> depth = zFrom ; case SOUTH -> depth = ( 16 - zTo ) ; case EAST -> depth = ( 16 - xTo ) ; case WEST -> depth = xFrom ; } switch ( direction ) { case NORTH -> emitQuad ( emitter , direction , Math . abs ( xTo - 16 ) , yFrom , Math . abs ( xFrom - 16 ) , yTo , depth ) ; case SOUTH -> emitQuad ( emitter , direction , xFrom , yFrom , xTo , yTo , depth ) ; case EAST -> emitQuad ( emitter , direction , Math . abs ( zTo - 16 ) , yFrom , Math . abs ( zFrom - 16 ) , yTo , depth ) ; case WEST -> emitQuad ( emitter , direction , zFrom , yFrom , zTo , yTo , depth ) ; case UP , DOWN -> emitQuad ( emitter , direction , xFrom , Math . abs ( zTo - 16 ) , xTo , Math . abs ( zFrom - 16 ) , depth ) ; } emitter . spriteBake ( 0 , sprite , MutableQuadView . BAKE_ROTATE_NONE ) ; setUvOnSprite ( emitter , sprite , u1 , v1 , u2 , v2 ) ; emitTexturedData ( emitter , isFaceEmissive ) ; } } }
Creates a box using the same input that a JSON model would use.
Creates a box using the same input that a JSON model would use .