Skip to content

Commit

Permalink
remove duplicated plugin load
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Jan 16, 2025
1 parent 1ee70a8 commit 0fc37a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 7 additions & 7 deletions prismarine-viewer/viewer/lib/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,14 @@ export class Entities extends EventEmitter {
}
}

updateMap (mapNumber, data) {
updateMap (mapNumber: string | number, data: string) {
this.cachedMapsImages[mapNumber] = data
let itemFrameMeshs = this.itemFrameMaps[mapNumber]
if (!itemFrameMeshs) return
itemFrameMeshs = itemFrameMeshs.filter(mesh => mesh.parent)
this.itemFrameMaps[mapNumber] = itemFrameMeshs
if (itemFrameMeshs) {
for (const mesh of itemFrameMeshs) {
let itemFrameMeshes = this.itemFrameMaps[mapNumber]
if (!itemFrameMeshes) return
itemFrameMeshes = itemFrameMeshes.filter(mesh => mesh.parent)
this.itemFrameMaps[mapNumber] = itemFrameMeshes
if (itemFrameMeshes) {
for (const mesh of itemFrameMeshes) {
mesh.material.map = this.loadMap(data)
mesh.material.needsUpdate = true
mesh.visible = true
Expand Down
2 changes: 0 additions & 2 deletions src/react/HeldMapUi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export default () => {
const [dataUrl, setDataUrl] = useState<string | null | true>(null) // true means loading

useEffect(() => {
bot.loadPlugin(mapDownloader)

setImageConverter((buf: Uint8Array) => {
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')!
Expand Down

0 comments on commit 0fc37a5

Please sign in to comment.