Skip to content

Commit d9aec72

Browse files
committed
SeedMapper Fork on J23
1 parent a03520b commit d9aec72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4467
-502
lines changed

README.md

Lines changed: 68 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,98 @@
1-
**Always** use the latest (stable) version of SeedMapper! If you want to play on an older version of Minecraft, use [ViaFabricPlus](https://modrinth.com/mod/viafabricplus). This mod allows you to use the latest features of SeedMapper, while still being able to play on older Minecraft versions.
1+
# Seedmapper 2.18.x (MC1.21.11) - Modified by CevAPI
22

3-
# SeedMapper
4-
In-game Minecraft Fabric mod that allows you to do various things with the world seed. For reference, have a look at the [features](#features) this mod has. Keep in mind though, this mod requires you to have access to the seed. If the seed is not known, you could crack it using [SeedCrackerX](https://github.com/19MisterX98/SeedcrackerX/) by 19MisterX98. For questions and support please head to my [Discord](https://discord.xpple.dev/).
3+
Original Repo: https://github.com/xpple/SeedMapper/
54

6-
## Installation
7-
1. Install the [Fabric Loader](https://fabricmc.net/use/).
8-
2. Download the [Fabric API](https://minecraft.curseforge.com/projects/fabric/) and move it to your mods folder:
9-
- Linux/Windows: `.minecraft/mods`.
10-
- Mac: `minecraft/mods`.
11-
3. Download SeedMapper from the [releases page](https://modrinth.com/mod/seedmapper/versions/) and move it to your mods folder.
5+
## Relationship to upstream
126

13-
## IMPORTANT
14-
You need to have at least Java 23 installed to use this mod. I recommend to get Java 23 (or higher) from [adoptium.net](https://adoptium.net/temurin/releases/?version=23). Next, configure your Minecraft launcher to use this release of Java.
7+
This project is a friendly, independent fork of Seedmapper. I have not proposed any improvements or features to the upstream but I am welcome to them incorporating my changes. I will sporatically maintain this project and re-base/sync with the upstream project.
158

16-
- Vanilla launcher: Go to `Installations` -> `Edit` -> `More options` -> `Java executable`.
17-
- MultiMC: Go to `Edit Instance` -> `Settings` -> `Java` -> `Java Installation`.
18-
- PrismLauncher: Go to `Settings` -> `Java` -> `Java Runtime` -> `Auto-Detect...`.
19-
- Modrinth App: Go to `Instance settings` -> `Java and memory` -> `Custom Java installation` -> `Browse`
9+
## Compiling & Running
2010

21-
Sometimes it may be necessary to click the option for skipping the Java compatibility check.
11+
Follow original instructions.
2212

23-
If you are on Windows, make sure to select `javaw.exe`, not `java.exe`.
13+
## Improvements
2414

25-
If you run into issues, contact your launcher's support.
15+
### Zoom
16+
Zoom further out on the SeedMap. Limited to approx 30,000x30,000. I suggest enabling the clear cache setting below.
2617

27-
## Features
28-
Before using any of these commands, make sure the seed has been configured using `/sm:config Seed set <seed>`.
18+
![Zoomies](https://i.imgur.com/utIgDkp.png)
2919

30-
### Seed map
31-
Usage: `/sm:seedmap`
20+
### Directional Arrow
21+
Around your player icon in the SeedMap there will be a little arrow showing you which direction you're facing. This is toggleable with ```/sm:config ShowPlayerDirectionArrow```.
3222

33-
Opens an explorable seed map based on the configured seed. You can move the map by dragging the mouse, and zoom in or out by using the scroll wheel. You can toggle what features are visible by clicking the feature toggles at the top of the screen. This command is especially useful in combination with the `/sm:source` command!
23+
![Arrow](https://i.imgur.com/pkodE8d.png)
3424

35-
### Biome locating
36-
Usage: `/sm:locate biome <biome>`.
25+
### World Presets
3726

38-
Locates a given biome closest to the player. All biomes in all dimensions are supported.
27+
If the server you're on uses anything other than the default world preset (Amplified, Superflat, Large Biomes, Single Biome) this will greatly change the world generation. Change the preset to match the server in order to produce an accurate seedmap.
3928

40-
### Structure locating
41-
Usage: `/sm:locate feature <structure>[<pieces>]{<variants>}`.
29+
- /sm:preset list — show available presets
30+
- /sm:preset set <id> — set SeedMapper’s preset
4231

43-
Locates a given structure closest to the player. All structures in all dimensions are supported. However, due to limitations in the underlying library, some structures (in particular desert pyramids, jungle temples and woodland mansions) may result in occasional false positives. For more advanced querying you can also use piece and variant data to further restrict the search. For example, the following command will search for end cities with ships: `/sm:locate feature structure end_city[end_ship]`.
32+
### Seed Map Minimap
4433

45-
### Ore vein locating
46-
Usage: `/sm:locate orevein (copper|iron)`.
34+
- Run ``` /sm:minimap ``` to open a live SeedMap minimap in the top-left corner of the HUD.
35+
- Use ``` /sm:minimap on/off ``` or to explicitly control whether it is shown.
4736

48-
Locates an [ore vein](https://minecraft.wiki/w/Ore_vein) closest to the player. The coordinates of the first ore vein block found will be returned. After this, you can use [`/sm:highlight orevein [chunks]`](#ore-vein-highlighting) to highlight the other ores.
37+
- The minimap:
38+
- Renders the same features you selected on the main map.
39+
- Tracks your current position in real time.
40+
- Ideal for overlaying over Xaeros Minimap (Default settings suits size 152).
4941

50-
### Loot locating
51-
Usage: `/sm:locate loot <amount> <item> [<enchantment conditions>]`.
42+
- Position & size:
43+
- Move it horizontally with ``` /sm:config SeedMapMinimapOffsetX ```
44+
- Move it vertically with ``` /sm:config SeedMapMinimapOffsetY ```
45+
- Change width with ``` /sm:config SeedMapMinimapWidth ```
46+
- Change height with ``` /sm:config SeedMapMinimapHeight ```
5247

53-
Locates chest loot closest to the player. All versions from 1.13 onwards are supported. SeedMapper will search through the chest loot of structures to find loot that matches the item and enchantment conditions. Note that queries for unobtainable loot and illegal enchantment combinations are not prevented by the command. If a search is taking too long, you should probably cancel it using `/sm:stoptask`.
48+
- Display options:
49+
- Rotate the map with the player’s facing using ``` /sm:config SeedMapMinimapRotateWithPlayer ```
50+
- Adjust zoom independently from the main map via ``` /sm:config SeedMapMinimapPixelsPerBiome ```
51+
- Scale feature icons with ``` /sm:config SeedMapMinimapIconScale ```
52+
- Fine tune the background opacity with ``` /sm:config SeedMapMinimapOpacity ``` without affecting icon readability.
5453

55-
### Ore highlighting
56-
Usage: `/sm:highlight block <block> [chunks]`.
54+
![Map1](https://i.imgur.com/w5U6Aux.png) ![Map2](https://i.imgur.com/MXqXY5n.png)
5755

58-
Highlights the specified block in the world. All versions from 1.13 onwards are supported. Due to high dependence on the [`OCEAN_FLOOR_WG`](https://minecraft.wiki/w/Heightmap#OCEAN_FLOOR_WG) heightmap, coal, copper and emerald ore locations may be off.
56+
### Memory Handling
57+
Added a config option ```/sm:config ClearSeedMapCachesOnClose``` to clear tiles, per‑world locations and any other relevant caches. When enabled, this prevents FPS dips from garbage collection on large caches after zooming out far and then closing the map. Opening the map again will result it in being loaded like its the first time, at smaller zoom levels this isn't a problem.
5958

60-
### Ore vein highlighting
61-
Usage: `/sm:highlight orevein [chunks]`.
59+
### Icon Text
60+
When hovering over location icons in the SeedMap it will display text telling you what the locations are.
6261

63-
Highlights ore veins in the world. Raw ore blocks that generate as part of the ore vein are highlighted distinctly. Filler blocks are ignored.
62+
![Text](https://i.imgur.com/A5gCXgP.png)
6463

65-
### Slime chunk locating
66-
Usage: `/sm:locate slimechunk`.
64+
### Added Elytra/End Ship Locations
65+
~~Can now find Elytra via locating End Ships with the locate command ```/sm:locate feature end_city_ship``` or simply selecting the Elytra icon in the SeedMap~~
6766

68-
Locates a slime chunk closest to the player. This will always be accurate.
67+
This has now been implemented by upstream. They have unified both End City Ships and End Cities together. I have accepted this change but altered it to retain my Elytra icon, this allows you to explicitly look only for Elytras. The command ```/sm:locate feature end_city_ship``` also still applies.
6968

70-
### Source mutation
71-
Usage: `/sm:source (run)|(as <entity>)|(positioned <position>)|(rotated <rotation>)|(in <dimension>)|(versioned <version>)|(seeded <seed>)`.
69+
![Elytra](https://i.imgur.com/fFxoFX4.png)
7270

73-
Executes a given command from a modified source. For example, modifying the source's position will execute the command as if you were in that position. This command is really powerful, use it!
71+
### Export SeedMap
72+
- Added **Export JSON** button on the top right of the SeedMap screen which will export all selected locations to a JSON in the folder ```SeedMapper/exports/<Server IP>_<Seed>-<Date/Time>.json```.
73+
- Added **Export Xaero** button on the top right of the SeedMap screen which will export all selected locations into Xaero World Map waypoints for the server you're in. Disconnect from the server you're in and reconnect and the waypoints will appear in Xaero.
7474

75-
## Building from source
76-
This mod internally uses (a fork of) the C library [cubiomes](https://github.com/Cubitect/cubiomes) by Cubitect. Java bindings for this library were created with (also a fork of) [jextract](https://github.com/openjdk/jextract). The bindings use the [Foreign Function & Memory API](https://openjdk.org/jeps/454) from [Project Panama](https://openjdk.org/projects/panama/). See [CreateJavaBindingsTask.java](https://github.com/xpple/SeedMapper/blob/master/buildSrc/src/main/java/dev/xpple/seedmapper/buildscript/CreateJavaBindingsTask.java) for the Gradle task that automates this.
75+
### Improved ESP
76+
Configurable ESP settings allowing for custom colors, fill and transparency.
7777

78-
To build the mod locally, follow these steps:
78+
Example: ```/sm:config blockhighlightesp set outlineColor #ff0000 outlineAlpha 0.5 fillEnabled true fillColor #00ff00 fillAlpha 0.35```
7979

80-
1. Clone the repository:
81-
```shell
82-
git clone --recurse-submodules https://github.com/xpple/SeedMapper
83-
cd SeedMapper
84-
```
85-
2. Compile cubiomes to a shared library. MSVC cannot be used to build the project! The following is for Windows:
86-
```shell
87-
cd src/main/c/cubiomes
88-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
89-
cmake --build build --config Release
90-
cp build/cubiomes.dll ../../resources/cubiomes.dll
91-
cd ../../../../
92-
```
93-
3. Install LLVM (version 13.0.0 is recommended) and set the environment variable `LLVM_HOME` to the directory where LLVM was installed.
94-
4. Compile jextract. Again, the following is for Windows:
95-
```shell
96-
cd jextract
97-
./gradlew --stacktrace -Pjdk_home="$env:JAVA_HOME" -Pllvm_home="$env:LLVM_HOME" clean verify
98-
cd ../
99-
```
100-
5. Build the mod:
101-
```shell
102-
./gradlew build
103-
```
104-
You should find the Java bindings in `src/main/java/com/github/cubiomes`.
80+
![ESP](https://i.imgur.com/yYrinKW.png)
81+
82+
### Improved Waypoints
83+
Supports [Wurst7-CevAPI](https://github.com/cev-api/Wurst7-CevAPI) waypoints, Xaero Waypoints and its own waypoint system via right click context menu.
84+
85+
Can now finally remove SeedMapper waypoints with via a right click context menu.
86+
87+
![Map](https://i.imgur.com/1qDgQw7.png)
88+
89+
### Highlight Timeout Setting
90+
Can now change the default 5 minute render timeout with ```/sm:config esptimeout```
91+
92+
### Export Loot Table
93+
Can now export the entire loot table for the map you're viewing by clicking ```Export Loot``` or via commands such as ```/sm:exportLoot <radius> [dimension] [structures/all]```.
94+
95+
This data can later be used in my LootSearch hack for [Wurst7-CevAPI](https://github.com/cev-api/Wurst7-CevAPI) which allows you to search and waypoint specific loot.
96+
97+
Exported data will be located in ```SeedMapper/loot/<Server IP>_<Seed>-<Date/Time>.json```
10598

106-
Lastly, you can also consult the [GitHub Actions workflow file](https://github.com/xpple/SeedMapper/blob/master/.github/workflows/build.yml), which contains complete build instructions for each major OS.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
33
org.gradle.parallel=true
44

55
# Mod Properties
6-
mod_version=2.18.1
6+
mod_version=2.18.1-CevAPI
77
maven_group=dev.xpple
88
archives_base_name=seedmapper
99

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

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,47 @@
1010
import dev.xpple.seedmapper.command.commands.ClearCommand;
1111
import dev.xpple.seedmapper.command.commands.DiscordCommand;
1212
import dev.xpple.seedmapper.command.commands.HighlightCommand;
13+
import dev.xpple.seedmapper.command.commands.EspConfigCommand;
1314
import dev.xpple.seedmapper.command.commands.LocateCommand;
15+
import dev.xpple.seedmapper.command.commands.MinimapCommand;
1416
import dev.xpple.seedmapper.command.commands.SampleCommand;
1517
import dev.xpple.seedmapper.command.commands.SeedMapCommand;
1618
import dev.xpple.seedmapper.command.commands.SourceCommand;
1719
import dev.xpple.seedmapper.command.commands.StopTaskCommand;
20+
import dev.xpple.seedmapper.command.commands.WorldPresetCommand;
1821
import dev.xpple.seedmapper.config.Configs;
1922
import dev.xpple.seedmapper.config.MapFeatureAdapter;
2023
import dev.xpple.seedmapper.config.SeedResolutionAdapter;
2124
import dev.xpple.seedmapper.render.RenderManager;
2225
import dev.xpple.seedmapper.seedmap.MapFeature;
26+
import dev.xpple.seedmapper.seedmap.SeedMapMinimapManager;
27+
import dev.xpple.seedmapper.util.CubiomesNative;
2328
import dev.xpple.seedmapper.util.SeedDatabaseHelper;
29+
import dev.xpple.seedmapper.world.WorldPresetManager;
2430
import dev.xpple.simplewaypoints.api.SimpleWaypointsAPI;
2531
import net.fabricmc.api.ClientModInitializer;
2632
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
2733
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
2834
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
35+
import dev.xpple.seedmapper.command.CustomClientCommandSource;
2936
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
3037
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
31-
import net.fabricmc.loader.api.FabricLoader;
32-
import net.fabricmc.loader.api.ModContainer;
3338
import net.minecraft.client.KeyMapping;
3439
import net.minecraft.commands.CommandBuildContext;
40+
import net.fabricmc.loader.api.FabricLoader;
3541

36-
import java.io.IOException;
37-
import java.nio.file.Files;
3842
import java.nio.file.Path;
39-
import java.nio.file.StandardCopyOption;
4043

4144
public class SeedMapper implements ClientModInitializer {
4245

4346
public static final String MOD_ID = "seedmapper";
4447

4548
public static final Path modConfigPath = FabricLoader.getInstance().getConfigDir().resolve(MOD_ID);
4649

47-
static {
48-
String libraryName = System.mapLibraryName("cubiomes");
49-
ModContainer modContainer = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow();
50-
Path tempFile;
51-
try {
52-
tempFile = Files.createTempFile(libraryName, "");
53-
Files.copy(modContainer.findPath(libraryName).orElseThrow(), tempFile, StandardCopyOption.REPLACE_EXISTING);
54-
} catch (IOException e) {
55-
throw new RuntimeException(e);
56-
}
57-
System.load(tempFile.toAbsolutePath().toString());
58-
}
59-
6050
@Override
6151
public void onInitializeClient() {
52+
CubiomesNative.ensureLoaded();
53+
6254
new ModConfigBuilder<>(MOD_ID, Configs.class)
6355
.registerType(SeedResolutionArgument.SeedResolution.class, new SeedResolutionAdapter(), SeedResolutionArgument::seedResolution)
6456
.registerTypeHierarchy(MapFeature.class, new MapFeatureAdapter(), MapFeatureArgument::mapFeature)
@@ -69,22 +61,32 @@ public void onInitializeClient() {
6961
} catch (IllegalStateException _) {
7062
}
7163
}
64+
if (event.config().equals("EspTimeoutMinutes")) {
65+
RenderManager.setHighlightTimeout(Configs.EspTimeoutMinutes);
66+
}
7267
})
7368
.build();
7469

70+
WorldPresetManager.init();
71+
7572
SimpleWaypointsAPI.getInstance().registerCommandAlias("sm:waypoint");
7673

7774
SeedDatabaseHelper.fetchSeeds();
7875

7976
KeyMapping keyMapping = KeyBindingHelper.registerKeyBinding(new KeyMapping("key.seedMap", InputConstants.KEY_M, KeyMapping.Category.GAMEPLAY));
77+
KeyMapping minimapKeyMapping = KeyBindingHelper.registerKeyBinding(new KeyMapping("key.seedMapMinimap", InputConstants.KEY_COMMA, KeyMapping.Category.GAMEPLAY));
8078
ClientTickEvents.END_CLIENT_TICK.register(minecraft -> {
8179
while (keyMapping.consumeClick()) {
8280
minecraft.player.connection.sendCommand("sm:seedmap");
8381
}
82+
while (minimapKeyMapping.consumeClick()) {
83+
minecraft.player.connection.sendCommand("sm:minimap");
84+
}
8485
});
8586

8687
ClientCommandRegistrationCallback.EVENT.register(SeedMapper::registerCommands);
8788
RenderManager.registerEvents();
89+
SeedMapMinimapManager.registerHud();
8890
}
8991

9092
private static void registerCommands(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandBuildContext context) {
@@ -93,10 +95,25 @@ private static void registerCommands(CommandDispatcher<FabricClientCommandSource
9395
CheckSeedCommand.register(dispatcher);
9496
BuildInfoCommand.register(dispatcher);
9597
HighlightCommand.register(dispatcher);
98+
// ensure a clear subcommand exists for sm:highlight clear
99+
dispatcher.register(net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal("sm:highlight")
100+
.then(net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal("clear")
101+
.executes(ctx -> {
102+
CustomClientCommandSource source = CustomClientCommandSource.of(ctx.getSource());
103+
source.getClient().schedule(() -> {
104+
RenderManager.clear();
105+
source.sendFeedback(net.minecraft.network.chat.Component.translatable("command.highlight.clear.success"));
106+
});
107+
return 1;
108+
})));
109+
EspConfigCommand.register(dispatcher);
96110
ClearCommand.register(dispatcher);
97111
StopTaskCommand.register(dispatcher);
98112
SeedMapCommand.register(dispatcher);
113+
MinimapCommand.register(dispatcher);
99114
DiscordCommand.register(dispatcher);
100115
SampleCommand.register(dispatcher);
116+
WorldPresetCommand.register(dispatcher);
117+
dev.xpple.seedmapper.command.commands.ExportLootCommand.register(dispatcher);
101118
}
102119
}

src/main/java/dev/xpple/seedmapper/command/CustomClientCommandSource.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import dev.xpple.seedmapper.command.arguments.VersionArgument;
99
import dev.xpple.seedmapper.config.Configs;
1010
import dev.xpple.seedmapper.util.SeedDatabaseHelper;
11+
import dev.xpple.seedmapper.world.WorldPreset;
12+
import dev.xpple.seedmapper.world.WorldPresetManager;
1113
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
1214
import net.minecraft.SharedConstants;
1315
import net.minecraft.client.Minecraft;
@@ -158,4 +160,15 @@ public int getVersion() throws CommandSyntaxException {
158160
}
159161
return VersionArgument.version().parse(new StringReader(SharedConstants.getCurrentVersion().name()));
160162
}
163+
164+
public WorldPreset getWorldPreset() {
165+
Object presetMeta = this.getMeta("world_preset");
166+
if (presetMeta instanceof String presetId) {
167+
WorldPreset preset = WorldPresetManager.findPreset(presetId);
168+
if (preset != null) {
169+
return preset;
170+
}
171+
}
172+
return WorldPresetManager.activePreset();
173+
}
161174
}

src/main/java/dev/xpple/seedmapper/command/arguments/DimensionArgument.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public static int getDimension(CommandContext<FabricClientCommandSource> context
3535
return context.getArgument(name, Integer.class);
3636
}
3737

38+
public static Integer resolveDimensionId(String name) {
39+
return DIMENSIONS.get(name);
40+
}
41+
3842
@Override
3943
public Integer parse(StringReader reader) throws CommandSyntaxException {
4044
int cursor = reader.getCursor();

0 commit comments

Comments
 (0)