bte-projection
v1.3.2
Published
Minecraft T++ projection files re-written in typescript
Downloads
12
Maintainers
Readme
bte-projection
A javascript/typescript package that is a re-written version of T++ mod's projection files.
How to use
javascript:
const { BTE_PROJECTION } = require('bte-projection')
let coordinate = { lat: 40.74843814459844, lon: -73.98566440289457 };
let converted = BTE_PROJECTION.fromGeo(coordinate);
console.log(`In-game X coordinate: ${converted.x}`);
console.log(`In-game Z coordinate: ${converted.y}`);
let distortion = BTE_PROJECTION.getDistortion(coordinate);
console.log(`Distortion amount: ${distortion.value}`);
typescript:
import { BTE_PROJECTION, XYCoord, GeoCoord } from 'bte-projection'
let coordinate: XYCoord = { x: -8525873.069135161, y: -6026164.9710848285 };
let converted: GeoCoord = BTE_PROJECTION.toGeo(coordinate);
console.log(`Latitude: ${converted.lat}`);
console.log(`Longitude: ${converted.lon}`);
Projection JSON:
import { GeographicProjection, fromProjectionJSON } from 'bte-projection'
const projection: GeographicProjection = fromProjectionJSON({
scale: {
delegate: {
flip_vertical: {
delegate: {
bte_conformal_dymaxion: {}
}
}
},
x: 7318261.522857145,
y: 7318261.522857145
}
});
let converted = projection.toGeo({ x: -8525873.069135161, y: -6026164.9710848285 });
console.log(`Latitude: ${converted.lat}`);
console.log(`Longitude: ${converted.lon}`);
Custom projection:
import { SinusoidalProjection, SwapAxesProjectionTransform, fromProjectionJSON } from 'bte-projection'
// Both projection1 and projection2 here are the same
const projection1 = new SwapAxesProjectionTransform({
delegate: new SinusoidalProjection()
});
const projection2 = fromProjectionJSON('"swap_axes": {"delegate": {"sinusoidal": {}}}');