Skip to content

Commit

Permalink
fix waypoint position
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticdrew committed Jun 17, 2024
1 parent 76e4c87 commit 09aad6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
14 changes: 8 additions & 6 deletions src/main/js/journeymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import nightIconDisabled from "../images/night-disabled.png"
import topoIcon from "../images/topo.png"
import topoIconActive from "../images/topo-active.png"
import topoIconDisabled from "../images/topo-disabled.png"
import {toRgbHex, translateCoords} from "./utils"
import {translateCoords} from "./utils"
import undergroundIcon from "../images/underground.png"
import undergroundIconActive from "../images/underground-active.png"

Expand Down Expand Up @@ -224,7 +224,9 @@ class Journeymap {
}

const hellTranslate = this.currentDim === "minecraft:the_nether"
const coords = translateCoords(waypoint.x + 0.5, waypoint.z + 0.5, hellTranslate)
const posX = waypoint.pos.x;
const posZ = waypoint.pos.Z;
const coords = translateCoords(posX + 0.5, posZ + 0.5, hellTranslate)

const masked = waypoint.icon.resourceLocation.startsWith("journeymap") || waypoint.icon.color !== null

Expand All @@ -233,11 +235,11 @@ class Journeymap {
if (waypoint.icon.color !== undefined) {
color = "#" + (0 + waypoint.icon.color).toString(16)
} else {
// const red = waypoint.red.toString(16).padStart(2, "0")
// const blue = waypoint.blue.toString(16).padStart(2, "0")
// const green = waypoint.green.toString(16).padStart(2, "0")
const red = ((waypoint.color >> 16) & 0xFF).toString(16).padStart(2, "0")
const blue = ((waypoint.color >> 8) & 0xFF).toString(16).padStart(2, "0")
const green = ((waypoint.color) & 0xFF).toString(16).padStart(2, "0")

color = toRgbHex(waypoint.color)
color = `#${red}${green}${blue}`
}

const style = ""
Expand Down
7 changes: 0 additions & 7 deletions src/main/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,3 @@ export function reverseTranslateCoords(z, x, hellTranslate, offset = 0) {

return [x - offset, (z * - 1) - offset]
}

export function toRgbHex(color) {
let red = (color >> 16) & 0xFF;
let green = (color >> 8) & 0xFF;
let blue = (color) & 0xFF;
return `#${red}${green}${blue}`
}

0 comments on commit 09aad6f

Please sign in to comment.