Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4

[*.bat]
end_of_line = crlf

[*.{yml,yaml}]
indent_style = space
indent_size = 2
16 changes: 6 additions & 10 deletions .github/workflows/build-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["lts/*", "latest"]
steps:
- uses: actions/checkout@v3
- name: Use latest Node.js LTS
uses: actions/setup-node@v3
- name: Using nodejs v18
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.version }}
# cache: "yarn"
- run: yarn
node-version: "18"
- run: npm install
working-directory: ./server
- run: yarn build
- run: npm run build
working-directory: ./server
- run: yarn test
- run: npm run test
working-directory: ./server
24 changes: 0 additions & 24 deletions .run/Fabric Client.run.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ COPY ./server/package.json /usr/src/app/package.json

FROM base AS build

COPY ./server/yarn.lock /usr/src/app/yarn.lock
RUN yarn
COPY ./server/package-lock.json /usr/src/app/package-lock.json
RUN npm install

# copy source as late as possible, to reuse docker cache with node_modules
COPY ./server /usr/src/app
RUN yarn build
RUN npm run build

FROM build AS test
RUN yarn test
RUN npm run test

# final image only includes minimal files
FROM base AS deploy
Expand All @@ -33,4 +33,4 @@ ENV MAPSYNC_DATA_DIR=/data

EXPOSE 12312/tcp

CMD [ "yarn", "start" ]
CMD [ "npm", "start" ]
4 changes: 4 additions & 0 deletions mod/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://editorconfig.org

[*.const]
insert_final_newline = false
6 changes: 3 additions & 3 deletions mod/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See Gradle's releases here: https://gradle.org/releases/

plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.13-SNAPSHOT" apply false
}

Expand All @@ -21,7 +21,7 @@ subprojects {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${project.minecraft_version}:${project.parchment_version}@zip")
parchment("org.parchmentmc.data:${project.parchment_name}:${project.parchment_version}@zip")
}
}
}
Expand All @@ -48,7 +48,7 @@ allprojects {
includeGroup "maven.modrinth"
}
}
maven { url = "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" }
maven { url = "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" }
}

tasks.withType(JavaCompile) {
Expand Down
30 changes: 9 additions & 21 deletions mod/common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
plugins {
// https://github.com/KyoriPowered/blossom/releases
id("net.kyori.blossom") version "1.3.1"
}

architectury {
injectInjectables = false
common(rootProject.enabled_platforms.split(","))
Expand All @@ -13,26 +8,19 @@ dependencies {
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"

// https://modrinth.com/mod/voxelmap-updated/version/1.21.11-1.15.13
modCompileOnly("maven.modrinth:voxelmap-updated:tRdGJKGE")
// https://modrinth.com/mod/journeymap/version/1.21.11-6.0.0-beta.56+fabric
modCompileOnly("maven.modrinth:journeymap:OSpjUIEM")
// https://modrinth.com/mod/xaeros-world-map/version/fabric-1.21.11-1.40.11
modCompileOnly("maven.modrinth:xaeros-world-map:CkZVhVE0")
}

tasks {
blossom {
replaceToken (
"%VERSION%",
project.version,
"src/main/java/gjum/minecraft/mapsync/common/MapSyncMod.java"
)
}
// https://modrinth.com/mod/voxelmap-updated/version/1.21.11-1.15.13
modCompileOnly("maven.modrinth:voxelmap-updated:tRdGJKGE")
// https://modrinth.com/mod/journeymap/version/1.21.11-6.0.0-beta.56+fabric
modCompileOnly("maven.modrinth:journeymap:OSpjUIEM")
// https://modrinth.com/mod/xaeros-world-map/version/fabric-1.21.11-1.40.11
modCompileOnly("maven.modrinth:xaeros-world-map:CkZVhVE0")
}

processResources {
filesMatching("assets/mapsync/lang/en_us.json") {
expand(rootProject.properties)
}
filesMatching("mapsync.version.const") {
expand(rootProject.properties)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import gjum.minecraft.mapsync.common.data.*;
import gjum.minecraft.mapsync.common.net.SyncClient;
import gjum.minecraft.mapsync.common.net.packet.*;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ServerData;
Expand All @@ -24,7 +27,18 @@
import static gjum.minecraft.mapsync.common.Cartography.chunkTileFromLevel;

public abstract class MapSyncMod {
public static final String VERSION = "%VERSION%";
public static final String VERSION; static {
final InputStream in = MapSyncMod.class.getResourceAsStream("/mapsync.version.const");
if (in == null) {
throw new ExceptionInInitializerError(new NullPointerException("'mapsync.version.const' const is missing!"));
}
try (in) {
VERSION = new String(in.readAllBytes(), StandardCharsets.UTF_8).trim();
}
catch (final IOException e) {
throw new ExceptionInInitializerError(e);
}
}

private static final Minecraft mc = Minecraft.getInstance();

Expand All @@ -38,16 +52,16 @@ public static MapSyncMod getMod() {
return INSTANCE;
}

public static final String MOD_ID = "mapsync";
public static final String MOD_ID = "mapsync";

public static final Identifier CATEGORY_ID = Identifier.fromNamespaceAndPath(MOD_ID, "general");
public static final KeyMapping.Category CATEGORY = KeyMapping.Category.register(CATEGORY_ID);
public static final Identifier CATEGORY_ID = Identifier.fromNamespaceAndPath(MOD_ID, "general");
public static final KeyMapping.Category CATEGORY = KeyMapping.Category.register(CATEGORY_ID);

private static final KeyMapping openGuiKey = new KeyMapping(
"key.map-sync.openGui",
InputConstants.Type.KEYSYM,
GLFW.GLFW_KEY_COMMA,
CATEGORY
CATEGORY
//"category.map-sync"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ protected void init() {
right = width / 2 + innerWidth / 2;
top = height / 3;

centerX = width / 2;
centerY = width / 2;
centerX = width / 2;
centerY = width / 2;

int buttonWidth = 100;
int buttonHeight = 20;
int buttonWidth = 100;
int buttonHeight = 20;

clearWidgets();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private void renderLoop() {

if (!JourneyMapHelper.isJourneyMapNotAvailable && !JourneyMapHelper.isMapping()
|| !VoxelMapHelper.isVoxelMapNotAvailable && !VoxelMapHelper.isMapping()
|| !XaerosWorldMapHelper.isXaerosWorldMapNotAvailable && !XaerosWorldMapHelper.isMapping()
|| !XaerosWorldMapHelper.isXaerosWorldMapNotAvailable && !XaerosWorldMapHelper.isMapping()
) {
debugLog("render is waiting til map mod is ready");
Thread.sleep(1000);
Expand All @@ -80,7 +80,7 @@ private void renderLoop() {
} else {
boolean voxelRendered = VoxelMapHelper.updateWithChunkTile(chunkTile);
boolean renderedJM = JourneyMapHelper.updateWithChunkTile(chunkTile);
boolean xaeroRendered = XaerosWorldMapHelper.updateWithChunkTile(chunkTile);
boolean xaeroRendered = XaerosWorldMapHelper.updateWithChunkTile(chunkTile);

debugLog("rendered? " + (voxelRendered||renderedJM|| xaeroRendered) + " " + chunkTile.chunkPos() + " queue=" + queue.size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class JsonConfig {
System.out.println("[map-sync] Created default " + file);
return config;
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException |
InvocationTargetException ex) {
InvocationTargetException ex) {
throw new IllegalArgumentException(ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

public record RegionPos(int x, int z) {

public static final int CHUNKS_IN_REGION = 32 * 32;
public static final int CHUNKS_IN_REGION = 32 * 32;

public static RegionPos forChunkPos(ChunkPos pos) {
return new RegionPos(pos.x >> 5, pos.z >> 5);
}
public static RegionPos forChunkPos(ChunkPos pos) {
return new RegionPos(pos.x >> 5, pos.z >> 5);
}

public static int chunkIndex(ChunkPos pos) {
return (pos.x & 0b11111) + 32 * (pos.z & 0b11111);
}
public static int chunkIndex(ChunkPos pos) {
return (pos.x & 0b11111) + 32 * (pos.z & 0b11111);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ public class JourneyMapHelper {
Class<?> jmClient = Class.forName("journeymap.client.JourneymapClient");
String version = null;
try {
// Try to get a version field or method
try {
version = (String) jmClient.getDeclaredField("FULL_VERSION").get(null);
} catch (NoSuchFieldException e) { }
} catch (Exception ignored) {}
// Try to get a version field or method
try {
version = (String) jmClient.getDeclaredField("FULL_VERSION").get(null);
} catch (NoSuchFieldException e) { }
} catch (Exception ignored) {}

if (version != null) {
// Compare version strings as needed, e.g., "6.0.0"
if (!Pattern.compile("6\\.\\d+\\.\\d+").matcher(version).find()) {
isJourneyMapNotAvailable = true;
System.err.println("Please update JourneyMap to at least 6.0.0 (found " + version + ")");
} else {
isJourneyMapNotAvailable = false;
}
}
// Compare version strings as needed, e.g., "6.0.0"
if (!Pattern.compile("6\\.\\d+\\.\\d+").matcher(version).find()) {
isJourneyMapNotAvailable = true;
System.err.println("Please update JourneyMap to at least 6.0.0 (found " + version + ")");
} else {
isJourneyMapNotAvailable = false;
}
}
} catch (NoClassDefFoundError | ClassNotFoundException ignored) {
isJourneyMapNotAvailable = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class XaerosWorldMapHelper {

static {
try {
// TODO: update when found needed
// TODO: update when found needed
Class.forName("xaero.map.WorldMap");
isXaerosWorldMapNotAvailable = false;
} catch (NoClassDefFoundError | ClassNotFoundException ignored) {
Expand All @@ -26,4 +26,4 @@ public static boolean updateWithChunkTile(ChunkTile chunkTile) {
if (isXaerosWorldMapNotAvailable) return false;
return XaerosWorldMapHelperReal.updateWithChunkTile(chunkTile);
}
}
}
Loading
Loading