Skip to content

Commit

Permalink
wip: Begin Bluemap support
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Dec 13, 2023
1 parent cec87a4 commit 330fbdd
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shared/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ repositories {
maven {
url = "https://jm.gserv.me/repository/maven-public/"
}

maven {
url 'https://jitpack.io'
content {
includeGroup "com.github.BlueMap-Minecraft"
}
}
}

dependencies {
compileOnly "info.journeymap:journeymap-api:${journeymap_api_common_version}"
compileOnly "mcp.mobius.waila:wthit-api:mojmap-$wthit_version"
compileOnly "mezz.jei:jei-$jei_minecraft_version-common-api:$jei_version"
compileOnly 'com.github.BlueMap-Minecraft:BlueMapAPI:v2.5.1'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package net.blay09.mods.waystones.compat;

import de.bluecolored.bluemap.api.BlueMapAPI;
import de.bluecolored.bluemap.api.markers.MarkerSet;
import de.bluecolored.bluemap.api.markers.POIMarker;
import net.blay09.mods.waystones.api.IWaystone;
import net.minecraft.world.level.Level;

public class WaystonesBlueMapPlugin {

private BlueMapAPI api;

private static class BlueMapLevel {
private final MarkerSet waystoneMarkers = MarkerSet.builder()
.label("Waystones")
.build();

private final MarkerSet sharestoneMarkers = MarkerSet.builder()
.label("Sharestones")
.build();

private final Level level;

private BlueMapLevel(Level level) {
this.level = level;
}

public void setupMarkerSets(BlueMapAPI api) {
api.getWorld(level).ifPresent(world -> {
for (var map : world.getMaps()) {
map.getMarkerSets().put("waystones:waystones", waystoneMarkers);
map.getMarkerSets().put("waystones:sharestones", sharestoneMarkers);
}
});
}

public void setupMarkers() {
waystoneMarkers.getMarkers().clear();
sharestoneMarkers.getMarkers().clear();

// TODO update markersets with current waystones for this level
}
}

public WaystonesBlueMapPlugin() {
BlueMapAPI.onEnable(api -> this.api = api);
BlueMapAPI.onDisable(api -> this.api = null);
}

public void onWaystonesChanged() {
// TODO group all waystones by level
// TODO computeifabsent a bluemaplevel
// TODO some method for refreshing bluemap level once api is enabled
// TODO trigger refresh whenever waystones change
// TODO call this refresh method from some event
}

public POIMarker createWaystoneMarker(IWaystone waystone) {
return POIMarker.builder()
.label(waystone.getName())
.position((double) waystone.getPos().getX(), waystone.getPos().getY(), waystone.getPos().getZ())
.maxDistance(1000)
.build();
}

}

0 comments on commit 330fbdd

Please sign in to comment.