-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update gitignore * Warp rendering initial * finish warp rendering
- Loading branch information
Showing
8 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,4 +55,5 @@ dkms.conf | |
.replit | ||
.DS_Store | ||
node_modules/ | ||
out/ | ||
out/ | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as fs from "fs"; | ||
|
||
const warpData = []; | ||
|
||
async function getData() { | ||
let oldLength = warpData.length; | ||
let res = await fetch("https://api.minecartrapidtransit.net/api/v1/warps?world=new&offset=" + oldLength); | ||
let warps = await res.json(); | ||
for (const warp of warps) { | ||
warpData.push({ | ||
name: warp.name, | ||
x: Math.round(warp.x), | ||
z: Math.round(warp.z) | ||
}) | ||
} | ||
|
||
// If number of entries has increased then check the next page | ||
if (oldLength != warpData.length) getData(); | ||
else { | ||
console.log(warpData.length + " warps found") | ||
fs.writeFileSync("./warps.json", JSON.stringify({ | ||
warps: warpData, | ||
lastUpdated: new Date().toUTCString() | ||
})); | ||
} | ||
} | ||
getData(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { mapcoord } from "../utils/coord"; | ||
import { gb, gcm } from "./globals"; | ||
|
||
export async function initMapWarps() { | ||
const res = await fetch("./warps.json"); | ||
const warpData = await res.json(); | ||
console.log(warpData.warps.length + " warps loaded"); | ||
|
||
|
||
for (const warp of warpData.warps) { | ||
gcm().warpLayer.addLayer( | ||
L.circleMarker(mapcoord([warp.x, warp.z]), { | ||
color: "#ff0000", | ||
radius: 3 | ||
}) | ||
.bindPopup(`Warp: ${warp.name}<br><button onclick="navigator.clipboard.writeText('/warp point ${warp.name}')">Copy Compass Point Command</button>`) | ||
) | ||
} | ||
|
||
gb().warps.enable(); | ||
} | ||
|
||
export function copyPointCommand(name) { | ||
navigator.clipboard.writeText(`/warp point ${name}`); | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.