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
14 changes: 13 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [core, spigot]
platform: [core, spigot, spigot26]
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
Expand All @@ -28,6 +28,14 @@ jobs:
with:
distribution: temurin
java-version: '21'
- uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
if: matrix.platform == 'spigot26'
with:
distribution: temurin
java-version: '25'
- name: Build and inspect Minecraft 26 candidate
if: matrix.platform == 'spigot26'
run: bash gradlew-minecraft26 verifySpigotJar --no-daemon --console=plain
- name: Test shared core
if: matrix.platform == 'core'
run: bash gradlew -PdynmapPlatform=core :DynmapCore:test --no-daemon --console=plain
Expand All @@ -44,4 +52,8 @@ jobs:
path: |
DynmapCore/build/reports/tests/
DynmapCore/build/test-results/
bukkit-helper-26-2/build/reports/tests/
bukkit-helper-26-2/build/test-results/
spigot/build/reports/tests/
spigot/build/test-results/
build/reports/acecore/
13 changes: 8 additions & 5 deletions DynmapCore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ eclipse {
}
}

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
java {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}

dependencies {
implementation project(':DynmapCoreAPI')
Expand Down Expand Up @@ -68,17 +71,17 @@ shadowJar {
include(dependency('com.googlecode.json-simple:json-simple:'))
include(dependency('org.yaml:snakeyaml:'))
include(dependency('com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:'))
include(dependency('javax.servlet::'))
include(dependency('org.eclipse.jetty::'))
include(dependency('javax.servlet:.*:.*'))
include(dependency('org.eclipse.jetty:.*:.*'))
include(dependency('org.eclipse.jetty.orbit:javax.servlet:'))
include(dependency('org.postgresql:postgresql:'))
include(dependency('io.github.linktosriram.s3lite:core:'))
include(dependency('io.github.linktosriram.s3lite:api:'))
include(dependency('io.github.linktosriram.s3lite:http-client-url-connection:'))
include(dependency('io.github.linktosriram.s3lite:http-client-spi:'))
include(dependency('io.github.linktosriram.s3lite:util:'))
include(dependency('jakarta.xml.bind::'))
include(dependency('com.sun.xml.bind::'))
include(dependency('jakarta.xml.bind:.*:.*'))
include(dependency('com.sun.xml.bind:.*:.*'))
include(dependency(':DynmapCoreAPI'))
exclude("META-INF/maven/**")
exclude("META-INF/services/**")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package org.dynmap.hdmap.renderer;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.Map;
import org.dynmap.Log;
import org.dynmap.renderer.CustomRenderer;
import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.renderer.MapDataContext;
import org.dynmap.renderer.RenderPatch;
import org.dynmap.renderer.RenderPatchFactory;
import org.dynmap.renderer.RenderPatchFactory.SideVisible;

/** Block-state-only statue mesh, including the antenna above the owning block. */
public class CopperGolemStatueRenderer extends CustomRenderer {
private static final String[] POSES = {"standing", "sitting", "running", "star"};
private static final String[] FACINGS = {"north", "east", "south", "west"};
private final RenderPatch[][] meshes = new RenderPatch[16][];

@Override
public boolean initializeRenderer(RenderPatchFactory factory, String name, BitSet states, Map<String, String> parameters) {
if (!super.initializeRenderer(factory, name, states, parameters)) return false;
List<List<RenderPatch>> lists = new ArrayList<>();
for (int i = 0; i < meshes.length; i++) lists.add(new ArrayList<RenderPatch>());
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
CopperGolemStatueRenderer.class.getResourceAsStream("/copper-golem-statue.csv"), StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
if (line.startsWith("#") || line.isEmpty()) continue;
String[] fields = line.split(",");
int pose = indexOf(POSES, fields[0]);
int texture = Integer.parseInt(fields[1]);
double width = Double.parseDouble(fields[2]) / 16;
double height = Double.parseDouble(fields[3]) / 16;
SideVisible side = "1".equals(fields[4]) ? SideVisible.BOTTOM : SideVisible.TOP;
double[] points = new double[9];
for (int i = 0; i < points.length; i++) points[i] = Double.parseDouble(fields[i + 5]);
for (int facing = 0; facing < 4; facing++) {
double[] rotated = rotate(points, facing);
RenderPatch patch = factory.getPatch(rotated[0], rotated[1], rotated[2],
rotated[3], rotated[4], rotated[5], rotated[6], rotated[7], rotated[8],
0, width, 0, height, side, texture);
if (patch == null) throw new IOException("Invalid statue patch: " + line);
lists.get(pose * 4 + facing).add(patch);
}
}
for (int i = 0; i < meshes.length; i++) meshes[i] = lists.get(i).toArray(new RenderPatch[0]);
return true;
} catch (IOException | RuntimeException error) {
Log.severe("Cannot load copper golem statue model", error);
return false;
}
}

private static int indexOf(String[] values, String value) {
for (int i = 0; i < values.length; i++) if (values[i].equals(value)) return i;
throw new IllegalArgumentException("Unknown statue state: " + value);
}

private static double[] rotate(double[] source, int facing) {
double[] result = source.clone();
for (int i = 0; i < result.length; i += 3) {
double x = source[i] - 0.5, z = source[i + 2] - 0.5;
for (int n = 0; n < facing; n++) { double oldX = x; x = -z; z = oldX; }
result[i] = x + 0.5;
result[i + 2] = z + 0.5;
}
return result;
}

RenderPatch[] meshFor(DynmapBlockState state) {
int pose = 0, facing = 0;
for (int i = 0; i < POSES.length; i++) if (state.isStateMatch("copper_golem_pose", POSES[i])) pose = i;
for (int i = 0; i < FACINGS.length; i++) if (state.isStateMatch("facing", FACINGS[i])) facing = i;
return meshes[pose * 4 + facing];
}

@Override public RenderPatch[] getRenderPatchList(MapDataContext context) { return meshFor(context.getBlockType()); }
@Override public int getMaximumTextureCount() { return 65; }
@Override public boolean isOnlyBlockStateSensitive() { return true; }
}
18 changes: 9 additions & 9 deletions DynmapCore/src/main/java/org/dynmap/utils/PatchDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,25 +232,25 @@ public boolean validate() {
boolean good = true;
// Compute visible corners to see if we're inside cube (u.x = xu-x0, v.x = xv-x0)
double xx0 = x0 + u.x * umin + v.x * vmin;
double xx1 = x0 + u.x * vmin + v.x * vmax;
double xx2 = x0 + u.x * umax + v.x * vmin;
double xx3 = x0 + u.x * vmax + v.x * vmax;
double xx1 = x0 + u.x * umin + v.x * vmax;
double xx2 = x0 + u.x * umax + v.x * vminatumax;
double xx3 = x0 + u.x * umax + v.x * vmaxatumax;
if (outOfRange(xx0) || outOfRange(xx1) || outOfRange(xx2) || outOfRange(xx3)) {
Log.verboseinfo(String.format("Invalid visible range xu=[%f:%f], xv=[%f:%f]", xx0, xx2, xx1, xx3));
good = false;
}
double yy0 = y0 + u.y * umin + v.y * vmin;
double yy1 = y0 + u.y * vmin + v.y * vmax;
double yy2 = y0 + u.y * umax + v.y * vmin;
double yy3 = y0 + u.y * vmax + v.y * vmax;
double yy1 = y0 + u.y * umin + v.y * vmax;
double yy2 = y0 + u.y * umax + v.y * vminatumax;
double yy3 = y0 + u.y * umax + v.y * vmaxatumax;
if (outOfRange(yy0) || outOfRange(yy1) || outOfRange(yy2) || outOfRange(yy3)) {
Log.verboseinfo(String.format("Invalid visible range yu=[%f:%f], yv=[%f:%f]", yy0, yy2, yy1, yy3));
good = false;
}
double zz0 = z0 + u.z * umin + v.z * vmin;
double zz1 = z0 + u.z * vmin + v.z * vmax;
double zz2 = z0 + u.z * umax + v.z * vmin;
double zz3 = z0 + u.z * vmax + v.z * vmax;
double zz1 = z0 + u.z * umin + v.z * vmax;
double zz2 = z0 + u.z * umax + v.z * vminatumax;
double zz3 = z0 + u.z * umax + v.z * vmaxatumax;
if (outOfRange(zz0) || outOfRange(zz1) || outOfRange(zz2) || outOfRange(zz3)) {
Log.verboseinfo(String.format("Invalid visible range zu=[%f:%f], zv=[%f:%f]", zz0, zz2, zz1, zz3));
good = false;
Expand Down
Loading
Loading