diff --git a/DuneRealmsGUI/build.gradle.kts b/DuneRealmsGUI/build.gradle.kts index c52f7631..ec625971 100644 --- a/DuneRealmsGUI/build.gradle.kts +++ b/DuneRealmsGUI/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java } group = "com.dunerealms" -version = "1.1.26" +version = "1.1.27" repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/"); maven("https://repo.opencollab.dev/main/") } dependencies { compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT") diff --git a/DuneRealmsGUI/planet-artwork/.gitattributes b/DuneRealmsGUI/planet-artwork/.gitattributes index 6cb3b6cf..4e7a2966 100644 --- a/DuneRealmsGUI/planet-artwork/.gitattributes +++ b/DuneRealmsGUI/planet-artwork/.gitattributes @@ -4,3 +4,7 @@ release-v1/*.zip -text release-v1/*.json text eol=lf release-v1/*.yml text eol=lf profiles.json text eol=lf +release-v2/*.zip -text +release-v2/*.json text eol=lf +release-v2/*.yml text eol=lf +flat-sand/*.png -text diff --git a/DuneRealmsGUI/planet-artwork/flat-sand/CREDITS.txt b/DuneRealmsGUI/planet-artwork/flat-sand/CREDITS.txt new file mode 100644 index 00000000..01c4ada6 --- /dev/null +++ b/DuneRealmsGUI/planet-artwork/flat-sand/CREDITS.txt @@ -0,0 +1,4 @@ +Flat sand source: Minetest Game / Luanti default_sand.png, contributors listed in LICENSE-Sand-Luanti.txt. +https://github.com/luanti-org/minetest_game/tree/9e895af6e9feb98332fa1a778001442f5669bc20/mods/default +License: CC BY-SA 3.0. https://creativecommons.org/licenses/by-sa/3.0/ +DuneRealms modifications: low-contrast planet-specific palette, seven-percent darker spice sand, constant flat normal and rough specular maps. Tile layout and grain preserved. diff --git a/DuneRealmsGUI/planet-artwork/flat-sand/LICENSE.txt b/DuneRealmsGUI/planet-artwork/flat-sand/LICENSE.txt new file mode 100644 index 00000000..625f0f86 --- /dev/null +++ b/DuneRealmsGUI/planet-artwork/flat-sand/LICENSE.txt @@ -0,0 +1,158 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2018 celeron55, Perttu Ahola +Copyright (C) 2011-2018 Various Minetest Game developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2010-2023: + + celeron55, Perttu Ahola + Cisoun + G4JC + VanessaE + RealBadAngel + Calinou + MirceaKitsune + Jordach + PilzAdam + jojoa1997 + InfinityProject + Splizard + Zeg9 + paramat + BlockMen + sofar + Neuromancer + Gambit + asl97 + KevDoy + Mito551 + GreenXenith + kaeza + kilbith + tobyplowy + CloudyProton + TumeniNodes + Mossmanikin + random-geek + Extex101 + An0n3m0us + Lopano + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) + +Copyright (C) 2009 cmusounddesign +Copyright (C) 2010 Tomlija +Copyright (C) 2010 lsprice +Copyright (C) 2014 sonictechtonic +Copyright (C) 2015 yadronoff +Copyright (C) 2007 HerbertBoland +Copyright (C) 2006 AGFX + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ + +----------------------- + +CC0 1.0 Universal (CC0 1.0) Public Domain Dedication + +Iwan Gabovitch +Ottomaani138 +Ogrebane +blukotek +Sevin7 +Yoyodaman234 +Ryding + +No Copyright + +The person who associated a work with this deed has dedicated the work to the +public domain by waiving all of his or her rights to the work worldwide under +copyright law, including all related and neighboring rights, to the extent +allowed by law. + +You can copy, modify, distribute and perform the work, even for commercial +purposes, all without asking permission. See Other Information below. + +Other Information: + +In no way are the patent or trademark rights of any person affected by CC0, nor +are the rights that other persons may have in the work or in how the work is +used, such as publicity or privacy rights. + +Unless expressly stated otherwise, the person who associated a work with this +deed makes no warranties about the work, and disclaims liability for all uses +of the work, to the fullest extent permitted by applicable law. + +When using or citing the work, you should not imply endorsement by the author +or the affirmer. + +For more details: +https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/DuneRealmsGUI/planet-artwork/flat-sand/default_sand.png b/DuneRealmsGUI/planet-artwork/flat-sand/default_sand.png new file mode 100644 index 00000000..645a3004 Binary files /dev/null and b/DuneRealmsGUI/planet-artwork/flat-sand/default_sand.png differ diff --git a/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-arrakis-v2.zip b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-arrakis-v2.zip new file mode 100644 index 00000000..c8f94839 Binary files /dev/null and b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-arrakis-v2.zip differ diff --git a/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-caladan-v2.zip b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-caladan-v2.zip new file mode 100644 index 00000000..c637a6c3 Binary files /dev/null and b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-caladan-v2.zip differ diff --git a/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-giedi_prime-v2.zip b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-giedi_prime-v2.zip new file mode 100644 index 00000000..5860cc07 Binary files /dev/null and b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-giedi_prime-v2.zip differ diff --git a/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-guild-v2.zip b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-guild-v2.zip new file mode 100644 index 00000000..b28e2432 Binary files /dev/null and b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-guild-v2.zip differ diff --git a/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-kaitain-v2.zip b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-kaitain-v2.zip new file mode 100644 index 00000000..89fa8cd4 Binary files /dev/null and b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-kaitain-v2.zip differ diff --git a/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-sigma_draconis_iv-v2.zip b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-sigma_draconis_iv-v2.zip new file mode 100644 index 00000000..2b6b48a6 Binary files /dev/null and b/DuneRealmsGUI/planet-artwork/release-v2/DuneRealms-Materials-sigma_draconis_iv-v2.zip differ diff --git a/DuneRealmsGUI/planet-artwork/release-v2/manifest.json b/DuneRealmsGUI/planet-artwork/release-v2/manifest.json new file mode 100644 index 00000000..6f08adb4 --- /dev/null +++ b/DuneRealmsGUI/planet-artwork/release-v2/manifest.json @@ -0,0 +1,86 @@ +{ + "version": 2, + "sourceCommit": "28e38cab7c1f03f86364ef704f705bebcc13cb3d", + "license": "CC-BY-SA-4.0", + "packId": "59f34b30-6a86-5e58-a813-6e776f726c64", + "packs": { + "guild": { + "name": "Vaerkring", + "filename": "DuneRealms-Materials-guild-v2.zip", + "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-guild-v2.zip", + "sha1": "c26c95ae25146fca3e3aec11a703919a001de607", + "sha256": "21df08fed7f13dcf6bee488f2103cbee44da157a3fa581e2d76a47edb090348f", + "bytes": 739556, + "entries": 1445, + "aliases": [ + "guild_lobby" + ] + }, + "arrakis": { + "name": "Arrakduin", + "filename": "DuneRealms-Materials-arrakis-v2.zip", + "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v2.zip", + "sha1": "b00859f576801967c0c6478fd4fb562820772f49", + "sha256": "350014780c1c0b83e0713cc308e5227a43345169a7c1128a235dc1065583672d", + "bytes": 740437, + "entries": 1447, + "aliases": [ + "arrakis", + "arrakduin" + ] + }, + "caladan": { + "name": "Kaladam", + "filename": "DuneRealms-Materials-caladan-v2.zip", + "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-caladan-v2.zip", + "sha1": "3f5b1674dfeb5761a9253ae411463a3e7a2e6b32", + "sha256": "729102252e911d2b8a242e083b128e4d1fe0d5d5a8333e2fe3be3de16794242a", + "bytes": 740635, + "entries": 1447, + "aliases": [ + "caladan", + "kaladam" + ] + }, + "giedi_prime": { + "name": "Giedermark", + "filename": "DuneRealms-Materials-giedi_prime-v2.zip", + "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-giedi_prime-v2.zip", + "sha1": "f7c734ee98086e5b96cd566599640c6514377f81", + "sha256": "4b7a1dae736dbd924bb2e7b3009b8e07bff6b73a136d5aafb410529eae71cd74", + "bytes": 740528, + "entries": 1448, + "aliases": [ + "giedi_prime", + "giedermark" + ] + }, + "kaitain": { + "name": "Kaiterhof", + "filename": "DuneRealms-Materials-kaitain-v2.zip", + "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-kaitain-v2.zip", + "sha1": "b06c9dc895c99aae2ccaaddfac0ffcba4ba6a534", + "sha256": "d9a8c34cb3750593d4273160e69ef83649c62a42abc182370cbed22d4b535866", + "bytes": 740513, + "entries": 1447, + "aliases": [ + "kaitain", + "kaiterhof" + ] + }, + "sigma_draconis_iv": { + "name": "Sigmadraken IV", + "filename": "DuneRealms-Materials-sigma_draconis_iv-v2.zip", + "url": "https://www.dunerealms.com/downloads/DuneRealms-Materials-sigma_draconis_iv-v2.zip", + "sha1": "ede1901098d763738d713e5a71508c9b53680989", + "sha256": "b32ac3cf3fc668c065067df7a2d8d23785efe1a20c55d96cd4f8acae20c013ae", + "bytes": 740935, + "entries": 1448, + "aliases": [ + "sigma_draconis_iv", + "sigmadraken_iv", + "sigmadraken iv" + ] + } + } +} diff --git a/DuneRealmsGUI/planet-artwork/release-v2/planet-textures.yml b/DuneRealmsGUI/planet-artwork/release-v2/planet-textures.yml new file mode 100644 index 00000000..260b209d --- /dev/null +++ b/DuneRealmsGUI/planet-artwork/release-v2/planet-textures.yml @@ -0,0 +1,38 @@ +# Enable after publishing every pinned ZIP from planet-artwork/release-v1/. +# Java material layer only. Geyser/Bedrock requires its own converted pack. +enabled: false + +# Optional exact world-name mappings, e.g. world: arrakis +worlds: {} + +packs: + guild: + name: "Vaerkring" + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-guild-v2.zip + sha1: c26c95ae25146fca3e3aec11a703919a001de607 + worlds: ["guild_lobby"] + arrakis: + name: "Arrakduin" + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v2.zip + sha1: b00859f576801967c0c6478fd4fb562820772f49 + worlds: ["arrakis","arrakduin"] + caladan: + name: "Kaladam" + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-caladan-v2.zip + sha1: 3f5b1674dfeb5761a9253ae411463a3e7a2e6b32 + worlds: ["caladan","kaladam"] + giedi_prime: + name: "Giedermark" + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-giedi_prime-v2.zip + sha1: f7c734ee98086e5b96cd566599640c6514377f81 + worlds: ["giedi_prime","giedermark"] + kaitain: + name: "Kaiterhof" + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-kaitain-v2.zip + sha1: b06c9dc895c99aae2ccaaddfac0ffcba4ba6a534 + worlds: ["kaitain","kaiterhof"] + sigma_draconis_iv: + name: "Sigmadraken IV" + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-sigma_draconis_iv-v2.zip + sha1: ede1901098d763738d713e5a71508c9b53680989 + worlds: ["sigma_draconis_iv","sigmadraken_iv","sigmadraken iv"] diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/DuneGUI.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/DuneGUI.java index fb12f458..247739ab 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/DuneGUI.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/DuneGUI.java @@ -253,7 +253,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto } @EventHandler public void drag(InventoryDragEvent e){if(e.getView().getTopInventory().getHolder() instanceof Screen)e.setCancelled(true);} @EventHandler public void close(InventoryCloseEvent e){if(e.getInventory().getHolder() instanceof Screen s)s.gate.expire();} - @EventHandler public void quit(PlayerQuitEvent e){guiPackLoaded.remove(e.getPlayer().getUniqueId());bookings.cancel(e.getPlayer().getUniqueId());boarding.remove(e.getPlayer().getUniqueId());requests.remove(e.getPlayer().getUniqueId());records.remove(e.getPlayer().getUniqueId());sidebar.hide(e.getPlayer());departure.removePlayer(e.getPlayer());} + @EventHandler public void quit(PlayerQuitEvent e){MCGUIMenus.forget(e.getPlayer().getUniqueId());guiPackLoaded.remove(e.getPlayer().getUniqueId());bookings.cancel(e.getPlayer().getUniqueId());boarding.remove(e.getPlayer().getUniqueId());requests.remove(e.getPlayer().getUniqueId());records.remove(e.getPlayer().getUniqueId());sidebar.hide(e.getPlayer());departure.removePlayer(e.getPlayer());} private void ensureRegistrar(){World world=Bukkit.getWorld("guild_lobby");if(world==null)return;Location at=world.getSpawnLocation().clone().add(2,0,0);at.getChunk().load(); for(Entity entity:world.getEntities())if(entity.getPersistentDataContainer().has(registrar,PersistentDataType.BYTE))return; Villager npc=world.spawn(at,Villager.class);npc.setAI(false);npc.setInvulnerable(true);npc.setPersistent(true);npc.setSilent(true);npc.setCollidable(false);npc.setProfession(Villager.Profession.LIBRARIAN);npc.customName(Component.text("House Registrar · Choose your House",NamedTextColor.GOLD));npc.setCustomNameVisible(true);npc.getPersistentDataContainer().set(registrar,PersistentDataType.BYTE,(byte)1); diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MCGUIMenus.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MCGUIMenus.java index fb567d4a..f610165b 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MCGUIMenus.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/MCGUIMenus.java @@ -16,6 +16,7 @@ final class MCGUIMenus implements AutoCloseable { private static MCGUIMenus active; private final JavaPlugin plugin; private final Map sessions=new HashMap<>(); + private final Set closeHints=new HashSet<>(); private final ExecutorService drawings=Executors.newSingleThreadExecutor(r->{Thread t=new Thread(r,"DuneRealms-menu-render");t.setDaemon(true);return t;}); private Plugin engine;private Object framework,loader,none;private Class contentType,optionsType;private Object defaultOptions; private Method makeCanvas,openView,hasPack,pageOf,render,draw,hoverState; @@ -47,6 +48,7 @@ final class MCGUIMenus implements AutoCloseable { static boolean show(Player p,String title,String description,Inventory inventory,Map actions,GuiSession gate){ return active!=null&&active.present(p,title,description,inventory,actions,gate); } + static void forget(UUID player){if(active!=null)active.closeHints.remove(player);} static void offerPack(Player p){if(active!=null&&!BedrockForms.isBedrock(p))active.sendPack(p);} private void sendPack(Player p){if(!p.getWorld().getName().equals("guild_lobby"))return;p.addResourcePack(packId,packUrl,packHash,"DuneRealms interactive menus",true);} private boolean present(Player p,String title,String description,Inventory inventory,Map actions,GuiSession suppliedGate){ @@ -81,7 +83,7 @@ final class MCGUIMenus implements AutoCloseable { String html=MenuDocument.html(title,description,player.getName(),cards,selected,base.getParent());Object page=pageOf.invoke(null,html,base,loader); Object paintState=none;Object document=page.getClass().getField("document").get(page);String selector=expected<=-100?"[data-pick=\""+(-100-expected)+"\"]":"[data-slot=\""+expected+"\"]";Object element=document.getClass().getMethod("selectFirst",String.class).invoke(document,selector);if(element!=null)paintState=hoverState.invoke(null,element,null);Object next=render.invoke(null,page,1536,896,1.5,offset,paintState); if(!alive)return;draw.invoke(canvas,next.getClass().getMethod("image").invoke(next),0,0);frame=next; - Bukkit.getScheduler().runTask(plugin,()->{if(!current())return;if(view==null)try{Object proxy=Proxy.newProxyInstance(contentType.getClassLoader(),new Class[]{contentType},this);view=openView.invoke(framework,player,proxy,defaultOptions);}catch(Exception e){finish();sessions.remove(player.getUniqueId());player.sendMessage("The menu could not open. Load the menu pack and reopen your Codex.");plugin.getLogger().warning("MC GUI view failed: "+e.getClass().getSimpleName());}}); + Bukkit.getScheduler().runTask(plugin,()->{if(!current())return;if(view==null)try{Object proxy=Proxy.newProxyInstance(contentType.getClassLoader(),new Class[]{contentType},this);view=openView.invoke(framework,player,proxy,defaultOptions);if(closeHints.add(player.getUniqueId()))player.sendMessage("Press Shift to close this menu.");}catch(Exception e){finish();sessions.remove(player.getUniqueId());player.sendMessage("The menu could not open. Load the menu pack and reopen your Codex.");plugin.getLogger().warning("MC GUI view failed: "+e.getClass().getSimpleName());}}); }catch(Exception|LinkageError e){if(alive){plugin.getLogger().log(java.util.logging.Level.WARNING,"MC GUI render failed",e);Bukkit.getScheduler().runTask(plugin,()->{if(current()){finish();sessions.remove(player.getUniqueId(),this);player.sendMessage("The new menu could not be drawn. Please retry /menu.");}});}} finally{queued.set(false);if(alive&&(expected!=hovered||selected!=picked||offset!=scroll))schedule();} });} diff --git a/DuneRealmsGUI/src/main/resources/planet-textures.yml b/DuneRealmsGUI/src/main/resources/planet-textures.yml index 012f2992..260b209d 100644 --- a/DuneRealmsGUI/src/main/resources/planet-textures.yml +++ b/DuneRealmsGUI/src/main/resources/planet-textures.yml @@ -8,31 +8,31 @@ worlds: {} packs: guild: name: "Vaerkring" - url: https://www.dunerealms.com/downloads/DuneRealms-Materials-guild-v1.zip - sha1: 958b0bc07e49c33427d262a2621b1b154f9c9fa5 + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-guild-v2.zip + sha1: c26c95ae25146fca3e3aec11a703919a001de607 worlds: ["guild_lobby"] arrakis: name: "Arrakduin" - url: https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v1.zip - sha1: c85b84125bad0e913f795b4aeb8364a7caab8d8d + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v2.zip + sha1: b00859f576801967c0c6478fd4fb562820772f49 worlds: ["arrakis","arrakduin"] caladan: name: "Kaladam" - url: https://www.dunerealms.com/downloads/DuneRealms-Materials-caladan-v1.zip - sha1: b21aafb4263c2f499540c28f382d1c8984786313 + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-caladan-v2.zip + sha1: 3f5b1674dfeb5761a9253ae411463a3e7a2e6b32 worlds: ["caladan","kaladam"] giedi_prime: name: "Giedermark" - url: https://www.dunerealms.com/downloads/DuneRealms-Materials-giedi_prime-v1.zip - sha1: 5e0b691fda32ad0f8f3bc00bd477cdc5c538cdef + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-giedi_prime-v2.zip + sha1: f7c734ee98086e5b96cd566599640c6514377f81 worlds: ["giedi_prime","giedermark"] kaitain: name: "Kaiterhof" - url: https://www.dunerealms.com/downloads/DuneRealms-Materials-kaitain-v1.zip - sha1: 95f77e0e32c8e9920d45b6dff0115a45b0198cb1 + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-kaitain-v2.zip + sha1: b06c9dc895c99aae2ccaaddfac0ffcba4ba6a534 worlds: ["kaitain","kaiterhof"] sigma_draconis_iv: name: "Sigmadraken IV" - url: https://www.dunerealms.com/downloads/DuneRealms-Materials-sigma_draconis_iv-v1.zip - sha1: 2631a5dee656d5f12f936b2e5dea665137817b84 + url: https://www.dunerealms.com/downloads/DuneRealms-Materials-sigma_draconis_iv-v2.zip + sha1: ede1901098d763738d713e5a71508c9b53680989 worlds: ["sigma_draconis_iv","sigmadraken_iv","sigmadraken iv"] diff --git a/DuneRealmsGUI/src/main/resources/plugin.yml b/DuneRealmsGUI/src/main/resources/plugin.yml index 7e264508..22f39a31 100644 --- a/DuneRealmsGUI/src/main/resources/plugin.yml +++ b/DuneRealmsGUI/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: DunerealmsGUI main: com.dunerealms.gui.DuneGUI -version: 1.1.26 +version: 1.1.27 api-version: '1.21.8' depend: [JarvisTranslator] softdepend: [MCGUI, DecentHolograms, DuneLobby, DuneCore, DuneEss, DuneNPC, Vault, floodgate, ViaVersion] diff --git a/tools/build-network-artwork-pack.py b/tools/build-network-artwork-pack.py index 197b78c7..07f6feda 100644 --- a/tools/build-network-artwork-pack.py +++ b/tools/build-network-artwork-pack.py @@ -1,32 +1,39 @@ -"""Two lobby layers: this static artwork bundle plus native MC GUI's renderer pack. - -Only Arrakis' GOLD rabbit and SNOWY worm-pet carrier are retextured. Other -worlds' normal rabbits and wolves retain their vanilla appearance. -""" -import hashlib,json,pathlib,sys,zipfile - -def build(gui,items,creatures,output): - entries={} - for path in (gui,items): - with zipfile.ZipFile(path) as pack: - for name in pack.namelist(): - if name!='pack.mcmeta' and not name.endswith('/'): - assert not name.startswith('/') and '..' not in pathlib.PurePosixPath(name).parts - entries[name]=pack.read(name) - with zipfile.ZipFile(gui) as pack:metadata=json.loads(pack.read('pack.mcmeta')) - metadata['pack'].update(pack_format=64,supported_formats=[64,97],min_format=64,max_format=97,description='DuneRealms network artwork · Spacing Guild lobby') - entries['pack.mcmeta']=json.dumps(metadata).encode() - with zipfile.ZipFile(creatures) as pack: - for name in ( - 'entity/rabbit/gold.png','entity/rabbit/rabbit_gold.png','entity/rabbit/rabbit_gold_baby.png', - 'entity/wolf/wolf_snowy.png','entity/wolf/wolf_snowy_tame.png','entity/wolf/wolf_snowy_angry.png', - 'entity/camel/camel.png','entity/camel/camel_baby.png'): - key='assets/minecraft/textures/'+name;entries[key]=pack.read(key) - output.parent.mkdir(parents=True,exist_ok=True) - with zipfile.ZipFile(output,'w',zipfile.ZIP_DEFLATED) as pack: - for key,data in sorted(entries.items()): - info=zipfile.ZipInfo(key,(2026,11,23,0,0,0));info.compress_type=zipfile.ZIP_DEFLATED;pack.writestr(info,data) - data=output.read_bytes() - return {'sha1':hashlib.sha1(data).hexdigest(),'sha256':hashlib.sha256(data).hexdigest(),'bytes':len(data),'entries':len(entries)} - -if __name__=='__main__':print(json.dumps(build(*(pathlib.Path(p) for p in sys.argv[1:])))) +"""Two lobby layers: this static artwork bundle plus native MC GUI's renderer pack. + +Only Arrakis' GOLD rabbit and SNOWY worm-pet carrier are retextured. Other +worlds' normal rabbits and wolves retain their vanilla appearance. +""" +import hashlib,json,pathlib,sys,zipfile + +def build(gui,items,creatures,output,sand=None): + entries={} + for path in (gui,items): + with zipfile.ZipFile(path) as pack: + for name in pack.namelist(): + if name!='pack.mcmeta' and not name.endswith('/'): + assert not name.startswith('/') and '..' not in pathlib.PurePosixPath(name).parts + entries[name]=pack.read(name) + with zipfile.ZipFile(gui) as pack:metadata=json.loads(pack.read('pack.mcmeta')) + metadata['pack'].update(pack_format=64,supported_formats=[64,97],min_format=64,max_format=97,description='DuneRealms network artwork · Spacing Guild lobby') + entries['pack.mcmeta']=json.dumps(metadata).encode() + with zipfile.ZipFile(creatures) as pack: + for name in ( + 'entity/rabbit/gold.png','entity/rabbit/rabbit_gold.png','entity/rabbit/rabbit_gold_baby.png', + 'entity/wolf/wolf_snowy.png','entity/wolf/wolf_snowy_tame.png','entity/wolf/wolf_snowy_angry.png', + 'entity/camel/camel.png','entity/camel/camel_baby.png'): + key='assets/minecraft/textures/'+name;entries[key]=pack.read(key) + if sand is not None: + names=('sand','red_sand','suspicious_sand_0','suspicious_sand_1','suspicious_sand_2','suspicious_sand_3') + with zipfile.ZipFile(sand) as pack: + for name in names: + for suffix in ('','_n','_s'): + key='assets/minecraft/textures/block/'+name+suffix+'.png';entries[key]=pack.read(key) + for key in ('LICENSE-Sand-Luanti.txt','CREDITS-Sand.txt'):entries[key]=pack.read(key) + output.parent.mkdir(parents=True,exist_ok=True) + with zipfile.ZipFile(output,'w',zipfile.ZIP_DEFLATED) as pack: + for key,data in sorted(entries.items()): + info=zipfile.ZipInfo(key,(2026,11,23,0,0,0));info.compress_type=zipfile.ZIP_DEFLATED;pack.writestr(info,data) + data=output.read_bytes() + return {'sha1':hashlib.sha1(data).hexdigest(),'sha256':hashlib.sha256(data).hexdigest(),'bytes':len(data),'entries':len(entries)} + +if __name__=='__main__':print(json.dumps(build(*(pathlib.Path(p) for p in sys.argv[1:])))) diff --git a/tools/build-planet-texture-packs.mjs b/tools/build-planet-texture-packs.mjs index d19b4bea..65640d14 100644 --- a/tools/build-planet-texture-packs.mjs +++ b/tools/build-planet-texture-packs.mjs @@ -4,6 +4,7 @@ import path from 'node:path'; import {fileURLToPath} from 'node:url'; import {createHash} from 'node:crypto'; import {deflateRawSync} from 'node:zlib'; +import {sandEntries} from './flat-sand.mjs'; const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'); const art=path.join(root,'DuneRealmsGUI/planet-artwork'); @@ -47,6 +48,9 @@ export function textureEntries(planet){ entries.set(key,fs.readFileSync(src));entries.delete(key+'.mcmeta'); if(fs.existsSync(src+'.mcmeta'))entries.set(key+'.mcmeta',fs.readFileSync(src+'.mcmeta')); } + for(const [name,bytes] of sandEntries(planet)){entries.set(name,bytes);entries.delete(name+'.mcmeta');} + entries.set('LICENSE-Sand-Luanti.txt',fs.readFileSync(path.join(art,'flat-sand/LICENSE.txt'))); + entries.set('CREDITS-Sand.txt',fs.readFileSync(path.join(art,'flat-sand/CREDITS.txt'))); entries.set('pack.mcmeta',Buffer.from(JSON.stringify({pack:{pack_format:64,supported_formats:[64,97],min_format:64,max_format:97,description:'DuneRealms '+profile.name+' · '+profile.feel}}))); entries.set('LICENSE-Pixel-Perfection-CE.md',fs.readFileSync(path.join(source,'LICENSE.md'))); entries.set('CREDITS.txt',Buffer.from('Pixel Perfection CE by XSSheep and community contributors (Athemis, StonePendant, freejusticehere, Stingraych, Nova_Wostra, lazerl0rd).\nhttps://github.com/Athemis/PixelPerfectionCE\nSource commit: 28e38cab7c1f03f86364ef704f705bebcc13cb3d\nTextures and DuneRealms material remappings: CC-BY-SA-4.0. https://creativecommons.org/licenses/by-sa/4.0/\nDuneRealms changes: block/item-only extraction, modern pack metadata, named material remappings; original pixels preserved. No endorsement implied.\n')); @@ -54,9 +58,9 @@ export function textureEntries(planet){ } export function build(output){ - fs.mkdirSync(output,{recursive:true});const manifest={version:1,sourceCommit:'28e38cab7c1f03f86364ef704f705bebcc13cb3d',license:'CC-BY-SA-4.0',packId:'59f34b30-6a86-5e58-a813-6e776f726c64',packs:{}}; + fs.mkdirSync(output,{recursive:true});const manifest={version:2,sourceCommit:'28e38cab7c1f03f86364ef704f705bebcc13cb3d',license:'CC-BY-SA-4.0',packId:'59f34b30-6a86-5e58-a813-6e776f726c64',packs:{}}; for(const [planet,profile] of Object.entries(profiles)){ - const entries=textureEntries(planet),bytes=zip(entries),filename=`DuneRealms-Materials-${planet}-v1.zip`; + const entries=textureEntries(planet),bytes=zip(entries),filename=`DuneRealms-Materials-${planet}-v2.zip`; fs.writeFileSync(path.join(output,filename),bytes); manifest.packs[planet]={name:profile.name,filename,url:'https://www.dunerealms.com/downloads/'+filename,sha1:digest('sha1',bytes),sha256:digest('sha256',bytes),bytes:bytes.length,entries:entries.size,aliases:profile.aliases}; } diff --git a/tools/build-planet-texture-packs.test.mjs b/tools/build-planet-texture-packs.test.mjs index f4503c23..3eb5ce0b 100644 --- a/tools/build-planet-texture-packs.test.mjs +++ b/tools/build-planet-texture-packs.test.mjs @@ -6,6 +6,20 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import {build,profiles,textureEntries,protectedTextures} from './build-planet-texture-packs.mjs'; +import {sandPalettes} from './flat-sand.mjs'; + +function chunks(png,type){const found=[];for(let i=8;i{ + for(const planet of Object.keys(sandPalettes)){ + const entries=textureEntries(planet),get=n=>entries.get('assets/minecraft/textures/block/'+n+'.png'); + const sand=get('sand'),spice=get('suspicious_sand_0');assert.deepEqual(chunks(sand,'IDAT'),chunks(spice,'IDAT')); + const a=chunks(sand,'PLTE'),b=chunks(spice,'PLTE');for(let i=0;ix===0)); + } + } +}); function readZip(bytes){ const result=new Map();let offset=0; diff --git a/tools/flat-sand.mjs b/tools/flat-sand.mjs new file mode 100644 index 00000000..dd8bc6e6 --- /dev/null +++ b/tools/flat-sand.mjs @@ -0,0 +1,26 @@ +import fs from 'node:fs'; +import {fileURLToPath} from 'node:url'; + +const source=fs.readFileSync(fileURLToPath(new URL('../DuneRealmsGUI/planet-artwork/flat-sand/default_sand.png',import.meta.url))); +const table=Array.from({length:256},(_,n)=>{for(let i=0;i<8;i++)n=(n&1)?0xedb88320^(n>>>1):n>>>1;return n>>>0;}); +function crc(bytes){let n=0xffffffff;for(const b of bytes)n=table[(n^b)&255]^(n>>>8);return (n^0xffffffff)>>>0;} +// Palette-only build transform: preserve the source's exact grain and seamless tile. +export function palette(rgb,contrast=.3,darken=1){ + const out=Buffer.from(source);if(out[25]!==3)throw Error('Pinned indexed sand PNG required'); + for(let i=8;i