Add Minecraft 26.x support and version Java artifacts
This commit is contained in:
@@ -7,7 +7,8 @@ import { assertTerrainImage } from "../renderer/image-validation.mjs";
|
||||
|
||||
// Exercise the product's rendering worker without launching a Minecraft server
|
||||
// or driving the website. A cached real export can also be supplied as argv[2].
|
||||
const output = ".cache/renderer-regression";
|
||||
let minecraftVersion = process.argv[3] || "1.21.11";
|
||||
const output = `.cache/renderer-regression-${minecraftVersion}`;
|
||||
const snapshot = {
|
||||
bounds: { minX: -24, minZ: -24, maxX: 24, maxZ: 24 },
|
||||
coverage: [],
|
||||
@@ -69,11 +70,12 @@ let points = [
|
||||
[0.5, 18.5],
|
||||
].map(([x, z], i) => ({ id: `p${i}`, x, y: 66.62, z }));
|
||||
let source = "grass, dirt, water, tree and building regression fixture";
|
||||
if (process.argv[2]) {
|
||||
if (process.argv[2] && process.argv[2] !== "--fixture") {
|
||||
const directory = process.argv[2];
|
||||
const manifest = JSON.parse(
|
||||
await readFile(`${directory}/manifest.json`, "utf8"),
|
||||
);
|
||||
minecraftVersion = manifest.minecraftVersion;
|
||||
terrain = JSON.parse(
|
||||
gunzipSync(await readFile(`${directory}/terrain.json.gz`)).toString(),
|
||||
);
|
||||
@@ -81,7 +83,10 @@ if (process.argv[2]) {
|
||||
source = "cached Paper export (no server started)";
|
||||
}
|
||||
await mkdir(output, { recursive: true });
|
||||
const report = await renderSnapshot(terrain, points, output, { size: 256 });
|
||||
const report = await renderSnapshot(terrain, points, output, {
|
||||
size: 256,
|
||||
minecraftVersion,
|
||||
});
|
||||
assert.ok(report.meshes > 0, "terrain must produce meshes");
|
||||
assert.ok(report.emittedFaces > 0, "terrain must produce faces");
|
||||
assert.ok(report.hiddenFaces > 0, "interior terrain faces must be culled");
|
||||
@@ -106,12 +111,16 @@ assert.ok(
|
||||
"blocks without explicit default properties must appear on the aerial map",
|
||||
);
|
||||
const mapPixel = (x, z) => {
|
||||
const pixelX = Math.floor(((x - snapshot.bounds.minX + 0.5) / 48) * mapInfo.width);
|
||||
const pixelY = Math.floor(((z - snapshot.bounds.minZ + 0.5) / 48) * mapInfo.height);
|
||||
const pixelX = Math.floor(
|
||||
((x - snapshot.bounds.minX + 0.5) / 48) * mapInfo.width,
|
||||
);
|
||||
const pixelY = Math.floor(
|
||||
((z - snapshot.bounds.minZ + 0.5) / 48) * mapInfo.height,
|
||||
);
|
||||
const offset = (pixelY * mapInfo.width + pixelX) * mapInfo.channels;
|
||||
return mapPixels.subarray(offset, offset + 3);
|
||||
};
|
||||
if (!process.argv[2]) {
|
||||
if (!process.argv[2] || process.argv[2] === "--fixture") {
|
||||
const shadedGrass = mapPixel(10, 9);
|
||||
const sunlitGrass = mapPixel(10, -9);
|
||||
assert.ok(
|
||||
|
||||
Reference in New Issue
Block a user