Skip to content

Commit d494fcc

Browse files
committed
Mark As Complete
1 parent b962d37 commit d494fcc

File tree

5 files changed

+220
-75
lines changed

5 files changed

+220
-75
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,10 @@ If the server you're in already has a seed in the database, or it has just been
126126

127127
You can enable/disable this with ```/sm:config AutoApplySeedCrackerSeed true/false```
128128

129+
### Mark As Complete
130+
Can now right click on structures and mark them as complete/incomplete which adds a green tick over the icon
131+
132+
![Complete Me](https://i.imgur.com/tITHz8W.png)
133+
129134
### Notes
130135
If using the original SeedMapper after using my fork you must erase my ```config.json``` first due to the mismatch of settings.

src/main/java/dev/xpple/seedmapper/SeedMapper.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,12 @@
4040
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
4141
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
4242
import net.fabricmc.loader.api.FabricLoader;
43-
import net.fabricmc.loader.api.ModContainer;
43+
import dev.xpple.seedmapper.util.CubiomesNative;
4444
import net.minecraft.client.KeyMapping;
4545
import net.minecraft.commands.CommandBuildContext;
4646
import net.minecraft.resources.Identifier;
4747

48-
import java.io.IOException;
49-
import java.nio.file.Files;
5048
import java.nio.file.Path;
51-
import java.nio.file.StandardCopyOption;
5249
import java.time.Duration;
5350

5451
public class SeedMapper implements ClientModInitializer {
@@ -57,21 +54,9 @@ public class SeedMapper implements ClientModInitializer {
5754

5855
public static final Path modConfigPath = FabricLoader.getInstance().getConfigDir().resolve(MOD_ID);
5956

60-
static {
61-
String libraryName = System.mapLibraryName("cubiomes");
62-
ModContainer modContainer = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow();
63-
Path tempFile;
64-
try {
65-
tempFile = Files.createTempFile(libraryName, "");
66-
Files.copy(modContainer.findPath(libraryName).orElseThrow(), tempFile, StandardCopyOption.REPLACE_EXISTING);
67-
} catch (IOException e) {
68-
throw new RuntimeException(e);
69-
}
70-
System.load(tempFile.toAbsolutePath().toString());
71-
}
72-
7357
@Override
7458
public void onInitializeClient() {
59+
CubiomesNative.ensureLoaded();
7560

7661
new ModConfigBuilder<>(MOD_ID, Configs.class)
7762
.registerType(SeedIdentifier.class, new SeedIdentifierAdapter(), SeedIdentifierArgument::seedIdentifier)

src/main/java/dev/xpple/seedmapper/config/Configs.java

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private static Component displaySavedSeeds() {
7070
@Config
7171
public static boolean AutoApplySeedCrackerSeed = true;
7272

73-
private static String getCurrentServerKey() {
73+
public static String getCurrentServerKey() {
7474
Minecraft minecraft = Minecraft.getInstance();
7575
if (minecraft == null || minecraft.getConnection() == null || minecraft.getConnection().getConnection() == null) {
7676
return null;
@@ -253,6 +253,37 @@ public static void setWaypointCompassEnabled(String worldIdentifier, java.util.S
253253
WaypointCompassEnabled.put(worldIdentifier, String.join(",", names));
254254
}
255255

256+
@Config
257+
public static Map<String, String> SeedMapCompletedStructures = new HashMap<>();
258+
259+
public static java.util.Set<String> getSeedMapCompletedStructures(String worldIdentifier) {
260+
if (worldIdentifier == null || worldIdentifier.isBlank()) {
261+
return new java.util.HashSet<>();
262+
}
263+
String raw = SeedMapCompletedStructures.get(worldIdentifier);
264+
if (raw == null || raw.isBlank()) {
265+
return new java.util.HashSet<>();
266+
}
267+
java.util.Set<String> entries = new java.util.HashSet<>();
268+
for (String part : raw.split(",")) {
269+
if (!part.isBlank()) {
270+
entries.add(part.trim());
271+
}
272+
}
273+
return entries;
274+
}
275+
276+
public static void setSeedMapCompletedStructures(String worldIdentifier, java.util.Set<String> entries) {
277+
if (worldIdentifier == null || worldIdentifier.isBlank()) {
278+
return;
279+
}
280+
if (entries == null || entries.isEmpty()) {
281+
SeedMapCompletedStructures.remove(worldIdentifier);
282+
return;
283+
}
284+
SeedMapCompletedStructures.put(worldIdentifier, String.join(",", entries));
285+
}
286+
256287
public static void applyWaypointCompassOverlaySetting() {
257288
try {
258289
dev.xpple.simplewaypoints.config.Configs.waypointMarkerRenderLimit = 0;

src/main/java/dev/xpple/seedmapper/seedmap/SeedMapMinimapScreen.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ private void renderMinimapIcons(GuiGraphics guiGraphics, double translateX, doub
128128
double sin = Math.sin(rotationRadians);
129129
double iconScale = Configs.SeedMapMinimapIconScale;
130130
for (FeatureWidget widget : this.getFeatureWidgets()) {
131+
if (!Configs.ToggledFeatures.contains(widget.feature())) {
132+
continue;
133+
}
131134
MapFeature.Texture texture = widget.texture();
132135
int scaledWidth = (int) Math.max(1, Math.round(texture.width() * iconScale));
133136
int scaledHeight = (int) Math.max(1, Math.round(texture.height() * iconScale));
@@ -142,6 +145,7 @@ private void renderMinimapIcons(GuiGraphics guiGraphics, double translateX, doub
142145
int drawX = (int) Math.round(rotatedX - scaledWidth / 2.0);
143146
int drawY = (int) Math.round(rotatedY - scaledHeight / 2.0);
144147
this.drawFeatureIcon(guiGraphics, texture, drawX, drawY, scaledWidth, scaledHeight, 0xFF_FFFFFF);
148+
this.drawCompletionOverlay(guiGraphics, widget, drawX, drawY, scaledWidth, scaledHeight);
145149
}
146150

147151
FeatureWidget marker = this.getMarkerWidget();

0 commit comments

Comments
 (0)