From 22ab471ce4e57c19a73072e8d24beeb4ebea096a Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 24 Nov 2026 00:03:20 +0100 Subject: [PATCH] Add native trail wear profiles and preserve installed terrain during rollout --- DuneTerrain/trails/caladan-config.yml | 54 +++++++++++++++++++ DuneTerrain/trails/giedi_prime-config.yml | 54 +++++++++++++++++++ DuneTerrain/trails/kaitain-config.yml | 51 ++++++++++++++++++ DuneTerrain/trails/lobby-config.yml | 50 +++++++++++++++++ .../trails/sigma_draconis_iv-config.yml | 54 +++++++++++++++++++ tools/PatchPlanetSurface.java | 32 +++++++++++ tools/build-planet-trails.mjs | 21 ++++++++ 7 files changed, 316 insertions(+) create mode 100644 DuneTerrain/trails/caladan-config.yml create mode 100644 DuneTerrain/trails/giedi_prime-config.yml create mode 100644 DuneTerrain/trails/kaitain-config.yml create mode 100644 DuneTerrain/trails/lobby-config.yml create mode 100644 DuneTerrain/trails/sigma_draconis_iv-config.yml create mode 100644 tools/PatchPlanetSurface.java create mode 100644 tools/build-planet-trails.mjs diff --git a/DuneTerrain/trails/caladan-config.yml b/DuneTerrain/trails/caladan-config.yml new file mode 100644 index 00000000..8b0a78ac --- /dev/null +++ b/DuneTerrain/trails/caladan-config.yml @@ -0,0 +1,54 @@ +# Native Trails 1.9, pinned compatibility build; data remains local chunk PDC. +# DuneRealms nature adaptation overrides claim protection only inside Trails. +General: + Language: en-US + enabled-by-default: true + boost-enabled-by-default: false + run-modifier: 1.5 + sneak-bypass: true + speed-boost-interval: 1 + speed-boost-step: 0.006 + speed-boost-only-trails: true + use-permission-for-trails: false + use-permission-for-boost: true + immediately-remove-boost: true + trail-tool: STRUCTURE_VOID + info-tool: STRUCTURE_VOID + trail-decay: false + decay-fraction: 0.03 + chunk-chance: 0.2 + decay-timer: 1200 + decay-distance: 5 + step-decay-fraction: 0.1 + strict-links: false + trails-particle: NAUTILUS + enabled-worlds: [caladan] +Messages: + SendDenyMessage: false + Interval: 10 +Plugin-Integration: + Towny: {PathsInWilderness: true, TownyPathsPerm: false} + WorldGuard: {IntegrationEnabled: false, CheckBypass: false, decay-flag: false} + PlayerPlot: {integration-enabled: false} + RedProtect: {integration-enabled: false} + Residence: {integration-enabled: false} + CoreProtect: {LogPathBlocks: true} + LogBlock: {LogPathBlocks: false} + Dynmap: {trails-trigger-render: false} +Trails: + Surface1: 'GRASS_BLOCK:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface2: 'DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface3: 'PODZOL:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface4: 'ROOTED_DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface5: 'MOSS_BLOCK:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface6: 'MUD:32:100:1.0 > PACKED_MUD:0:100:1.0' + Surface7: 'SAND:32:100:1.0 > SANDSTONE:0:100:1.0' + Surface8: 'STONE:32:100:1.0 > COBBLESTONE:0:100:1.0' + Surface9: 'GRANITE:32:100:1.0 > POLISHED_GRANITE:0:100:1.0' + Surface10: 'DIORITE:32:100:1.0 > POLISHED_DIORITE:0:100:1.0' + Surface11: 'ANDESITE:32:100:1.0 > POLISHED_ANDESITE:0:100:1.0' + Surface12: 'TUFF:32:100:1.0 > POLISHED_TUFF:0:100:1.0' + Surface13: 'STONE_BRICKS:32:100:1.0 > CRACKED_STONE_BRICKS:0:100:1.0' + Surface14: 'GLASS:32:100:1.0 > TINTED_GLASS:0:100:1.0' +Data-Saving: + Interval: 1 diff --git a/DuneTerrain/trails/giedi_prime-config.yml b/DuneTerrain/trails/giedi_prime-config.yml new file mode 100644 index 00000000..0162b616 --- /dev/null +++ b/DuneTerrain/trails/giedi_prime-config.yml @@ -0,0 +1,54 @@ +# Native Trails 1.9, pinned compatibility build; data remains local chunk PDC. +# DuneRealms nature adaptation overrides claim protection only inside Trails. +General: + Language: en-US + enabled-by-default: true + boost-enabled-by-default: false + run-modifier: 1.5 + sneak-bypass: true + speed-boost-interval: 1 + speed-boost-step: 0.006 + speed-boost-only-trails: true + use-permission-for-trails: false + use-permission-for-boost: true + immediately-remove-boost: true + trail-tool: STRUCTURE_VOID + info-tool: STRUCTURE_VOID + trail-decay: false + decay-fraction: 0.03 + chunk-chance: 0.2 + decay-timer: 1200 + decay-distance: 5 + step-decay-fraction: 0.1 + strict-links: false + trails-particle: NAUTILUS + enabled-worlds: [giedi_prime, giedi_prime_nether] +Messages: + SendDenyMessage: false + Interval: 10 +Plugin-Integration: + Towny: {PathsInWilderness: true, TownyPathsPerm: false} + WorldGuard: {IntegrationEnabled: false, CheckBypass: false, decay-flag: false} + PlayerPlot: {integration-enabled: false} + RedProtect: {integration-enabled: false} + Residence: {integration-enabled: false} + CoreProtect: {LogPathBlocks: true} + LogBlock: {LogPathBlocks: false} + Dynmap: {trails-trigger-render: false} +Trails: + Surface1: 'DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface2: 'COARSE_DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface3: 'DEEPSLATE:32:100:1.0 > COBBLED_DEEPSLATE:0:100:1.0' + Surface4: 'NETHERRACK:32:100:1.0 > CRACKED_NETHER_BRICKS:0:100:1.0' + Surface5: 'SOUL_SAND:32:100:1.0 > SOUL_SOIL:0:100:1.0' + Surface6: 'BASALT:32:100:1.0 > SMOOTH_BASALT:0:100:1.0' + Surface7: 'BLACKSTONE:32:100:1.0 > POLISHED_BLACKSTONE:0:100:1.0' + Surface8: 'STONE:32:100:1.0 > COBBLESTONE:0:100:1.0' + Surface9: 'GRANITE:32:100:1.0 > POLISHED_GRANITE:0:100:1.0' + Surface10: 'DIORITE:32:100:1.0 > POLISHED_DIORITE:0:100:1.0' + Surface11: 'ANDESITE:32:100:1.0 > POLISHED_ANDESITE:0:100:1.0' + Surface12: 'TUFF:32:100:1.0 > POLISHED_TUFF:0:100:1.0' + Surface13: 'STONE_BRICKS:32:100:1.0 > CRACKED_STONE_BRICKS:0:100:1.0' + Surface14: 'GLASS:32:100:1.0 > TINTED_GLASS:0:100:1.0' +Data-Saving: + Interval: 1 diff --git a/DuneTerrain/trails/kaitain-config.yml b/DuneTerrain/trails/kaitain-config.yml new file mode 100644 index 00000000..6444adfa --- /dev/null +++ b/DuneTerrain/trails/kaitain-config.yml @@ -0,0 +1,51 @@ +# Native Trails 1.9, pinned compatibility build; data remains local chunk PDC. +# DuneRealms nature adaptation overrides claim protection only inside Trails. +General: + Language: en-US + enabled-by-default: true + boost-enabled-by-default: false + run-modifier: 1.5 + sneak-bypass: true + speed-boost-interval: 1 + speed-boost-step: 0.006 + speed-boost-only-trails: true + use-permission-for-trails: false + use-permission-for-boost: true + immediately-remove-boost: true + trail-tool: STRUCTURE_VOID + info-tool: STRUCTURE_VOID + trail-decay: false + decay-fraction: 0.03 + chunk-chance: 0.2 + decay-timer: 1200 + decay-distance: 5 + step-decay-fraction: 0.1 + strict-links: false + trails-particle: NAUTILUS + enabled-worlds: [kaitain] +Messages: + SendDenyMessage: false + Interval: 10 +Plugin-Integration: + Towny: {PathsInWilderness: true, TownyPathsPerm: false} + WorldGuard: {IntegrationEnabled: false, CheckBypass: false, decay-flag: false} + PlayerPlot: {integration-enabled: false} + RedProtect: {integration-enabled: false} + Residence: {integration-enabled: false} + CoreProtect: {LogPathBlocks: true} + LogBlock: {LogPathBlocks: false} + Dynmap: {trails-trigger-render: false} +Trails: + Surface1: 'GRASS_BLOCK:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface2: 'DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface3: 'COARSE_DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface4: 'SAND:32:100:1.0 > SANDSTONE:0:100:1.0' + Surface5: 'STONE:32:100:1.0 > COBBLESTONE:0:100:1.0' + Surface6: 'GRANITE:32:100:1.0 > POLISHED_GRANITE:0:100:1.0' + Surface7: 'DIORITE:32:100:1.0 > POLISHED_DIORITE:0:100:1.0' + Surface8: 'ANDESITE:32:100:1.0 > POLISHED_ANDESITE:0:100:1.0' + Surface9: 'TUFF:32:100:1.0 > POLISHED_TUFF:0:100:1.0' + Surface10: 'STONE_BRICKS:32:100:1.0 > CRACKED_STONE_BRICKS:0:100:1.0' + Surface11: 'GLASS:32:100:1.0 > TINTED_GLASS:0:100:1.0' +Data-Saving: + Interval: 1 diff --git a/DuneTerrain/trails/lobby-config.yml b/DuneTerrain/trails/lobby-config.yml new file mode 100644 index 00000000..966840bc --- /dev/null +++ b/DuneTerrain/trails/lobby-config.yml @@ -0,0 +1,50 @@ +# Native Trails 1.9, pinned compatibility build; data remains local chunk PDC. +# DuneRealms nature adaptation overrides claim protection only inside Trails. +General: + Language: en-US + enabled-by-default: true + boost-enabled-by-default: false + run-modifier: 1.5 + sneak-bypass: true + speed-boost-interval: 1 + speed-boost-step: 0.006 + speed-boost-only-trails: true + use-permission-for-trails: false + use-permission-for-boost: true + immediately-remove-boost: true + trail-tool: STRUCTURE_VOID + info-tool: STRUCTURE_VOID + trail-decay: false + decay-fraction: 0.03 + chunk-chance: 0.2 + decay-timer: 1200 + decay-distance: 5 + step-decay-fraction: 0.1 + strict-links: false + trails-particle: NAUTILUS + enabled-worlds: [lobby, world, world_the_end] +Messages: + SendDenyMessage: false + Interval: 10 +Plugin-Integration: + Towny: {PathsInWilderness: true, TownyPathsPerm: false} + WorldGuard: {IntegrationEnabled: false, CheckBypass: false, decay-flag: false} + PlayerPlot: {integration-enabled: false} + RedProtect: {integration-enabled: false} + Residence: {integration-enabled: false} + CoreProtect: {LogPathBlocks: true} + LogBlock: {LogPathBlocks: false} + Dynmap: {trails-trigger-render: false} +Trails: + Surface1: 'END_STONE:32:100:1.0 > END_STONE_BRICKS:0:100:1.0' + Surface2: 'GRASS_BLOCK:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface3: 'DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface4: 'STONE:32:100:1.0 > COBBLESTONE:0:100:1.0' + Surface5: 'GRANITE:32:100:1.0 > POLISHED_GRANITE:0:100:1.0' + Surface6: 'DIORITE:32:100:1.0 > POLISHED_DIORITE:0:100:1.0' + Surface7: 'ANDESITE:32:100:1.0 > POLISHED_ANDESITE:0:100:1.0' + Surface8: 'TUFF:32:100:1.0 > POLISHED_TUFF:0:100:1.0' + Surface9: 'STONE_BRICKS:32:100:1.0 > CRACKED_STONE_BRICKS:0:100:1.0' + Surface10: 'GLASS:32:100:1.0 > TINTED_GLASS:0:100:1.0' +Data-Saving: + Interval: 1 diff --git a/DuneTerrain/trails/sigma_draconis_iv-config.yml b/DuneTerrain/trails/sigma_draconis_iv-config.yml new file mode 100644 index 00000000..d80f5b8e --- /dev/null +++ b/DuneTerrain/trails/sigma_draconis_iv-config.yml @@ -0,0 +1,54 @@ +# Native Trails 1.9, pinned compatibility build; data remains local chunk PDC. +# DuneRealms nature adaptation overrides claim protection only inside Trails. +General: + Language: en-US + enabled-by-default: true + boost-enabled-by-default: false + run-modifier: 1.5 + sneak-bypass: true + speed-boost-interval: 1 + speed-boost-step: 0.006 + speed-boost-only-trails: true + use-permission-for-trails: false + use-permission-for-boost: true + immediately-remove-boost: true + trail-tool: STRUCTURE_VOID + info-tool: STRUCTURE_VOID + trail-decay: false + decay-fraction: 0.03 + chunk-chance: 0.2 + decay-timer: 1200 + decay-distance: 5 + step-decay-fraction: 0.1 + strict-links: false + trails-particle: NAUTILUS + enabled-worlds: [sigma_draconis_iv, sigma_draconis_iv_the_end] +Messages: + SendDenyMessage: false + Interval: 10 +Plugin-Integration: + Towny: {PathsInWilderness: true, TownyPathsPerm: false} + WorldGuard: {IntegrationEnabled: false, CheckBypass: false, decay-flag: false} + PlayerPlot: {integration-enabled: false} + RedProtect: {integration-enabled: false} + Residence: {integration-enabled: false} + CoreProtect: {LogPathBlocks: true} + LogBlock: {LogPathBlocks: false} + Dynmap: {trails-trigger-render: false} +Trails: + Surface1: 'SNOW_BLOCK:32:100:1.0 > PACKED_ICE:0:100:1.0' + Surface2: 'ICE:32:100:1.0 > PACKED_ICE:0:100:1.0' + Surface3: 'PODZOL:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface4: 'DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface5: 'COARSE_DIRT:32:100:1.0 > DIRT_PATH:0:100:1.0' + Surface6: 'RED_SAND:32:100:1.0 > RED_SANDSTONE:0:100:1.0' + Surface7: 'END_STONE:32:100:1.0 > END_STONE_BRICKS:0:100:1.0' + Surface8: 'STONE:32:100:1.0 > COBBLESTONE:0:100:1.0' + Surface9: 'GRANITE:32:100:1.0 > POLISHED_GRANITE:0:100:1.0' + Surface10: 'DIORITE:32:100:1.0 > POLISHED_DIORITE:0:100:1.0' + Surface11: 'ANDESITE:32:100:1.0 > POLISHED_ANDESITE:0:100:1.0' + Surface12: 'TUFF:32:100:1.0 > POLISHED_TUFF:0:100:1.0' + Surface13: 'STONE_BRICKS:32:100:1.0 > CRACKED_STONE_BRICKS:0:100:1.0' + Surface14: 'GLASS:32:100:1.0 > TINTED_GLASS:0:100:1.0' +Data-Saving: + Interval: 1 diff --git a/tools/PatchPlanetSurface.java b/tools/PatchPlanetSurface.java new file mode 100644 index 00000000..87c8f4d1 --- /dev/null +++ b/tools/PatchPlanetSurface.java @@ -0,0 +1,32 @@ +import java.nio.file.*; +import java.security.*; +import java.util.*; +import java.util.zip.*; +import org.objectweb.asm.*; +import org.objectweb.asm.tree.*; + +/** Extend exact installed terrain with surface rules while preserving world generation. */ +public final class PatchPlanetSurface { + public static void main(String[] args)throws Exception{ + Path input=Path.of(args[0]),classes=Path.of(args[1]),output=Path.of(args[2]);String expected=args[3],prefix="com/example/duneterrain/"; + if(Files.exists(output)||!HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(Files.readAllBytes(input))).equals(expected))throw new IllegalStateException("Unexpected live plugin or existing output"); + var entries=new LinkedHashMap();try(var in=new ZipInputStream(Files.newInputStream(input))){for(ZipEntry e;(e=in.getNextEntry())!=null;)if(entries.put(e.getName(),in.readAllBytes())!=null)throw new IllegalStateException("Duplicate entry");} + var before=new LinkedHashMap<>(entries);String main=prefix+"DuneTerrain.class";var type=new ClassNode();new ClassReader(entries.get(main)).accept(type,0);var methods=new HashMap();for(var method:type.methods)methods.put(method.name+method.desc,PatchArrakisEcology.methodBytes(method)); + int edits=0; + for(var method:type.methods)if(method.name.equals("onEnable")&&method.desc.equals("()V")){ + var existing=new HashSet();for(var instruction:method.instructions)if(instruction instanceof MethodInsnNode call&&call.name.equals("start"))existing.add(call.owner); + if(existing.contains(prefix+"PlanetSoil"))throw new IllegalStateException("Surface rules already installed"); + var hook=new InsnList(); + for(String feature:List.of("TrailsBridge","PlanetSoil"))if(!existing.contains(prefix+feature)){hook.add(new VarInsnNode(Opcodes.ALOAD,0));hook.add(new MethodInsnNode(Opcodes.INVOKESTATIC,prefix+feature,"start","(Lorg/bukkit/plugin/Plugin;)V",false));} + method.instructions.insert(hook);method.maxStack=Math.max(method.maxStack,1);edits++; + } + if(edits!=1)throw new IllegalStateException("Missing activation hook");var writer=new ClassWriter(0);type.accept(writer);entries.put(main,writer.toByteArray()); + var verify=new ClassNode();new ClassReader(entries.get(main)).accept(verify,0);for(var method:verify.methods)if(!method.name.equals("onEnable")&&!Arrays.equals(methods.get(method.name+method.desc),PatchArrakisEcology.methodBytes(method)))throw new IllegalStateException("Unrelated method changed"); + var allowed=new HashSet(Set.of(main,"plugin.yml")); + for(String feature:List.of("TrailsBridge","PlanetSoil")){String name=prefix+feature+".class";byte[] data=Files.readAllBytes(classes.resolve(name));if(entries.containsKey(name)&&!Arrays.equals(entries.get(name),data))throw new IllegalStateException("Existing feature differs: "+feature);entries.put(name,data);allowed.add(name);} + String descriptor=new String(entries.get("plugin.yml"),java.nio.charset.StandardCharsets.UTF_8);if(descriptor.contains("surface1"))throw new IllegalStateException("Already patched");entries.put("plugin.yml",descriptor.replaceAll("(?m)^(version: [^\\r\\n]+)","$1-surface1").getBytes(java.nio.charset.StandardCharsets.UTF_8)); + for(var entry:before.entrySet())if(!allowed.contains(entry.getKey())&&!Arrays.equals(entry.getValue(),entries.get(entry.getKey())))throw new IllegalStateException("Unrelated archive entry changed"); + try(var out=new ZipOutputStream(Files.newOutputStream(output,StandardOpenOption.CREATE_NEW))){for(var entry:entries.entrySet()){var next=new ZipEntry(entry.getKey());next.setTime(0);out.putNextEntry(next);out.write(entry.getValue());out.closeEntry();}} + System.out.println("Preserved world generator and unrelated methods; SHA256 "+HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(Files.readAllBytes(output)))); + } +} diff --git a/tools/build-planet-trails.mjs b/tools/build-planet-trails.mjs new file mode 100644 index 00000000..8d930ee7 --- /dev/null +++ b/tools/build-planet-trails.mjs @@ -0,0 +1,21 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import {fileURLToPath} from 'node:url'; +const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'); +const baseline=fs.readFileSync(path.join(root,'DuneTerrain/trails/arrakis-config.yml'),'utf8'); +const common=[['STONE','COBBLESTONE'],['GRANITE','POLISHED_GRANITE'],['DIORITE','POLISHED_DIORITE'],['ANDESITE','POLISHED_ANDESITE'],['TUFF','POLISHED_TUFF'],['STONE_BRICKS','CRACKED_STONE_BRICKS'],['GLASS','TINTED_GLASS']]; +const profiles={ + caladan:{worlds:['caladan'],links:[['GRASS_BLOCK','DIRT_PATH'],['DIRT','DIRT_PATH'],['PODZOL','DIRT_PATH'],['ROOTED_DIRT','DIRT_PATH'],['MOSS_BLOCK','DIRT_PATH'],['MUD','PACKED_MUD'],['SAND','SANDSTONE']]}, + kaitain:{worlds:['kaitain'],links:[['GRASS_BLOCK','DIRT_PATH'],['DIRT','DIRT_PATH'],['COARSE_DIRT','DIRT_PATH'],['SAND','SANDSTONE']]}, + giedi_prime:{worlds:['giedi_prime','giedi_prime_nether'],links:[['DIRT','DIRT_PATH'],['COARSE_DIRT','DIRT_PATH'],['DEEPSLATE','COBBLED_DEEPSLATE'],['NETHERRACK','CRACKED_NETHER_BRICKS'],['SOUL_SAND','SOUL_SOIL'],['BASALT','SMOOTH_BASALT'],['BLACKSTONE','POLISHED_BLACKSTONE']]}, + sigma_draconis_iv:{worlds:['sigma_draconis_iv','sigma_draconis_iv_the_end'],links:[['SNOW_BLOCK','PACKED_ICE'],['ICE','PACKED_ICE'],['PODZOL','DIRT_PATH'],['DIRT','DIRT_PATH'],['COARSE_DIRT','DIRT_PATH'],['RED_SAND','RED_SANDSTONE'],['END_STONE','END_STONE_BRICKS']]}, + lobby:{worlds:['lobby','world','world_the_end'],links:[['END_STONE','END_STONE_BRICKS'],['GRASS_BLOCK','DIRT_PATH'],['DIRT','DIRT_PATH']]} +}; +for(const [name,profile] of Object.entries(profiles)){ + const links=[...profile.links,...common]; + if(new Set(links.map(([from])=>from)).size!==links.length)throw Error('Repeated source material '+name); + const rules=links.map(([from,to],i)=>` Surface${i+1}: '${from}:32:100:1.0 > ${to}:0:100:1.0'`).join('\n'); + const output=baseline.replace('enabled-worlds: [arrakis]',`enabled-worlds: [${profile.worlds.join(', ')}]`).replace(/Trails:\r?\n[\s\S]*?Data-Saving:/,`Trails:\n${rules}\nData-Saving:`); + fs.writeFileSync(path.join(root,'DuneTerrain/trails',name+'-config.yml'),output.replace(/\r\n/g,'\n')); +} +console.log('Generated five native Trails profiles; existing Arrakis policy unchanged.');