Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* coords: unrotated world coord, rotation: quantify to 90, start: uncentered world coords for structure start point, size: structure size */
- public static ChunkCoordinates rotateNew(ChunkCoordinates coords, int direction, Vec3 start, Vec3 size) {
- System.out.println("direction: " + direction);
- //center is not offsetted
- //coords should be offset 0.5 before rotate math, guarantees no strange offset issues, flooring cleans it up afterwards perfectly
- double rotation = (direction * Math.PI/2D);
- double centerX = start.xCoord+(size.xCoord/2D);
- double centerZ = start.zCoord+(size.zCoord/2D);
- double vecX = (coords.posX+0.5D) - centerX;
- double vecZ = (coords.posZ+0.5D) - centerZ;
- Vec3 vec = Vec3.createVectorHelper(vecX, 0, vecZ);
- vec.rotateAroundY((float)rotation);
- return new ChunkCoordinates((int)Math.floor(start.xCoord+vec.xCoord), coords.posY, (int)Math.floor(start.zCoord+vec.zCoord));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement