Skip to content

Commit 03604ad

Browse files
committed
New Options Menu
1 parent 3c23d72 commit 03604ad

10 files changed

Lines changed: 4255 additions & 1666 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Seedmapper 2.22.x (MC26.1) - Modified by CevAPI
1+
# Seedmapper 2.22.x (MC26.1.1) - Modified by CevAPI
22

33
Original Repo: https://github.com/xpple/SeedMapper/
44

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ plugins {
1010
version = project.mod_version
1111
group = project.maven_group
1212

13+
def forkReleaseSuffix = project.fork_release_version ? "_${project.fork_release_version}" : ""
14+
1315
base {
1416
archivesName = project.archives_base_name
1517
}
@@ -110,6 +112,10 @@ tasks.withType(JavaCompile).configureEach {
110112
it.options.release = 25
111113
}
112114

115+
tasks.withType(Jar).configureEach {
116+
archiveFileName = "${base.archivesName.get()}-${project.mod_version}${forkReleaseSuffix}.jar"
117+
}
118+
113119
java {
114120
sourceCompatibility = JavaVersion.VERSION_25
115121
targetCompatibility = JavaVersion.VERSION_25

gradle.properties

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ org.gradle.parallel=true
44

55
# Mod Properties
66
mod_version=2.22.0-CevAPI
7+
fork_release_version=v0.17
78
maven_group=dev.xpple
89
archives_base_name=SeedMapper
910

1011
# Minecraft properties
11-
minecraft_version=26.1-rc-2
12-
minecraft_version_dependency=>=26.1-rc.1 <26.2
13-
minecraft_version_list=26.1-rc-2
12+
minecraft_version=26.1.1
13+
minecraft_version_dependency=>=26.1.1 <26.2
14+
minecraft_version_list=26.1.1
1415

1516
# Fabric Properties
1617
# check these on https://fabricmc.net/develop
17-
fabric_api_version=0.144.0+26.1
18-
fabric_loader_version=0.18.4
18+
fabric_api_version=0.145.3+26.1.1
19+
fabric_loader_version=0.18.6
1920
fabric_loom_version=1.15-SNAPSHOT
2021

2122
# Library dependencies

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@
4040
import net.fabricmc.fabric.api.client.command.v2.ClientCommands;
4141
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
4242
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
43-
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
4443
import net.fabricmc.loader.api.FabricLoader;
4544
import net.fabricmc.loader.api.ModContainer;
4645
import dev.xpple.seedmapper.util.CubiomesNative;
47-
import net.minecraft.client.KeyMapping;
4846
import net.minecraft.commands.CommandBuildContext;
49-
import net.minecraft.resources.Identifier;
5047
import org.slf4j.Logger;
5148

5249
import java.io.IOException;
@@ -106,17 +103,8 @@ public void onInitializeClient() {
106103

107104
SeedDatabaseHelper.fetchSeeds();
108105

109-
KeyMapping.Category category = KeyMapping.Category.register(Identifier.fromNamespaceAndPath(MOD_ID, MOD_ID));
110-
KeyMapping seedMapKeyMapping = KeyMappingHelper.registerKeyMapping(new KeyMapping("key.seedMap", InputConstants.KEY_M, category));
111-
KeyMapping minimapKeyMapping = KeyMappingHelper.registerKeyMapping(new KeyMapping("key.minimap", InputConstants.KEY_COMMA, category));
112-
ClientTickEvents.END_CLIENT_TICK.register(minecraft -> {
113-
while (seedMapKeyMapping.consumeClick()) {
114-
minecraft.player.connection.sendCommand("sm:seedmap");
115-
}
116-
while (minimapKeyMapping.consumeClick()) {
117-
minecraft.player.connection.sendCommand("sm:minimap");
118-
}
119-
});
106+
SeedMapperKeybinds.registerAll();
107+
ClientTickEvents.END_CLIENT_TICK.register(SeedMapperKeybinds::handleClientTick);
120108

121109
ClientCommandRegistrationCallback.EVENT.register(SeedMapper::registerCommands);
122110
WorldPresetManager.init();
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
package dev.xpple.seedmapper;
2+
3+
import com.mojang.blaze3d.platform.InputConstants;
4+
import dev.xpple.seedmapper.config.Configs;
5+
import dev.xpple.seedmapper.render.RenderManager;
6+
import dev.xpple.seedmapper.seedmap.MapFeature;
7+
import dev.xpple.seedmapper.seedmap.SeedMapMinimapManager;
8+
import dev.xpple.seedmapper.seedmap.SeedMapScreen;
9+
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
10+
import net.minecraft.client.KeyMapping;
11+
import net.minecraft.client.Minecraft;
12+
import net.minecraft.resources.Identifier;
13+
14+
import java.util.Arrays;
15+
import java.util.List;
16+
17+
public final class SeedMapperKeybinds {
18+
private SeedMapperKeybinds() {}
19+
20+
private static final KeyMapping.Category CATEGORY = KeyMapping.Category.register(Identifier.fromNamespaceAndPath(SeedMapper.MOD_ID, SeedMapper.MOD_ID));
21+
private static final int UNBOUND_KEY = InputConstants.UNKNOWN.getValue();
22+
23+
private static KeyMapping OPEN_SEEDMAP;
24+
private static KeyMapping TOGGLE_MINIMAP;
25+
private static KeyMapping TOGGLE_OPTIONS;
26+
private static KeyMapping OPEN_LOOT_VIEWER;
27+
private static KeyMapping CLEAR_ESP;
28+
private static KeyMapping TOGGLE_SELECTED_ESP;
29+
private static KeyMapping TOGGLE_BLOCK_ESP;
30+
private static KeyMapping TOGGLE_ORE_VEIN_ESP;
31+
private static KeyMapping TOGGLE_CANYON_ESP;
32+
private static KeyMapping TOGGLE_CAVE_ESP;
33+
private static KeyMapping TOGGLE_TERRAIN_ESP;
34+
private static KeyMapping TOGGLE_ORE_VEINS;
35+
private static KeyMapping TOGGLE_CANYON;
36+
private static KeyMapping TOGGLE_SLIME_CHUNKS;
37+
private static KeyMapping TOGGLE_WAYPOINTS;
38+
private static KeyMapping TOGGLE_WORLD_SPAWN;
39+
private static KeyMapping TOGGLE_PLAYER_ICON;
40+
private static KeyMapping TOGGLE_DATAPACK_STRUCTURES;
41+
private static List<KeyMapping> ALL = List.of();
42+
43+
private static KeyMapping register(String translationKey, int defaultKey) {
44+
return KeyMappingHelper.registerKeyMapping(new KeyMapping(translationKey, defaultKey, CATEGORY));
45+
}
46+
47+
public static void registerAll() {
48+
if (!ALL.isEmpty()) {
49+
return;
50+
}
51+
OPEN_SEEDMAP = register("key.seedmapper.open_seedmap", InputConstants.KEY_M);
52+
TOGGLE_MINIMAP = register("key.seedmapper.toggle_minimap", InputConstants.KEY_COMMA);
53+
TOGGLE_OPTIONS = register("key.seedmapper.toggle_options", InputConstants.KEY_O);
54+
OPEN_LOOT_VIEWER = register("key.seedmapper.open_loot_viewer", InputConstants.KEY_L);
55+
CLEAR_ESP = register("key.seedmapper.clear_esp", InputConstants.KEY_SEMICOLON);
56+
TOGGLE_SELECTED_ESP = register("key.seedmapper.toggle_selected_esp", UNBOUND_KEY);
57+
TOGGLE_BLOCK_ESP = register("key.seedmapper.toggle_block_esp", UNBOUND_KEY);
58+
TOGGLE_ORE_VEIN_ESP = register("key.seedmapper.toggle_ore_vein_esp", UNBOUND_KEY);
59+
TOGGLE_CANYON_ESP = register("key.seedmapper.toggle_canyon_esp", UNBOUND_KEY);
60+
TOGGLE_CAVE_ESP = register("key.seedmapper.toggle_cave_esp", UNBOUND_KEY);
61+
TOGGLE_TERRAIN_ESP = register("key.seedmapper.toggle_terrain_esp", UNBOUND_KEY);
62+
TOGGLE_ORE_VEINS = register("key.seedmapper.toggle_ore_veins", UNBOUND_KEY);
63+
TOGGLE_CANYON = register("key.seedmapper.toggle_canyon", UNBOUND_KEY);
64+
TOGGLE_SLIME_CHUNKS = register("key.seedmapper.toggle_slime_chunks", UNBOUND_KEY);
65+
TOGGLE_WAYPOINTS = register("key.seedmapper.toggle_waypoints", UNBOUND_KEY);
66+
TOGGLE_WORLD_SPAWN = register("key.seedmapper.toggle_world_spawn", UNBOUND_KEY);
67+
TOGGLE_PLAYER_ICON = register("key.seedmapper.toggle_player_icon", UNBOUND_KEY);
68+
TOGGLE_DATAPACK_STRUCTURES = register("key.seedmapper.toggle_datapack_structures", UNBOUND_KEY);
69+
ALL = List.of(
70+
OPEN_SEEDMAP,
71+
TOGGLE_MINIMAP,
72+
TOGGLE_OPTIONS,
73+
OPEN_LOOT_VIEWER,
74+
CLEAR_ESP,
75+
TOGGLE_SELECTED_ESP,
76+
TOGGLE_BLOCK_ESP,
77+
TOGGLE_ORE_VEIN_ESP,
78+
TOGGLE_CANYON_ESP,
79+
TOGGLE_CAVE_ESP,
80+
TOGGLE_TERRAIN_ESP,
81+
TOGGLE_ORE_VEINS,
82+
TOGGLE_CANYON,
83+
TOGGLE_SLIME_CHUNKS,
84+
TOGGLE_WAYPOINTS,
85+
TOGGLE_WORLD_SPAWN,
86+
TOGGLE_PLAYER_ICON,
87+
TOGGLE_DATAPACK_STRUCTURES
88+
);
89+
}
90+
91+
public static List<KeyMapping> all() {
92+
return ALL;
93+
}
94+
95+
public static void handleClientTick(Minecraft minecraft) {
96+
while (OPEN_SEEDMAP.consumeClick()) {
97+
runCommand(minecraft, "sm:seedmap");
98+
}
99+
while (TOGGLE_MINIMAP.consumeClick()) {
100+
runCommand(minecraft, "sm:minimap");
101+
}
102+
while (TOGGLE_OPTIONS.consumeClick()) {
103+
if (!SeedMapScreen.toggleOptionsFromKeybind(minecraft)) {
104+
runCommand(minecraft, "sm:seedmap");
105+
}
106+
}
107+
while (OPEN_LOOT_VIEWER.consumeClick()) {
108+
SeedMapScreen.openLootViewerFromKeybind(minecraft);
109+
}
110+
while (CLEAR_ESP.consumeClick()) {
111+
RenderManager.clear();
112+
}
113+
while (TOGGLE_SELECTED_ESP.consumeClick()) {
114+
SeedMapScreen.toggleSelectedEspFromKeybind(minecraft);
115+
}
116+
while (TOGGLE_BLOCK_ESP.consumeClick()) {
117+
SeedMapScreen.toggleBlockEspFromKeybind(minecraft);
118+
}
119+
while (TOGGLE_ORE_VEIN_ESP.consumeClick()) {
120+
SeedMapScreen.toggleOreVeinEspFromKeybind(minecraft);
121+
}
122+
while (TOGGLE_CANYON_ESP.consumeClick()) {
123+
SeedMapScreen.toggleCanyonEspFromKeybind(minecraft);
124+
}
125+
while (TOGGLE_CAVE_ESP.consumeClick()) {
126+
SeedMapScreen.toggleCaveEspFromKeybind(minecraft);
127+
}
128+
while (TOGGLE_TERRAIN_ESP.consumeClick()) {
129+
SeedMapScreen.toggleTerrainEspFromKeybind(minecraft);
130+
}
131+
while (TOGGLE_ORE_VEINS.consumeClick()) {
132+
toggleFeatures(MapFeature.COPPER_ORE_VEIN, MapFeature.IRON_ORE_VEIN);
133+
}
134+
while (TOGGLE_CANYON.consumeClick()) {
135+
toggleFeatures(MapFeature.CANYON);
136+
}
137+
while (TOGGLE_SLIME_CHUNKS.consumeClick()) {
138+
toggleFeatures(MapFeature.SLIME_CHUNK);
139+
}
140+
while (TOGGLE_WAYPOINTS.consumeClick()) {
141+
toggleFeatures(MapFeature.WAYPOINT);
142+
}
143+
while (TOGGLE_WORLD_SPAWN.consumeClick()) {
144+
toggleFeatures(MapFeature.WORLD_SPAWN);
145+
}
146+
while (TOGGLE_PLAYER_ICON.consumeClick()) {
147+
toggleFeatures(MapFeature.PLAYER_ICON);
148+
}
149+
while (TOGGLE_DATAPACK_STRUCTURES.consumeClick()) {
150+
Configs.ShowDatapackStructures = !Configs.ShowDatapackStructures;
151+
Configs.save();
152+
SeedMapMinimapManager.refreshIfOpen();
153+
}
154+
}
155+
156+
private static void runCommand(Minecraft minecraft, String command) {
157+
if (minecraft.player == null || minecraft.player.connection == null) {
158+
return;
159+
}
160+
minecraft.player.connection.sendCommand(command);
161+
}
162+
163+
private static void toggleFeatures(MapFeature... features) {
164+
boolean enable = Arrays.stream(features).anyMatch(feature -> !Configs.ToggledFeatures.contains(feature));
165+
for (MapFeature feature : features) {
166+
if (enable) {
167+
Configs.ToggledFeatures.add(feature);
168+
} else {
169+
Configs.ToggledFeatures.remove(feature);
170+
}
171+
}
172+
Configs.save();
173+
SeedMapMinimapManager.refreshIfOpen();
174+
}
175+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ public class VersionArgument implements ArgumentType<Integer> {
133133
.put("1.21.10", Cubiomes.MC_1_21_9())
134134
.put("1.21.11", Cubiomes.MC_1_21_11())
135135
.put("26.1", Cubiomes.MC_1_21_11())
136+
.put("26.1.1", Cubiomes.MC_1_21_11())
136137
.build();
137138
//</editor-fold>
138139

0 commit comments

Comments
 (0)