diff --git a/.forgejo/workflows/cooking-beta.yml b/.forgejo/workflows/cooking-beta.yml new file mode 100644 index 00000000..f94326ad --- /dev/null +++ b/.forgejo/workflows/cooking-beta.yml @@ -0,0 +1,85 @@ +name: Cooking and Baking Overlay +on: + workflow_dispatch: + push: + branches: ['feat/regional-cooking-beta-*'] + +jobs: + cooking-beta: + runs-on: dune-ci + steps: + - name: Check out exact revision + shell: bash + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + git init . + git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/plugins.git "$GITHUB_SHA" + git checkout --detach FETCH_HEAD + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + - uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: '9.2.1' + - name: Build and package scoped regional cooking donors + shell: bash + run: | + set -euo pipefail + gradle --no-daemon -p JarvisConnector test jar + gradle --no-daemon -p DuneRealmsGUI test jar + gradle --no-daemon -p DuneTerrain test jar + gradle --no-daemon -p DuneRealms-minecraft-only test jar + PYTHONPATH=tools python3 -m unittest discover -s tools -p test_cooking_beta_artwork.py + PYTHONPATH=tools python3 -m unittest discover -s tools -p test_cooking_bedrock.py + mkdir cooking-beta + PYTHONPATH=tools python3 - <<'PY' + import json + from pathlib import Path + from plugin_regional_cooking import ROLES, slice_donor + from plugin_wild_update import read_archive, write_archive + + out = Path("cooking-beta") + catalogue = Path("network/content-assets/cookbook/regional-cooking.json") + modules = { + "jarvis": "JarvisConnector/build/libs/jarvistranslator.jar", + "gui": "DuneRealmsGUI/build/libs/DunerealmsGUI.jar", + **dict.fromkeys(("arrakis", "giedi", "kaitain"), "DuneTerrain/build/libs/DuneRealms-Terrain.jar"), + "arrakis-core": "DuneRealms-minecraft-only/build/libs/DuneRealms-Core.jar", + } + for role in ROLES: + archive = read_archive(Path(modules[role]).read_bytes()) + payload = slice_donor(archive, role) + if role in ("jarvis", "gui") and payload["regional-cooking.json"] != catalogue.read_bytes(): + raise ValueError(f"{role} catalogue payload drift") + (out / f"{role}-donor.zip").write_bytes(write_archive(payload)) + core = read_archive(Path("DuneRealms-minecraft-only/build/libs/DuneRealms-Core.jar").read_bytes()) + (out / "HydrationProfiles.class").write_bytes(core["com/example/dunerealms/HydrationProfiles.class"]) + ei = Path("DuneRealmsGUI/executableitems/regional-cooking") + ids = {row["id"] for row in json.loads(catalogue.read_bytes())["items"]} + if {p.stem for p in ei.glob("*.yml")} != ids: + raise ValueError("EI item IDs must exactly match catalogue") + (out / "executable-items.zip").write_bytes(write_archive({"regional-cooking/" + p.name: p.read_bytes() for p in sorted(ei.glob("*.yml"))})) + art = Path("network/resource-pack/cooking-beta") + stone = Path("network/resource-pack/realistic-stone-family/assets/minecraft/textures/block/stone.png") + paths = [catalogue, stone, art / "artwork-manifest.json", *(p for p in (art / "overlay").rglob("*") if p.is_file())] + if len(paths) != 300: + raise ValueError("Incomplete artwork payload") + (out / "artwork-source.zip").write_bytes(write_archive({p.as_posix():p.read_bytes() for p in paths})) + biomes = Path("DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome") + names = ("badlands", "dripstone_caves", "eroded_badlands", "pale_garden", "stony_peaks", "windswept_gravelly_hills", "wooded_badlands") + (out / "giedi-biomes-donor.zip").write_bytes(write_archive({ + "data/minecraft/worldgen/biome/" + name + ".json": (biomes / (name + ".json")).read_bytes() for name in names + })) + PY + PYTHONPATH=tools python3 tools/build_cooking_bedrock.py . cooking-beta + cp tools/{RegionalCookingMerge.java,plugin_regional_cooking.py,plugin_golden_path.py,plugin_wild_update.py,HydrationMerge.java,plugin_hydration.py,cooking_beta_artwork.py,build_cooking_bedrock.py} cooking-beta/ + echo "$GITHUB_SHA" > cooking-beta/SOURCE_COMMIT + (cd cooking-beta && sha256sum -- *.zip *.py *.java *.class *.mcpack *.json SOURCE_COMMIT > SHA256SUMS) + - uses: actions/upload-artifact@v3 + with: + name: DuneRealms-Cooking-Beta + path: cooking-beta + if-no-files-found: error diff --git a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/DuneCore.java b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/DuneCore.java index d94da43b..f9a73e38 100644 --- a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/DuneCore.java +++ b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/DuneCore.java @@ -170,6 +170,7 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu Bukkit.getScheduler().runTaskTimer(this, this::spawnSandworms, 200L, 200L); Bukkit.getScheduler().runTaskTimer(this, this::spawnSpiceRaiders, 200L, 200L); getLogger().info("DuneCore enabled. Gameplay, faction travel, Arrakis threats, and spice raiders ready."); + HydrationProfiles.start(this); } @Override public void onDisable() { OrdosCold.close(this); @@ -182,6 +183,7 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu catch (Exception ex) { getLogger().severe("Shared shutdown save failed for " + p.getName() + ": " + ex.getMessage()); } sharedDatabase.close(); } else if (data != null && dataFile != null) savePlayers(); + HydrationProfiles.close(); } private void savePlayers() { if (sharedDatabase != null) { @@ -806,17 +808,72 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu World w = Bukkit.getWorld(planets[index]); if (w != null) e.setRespawnLocation(w.getSpawnLocation().clone()); } - @EventHandler public void onSpice(BlockBreakEvent e) { - Block block = e.getBlock(); - if (!block.getWorld().getName().equals("arrakis") || block.getType() != Material.SUSPICIOUS_SAND) return; - Player p = e.getPlayer(); - ItemStack held = p.getInventory().getItemInMainHand(); - if (held.getType() != Material.NETHERITE_SHOVEL || !is(held, "shovel")) { - e.setCancelled(true); - p.sendMessage(ChatColor.RED + "Only the Spice Harvest Shovel from /dune kit can mine a spice deposit."); + private static final Map pendingSpiceHarvests = new HashMap<>(); + + @EventHandler(priority=org.bukkit.event.EventPriority.HIGHEST,ignoreCancelled=true) + public void onSpice(BlockBreakEvent event) { + if (event.isCancelled()) return; + Block block=event.getBlock(); + if (!arrakisSpice(block) || event.getPlayer().getGameMode()==org.bukkit.GameMode.CREATIVE) return; + Player player=event.getPlayer(); + ItemStack shovel=player.getInventory().getItemInMainHand(); + if (!shovel.getType().name().endsWith("_SHOVEL") || !is(shovel,"shovel")) { + event.setCancelled(true); + player.sendMessage(ChatColor.RED + "Use a registered Spice Harvest Shovel to mine this deposit."); return; } - e.setDropItems(false); e.setExpToDrop(0); + event.setExpToDrop(0); + UUID id=player.getUniqueId(); + pendingSpiceHarvests.put(id,event); + Bukkit.getScheduler().runTask(this,()->pendingSpiceHarvests.remove(id,event)); + } + + private static boolean arrakisSpice(Block block) { + return block.getWorld().getName().equals("arrakis") && block.getType()==Material.SUSPICIOUS_SAND; + } + + @EventHandler(priority=org.bukkit.event.EventPriority.MONITOR) + public void resyncDeniedSpice(BlockBreakEvent event) { + if (!event.isCancelled() || !arrakisSpice(event.getBlock())) return; + Player player=event.getPlayer(); + Block block=event.getBlock(); + Bukkit.getScheduler().runTask(this,()->{ + if (player.isOnline() && player.getWorld()==block.getWorld() + && block.getWorld().isChunkLoaded(block.getX()>>4,block.getZ()>>4)) { + player.sendBlockChange(block.getLocation(),block.getBlockData()); + } + }); + } + + @EventHandler(priority=org.bukkit.event.EventPriority.MONITOR,ignoreCancelled=true) + public void finishSpiceHarvest(org.bukkit.event.block.BlockDropItemEvent event) { + if (event.isCancelled()) return; + Player player=event.getPlayer(); + BlockBreakEvent pending=pendingSpiceHarvests.get(player.getUniqueId()); + Block block=event.getBlock(); + Material now=block.getType(); + if (pending==null || pending.isCancelled() || !pending.getBlock().equals(block) + || event.getBlockState().getType()!=Material.SUSPICIOUS_SAND + || (now!=Material.AIR&&now!=Material.CAVE_AIR&&now!=Material.VOID_AIR)) return; + pendingSpiceHarvests.remove(player.getUniqueId(),pending); + harvestWithEvidence(pending,()->dropConfirmedSpice(block,player)); + } + + private void harvestWithEvidence(BlockBreakEvent pending,Runnable reward) { + var jarvis=Bukkit.getPluginManager().getPlugin("JarvisTranslator"); + if (jarvis==null || !jarvis.isEnabled()) { reward.run(); return; } + java.lang.reflect.Method observer; + try { + observer=jarvis.getClass().getMethod("withConfirmedSpiceHarvest",BlockBreakEvent.class,Runnable.class); + } catch(NoSuchMethodException absent) { reward.run(); return; } + try { + observer.invoke(jarvis,pending,reward); + } catch(ReflectiveOperationException problem) { + getLogger().warning("Confirmed spice harvest failed: "+problem.getClass().getSimpleName()); + } + } + + private void dropConfirmedSpice(Block block,Player p) { int amount = selected.getOrDefault(p.getUniqueId(), "").equals("Fremen") ? 2 : 1; serverJobs.harvest(p, amount); UUID sponsor = activeWorkers.get(p.getUniqueId()); @@ -841,19 +898,12 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu p.sendMessage(ChatColor.GOLD + "Job spice: +" + workerPay + " Solaris (15% share)."); // Contract spice is sold automatically, not dropped as a second payout. if (credited == amount) { - scheduleSpiceRespawn(block.getLocation()); return; } amount -= credited; } } block.getWorld().dropItemNaturally(block.getLocation(), spiceDrop(p, amount)); - scheduleSpiceRespawn(block.getLocation()); - } - private void scheduleSpiceRespawn(Location location) { - Location loc = location.clone(); - long delay = 20L * getConfig().getLong("spice-respawn-seconds", 120); - Bukkit.getScheduler().runTaskLater(this, () -> { if (loc.getChunk().isLoaded() && loc.getBlock().getType() == Material.AIR) loc.getBlock().setType(Material.SUSPICIOUS_SAND); }, delay); } private void migrateLegacyData() { File legacy = new File(getDataFolder().getParentFile(), "DuneRealms"); diff --git a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/HydrationProfiles.java b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/HydrationProfiles.java new file mode 100644 index 00000000..93a63fe2 --- /dev/null +++ b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/HydrationProfiles.java @@ -0,0 +1,100 @@ +package com.example.dunerealms; + +import java.lang.reflect.Field; +import java.sql.*; +import java.util.*; +import org.bukkit.*; +import org.bukkit.boss.*; +import org.bukkit.entity.Player; +import org.bukkit.event.*; +import org.bukkit.event.player.*; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.persistence.PersistentDataType; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionType; + +/** Hydration belongs to the existing lock-owned network profile, never local player data. */ +public final class HydrationProfiles implements Listener { + private static final Map values=new HashMap<>(); + private static final Set PLANETS=Set.of("arrakis","caladan","kaitain","giedi_prime","sigma_draconis_iv"); + private final JavaPlugin plugin; + private final SharedDatabase database; + private final Map bars=new HashMap<>(); + private static HydrationProfiles active; + private HydrationProfiles(JavaPlugin plugin,SharedDatabase database){this.plugin=plugin;this.database=database;} + + public static void initialize(SharedDatabase database)throws SQLException{ + try(Connection c=database.connect()){ + boolean exists; + try(PreparedStatement p=c.prepareStatement("SELECT * FROM dune_players WHERE 1=0");ResultSet r=p.executeQuery()){ + exists=false;ResultSetMetaData m=r.getMetaData();for(int i=1;i<=m.getColumnCount();i++)if(m.getColumnName(i).equalsIgnoreCase("hydration"))exists=true; + } + if(!exists)try(Statement s=c.createStatement()){s.executeUpdate("ALTER TABLE dune_players ADD COLUMN hydration DOUBLE PRECISION NOT NULL DEFAULT 100");} + catch(SQLException e){if(!"42S21".equals(e.getSQLState())&&!"42701".equals(e.getSQLState()))throw e;} + try(Statement s=c.createStatement();ResultSet r=s.executeQuery("SELECT hydration FROM dune_players WHERE 1=0")){r.getMetaData();} + } + } + public static void load(Player player,ResultSet row)throws SQLException{ + double amount=row.getDouble("hydration"); + if(row.wasNull()||!Double.isFinite(amount)||amount<0||amount>100)throw new SQLException("Invalid shared hydration profile"); + values.put(player.getUniqueId(),amount); + } + /** Called within the original single atomic profile UPDATE on its owning connection. */ + public static void bind(PreparedStatement query,Player player)throws SQLException{ + Double value=values.get(player.getUniqueId()); + if(value==null||!Double.isFinite(value)||value<0||value>100)throw new SQLException("Hydration profile was not loaded"); + query.setDouble(9,value); + if(query.getConnection().getMetaData().getDatabaseProductName().equalsIgnoreCase("PostgreSQL"))query.setObject(10,player.getUniqueId()); + else query.setString(10,player.getUniqueId().toString()); + } + public static void forget(Player player){values.remove(player.getUniqueId());if(active!=null)active.hide(player.getUniqueId());} + public static void start(JavaPlugin plugin){ + try{ + Object db=plugin.getClass().getMethod("sharedDatabase").invoke(plugin); + if(!(db instanceof SharedDatabase shared))return; + if(active!=null)throw new IllegalStateException("Hydration already started"); + active=new HydrationProfiles(plugin,shared); + Bukkit.getPluginManager().registerEvents(active,plugin); + Bukkit.getScheduler().runTaskTimer(plugin,active::tick,20L,20L); + plugin.getLogger().info("Shared thirst active; Arrakis 2/min, other planets 1/min; Lobby and Builder exempt"); + }catch(ReflectiveOperationException e){throw new IllegalStateException("Shared hydration API unavailable",e);} + } + public static void close(){if(active!=null){active.bars.values().forEach(BossBar::removeAll);active.bars.clear();active=null;}values.clear();} + static String realm(String name){for(String p:PLANETS)if(name.equals(p)||name.equals(p+"_nether")||name.equals(p+"_the_end"))return p;return "";} + static double decay(String realm){return realm.equals("arrakis")?2.0/60:1.0/60;} + private boolean eligible(Player player){ + if(!player.isOnline()||player.isDead()||!Set.of(GameMode.SURVIVAL,GameMode.ADVENTURE).contains(player.getGameMode())||realm(player.getWorld().getName()).isEmpty()||!database.isLoaded(player.getUniqueId())||!values.containsKey(player.getUniqueId()))return false; + try{ + Field field=SharedDatabase.class.getDeclaredField("builderLeases");field.setAccessible(true); + return field.get(database) instanceof Map leases&&!leases.containsKey(player.getUniqueId()); + }catch(NoSuchFieldException e){return true;}catch(ReflectiveOperationException e){return false;} + } + private void hide(UUID id){BossBar old=bars.remove(id);if(old!=null)old.removeAll();} + private void tick(){ + for(Player player:Bukkit.getOnlinePlayers()){ + UUID id=player.getUniqueId();if(!eligible(player)){hide(id);continue;} + double value=Math.max(0,values.get(id)-decay(realm(player.getWorld().getName())));values.put(id,value); + BossBar bar=bars.computeIfAbsent(id,key->{BossBar b=Bukkit.createBossBar("Thirst",BarColor.BLUE,BarStyle.SEGMENTED_10);b.addPlayer(player);return b;}); + bar.setProgress(value/100);bar.setTitle("Hydration "+(int)Math.ceil(value)+" / 100");bar.setColor(value<20?BarColor.RED:BarColor.BLUE); + } + } + private int restoration(ItemStack item){ + var jarvis=Bukkit.getPluginManager().getPlugin("JarvisTranslator"); + if(jarvis!=null&&jarvis.isEnabled())try{return Math.max(0,Math.min(100,(Integer)jarvis.getClass().getMethod("hydrationRestoration",ItemStack.class).invoke(jarvis,item)));} + catch(ReflectiveOperationException e){plugin.getLogger().warning("Drink hydration API unavailable");return 0;} + return 0; + } + static boolean plainWater(ItemStack item){ + if(item==null||item.getType()!=Material.POTION||!(item.getItemMeta() instanceof PotionMeta meta)||meta.getBasePotionType()!=PotionType.WATER||meta.hasCustomEffects())return false; + return !meta.getPersistentDataContainer().has(new NamespacedKey("executableitems","ei-id"),PersistentDataType.STRING) + &&!meta.getPersistentDataContainer().has(new NamespacedKey("dunerealms","item"),PersistentDataType.STRING); + } + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) public void consume(PlayerItemConsumeEvent event){ + Player player=event.getPlayer();if(!eligible(player))return; + ItemStack item=event.getItem();int amount=plainWater(item)?35:restoration(item); + if(amount<=0)return; + Bukkit.getScheduler().runTask(plugin,()->{if(!event.isCancelled()&&eligible(player))values.computeIfPresent(player.getUniqueId(),(id,v)->Math.min(100,v+amount));}); + } + @EventHandler public void quit(PlayerQuitEvent event){hide(event.getPlayer().getUniqueId());} +} diff --git a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/SharedDatabase.java b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/SharedDatabase.java index f253aab9..eaa855fa 100644 --- a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/SharedDatabase.java +++ b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/SharedDatabase.java @@ -49,6 +49,7 @@ public final class SharedDatabase implements AutoCloseable { s.executeUpdate("CREATE TABLE IF NOT EXISTS dune_bounties (target UUID PRIMARY KEY, world TEXT NOT NULL, reward INTEGER NOT NULL, claimed BOOLEAN NOT NULL DEFAULT FALSE, hunter UUID)"); c.commit(); } + HydrationProfiles.initialize(this); } public Connection connect() throws SQLException { @@ -90,12 +91,13 @@ public final class SharedDatabase implements AutoCloseable { Integer level, total, slot; Float progress; try (PreparedStatement q = c.prepareStatement( - "SELECT faction,inventory,experience_level,experience_progress,total_experience,held_slot,session_open FROM dune_players WHERE uuid=?")) { + "SELECT faction,inventory,experience_level,experience_progress,total_experience,held_slot,session_open,hydration FROM dune_players WHERE uuid=?")) { q.setObject(1, id); try (ResultSet r = q.executeQuery()) { if (!r.next()) throw new SQLException("Missing network profile"); if (r.getBoolean("session_open")) throw new SQLException("Unclean previous session; administrator recovery required"); + HydrationProfiles.load(p,r); faction = r.getString("faction"); String blob = r.getString("inventory"); if (blob != null && !blob.isBlank()) inventory = decode(blob); @@ -225,6 +227,7 @@ public final class SharedDatabase implements AutoCloseable { writePlayer(p, factions, true); } finally { forgetBuilderProfile(p); + HydrationProfiles.forget(p); Connection c = sessions.remove(p.getUniqueId()); if (c != null) c.close(); } @@ -236,7 +239,7 @@ public final class SharedDatabase implements AutoCloseable { // Never reconnect here: a replacement connection would not own the session lock. String inventory = encode(p.getInventory().getContents()); try (PreparedStatement q = c.prepareStatement( - "UPDATE dune_players SET faction=?,inventory=?,experience_level=?,experience_progress=?,total_experience=?,held_slot=?,session_open=?,inventory_view=?::jsonb,inventory_updated_at=CURRENT_TIMESTAMP WHERE uuid=?")) { + "UPDATE dune_players SET faction=?,inventory=?,experience_level=?,experience_progress=?,total_experience=?,held_slot=?,session_open=?,inventory_view=?::jsonb,inventory_updated_at=CURRENT_TIMESTAMP,hydration=? WHERE uuid=?")) { q.setString(1, factions.getOrDefault(p.getUniqueId(), "")); q.setString(2, inventory); q.setInt(3, p.getLevel()); @@ -246,6 +249,7 @@ public final class SharedDatabase implements AutoCloseable { q.setBoolean(7, !release); q.setString(8, InventoryWebSnapshot.capture(p)); q.setObject(9, p.getUniqueId()); + HydrationProfiles.bind(q,p); if (q.executeUpdate() != 1) throw new SQLException("Network profile disappeared during save"); } catch (SQLException ex) { try { diff --git a/DuneRealms-minecraft-only/src/test/java/com/example/dunerealms/ArrakisSpiceHarvestTest.java b/DuneRealms-minecraft-only/src/test/java/com/example/dunerealms/ArrakisSpiceHarvestTest.java new file mode 100644 index 00000000..11233181 --- /dev/null +++ b/DuneRealms-minecraft-only/src/test/java/com/example/dunerealms/ArrakisSpiceHarvestTest.java @@ -0,0 +1,89 @@ +package com.example.dunerealms; + +import java.util.UUID; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.entity.Player; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDropItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.scheduler.BukkitScheduler; +import org.junit.jupiter.api.Test; + +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; + +class ArrakisSpiceHarvestTest { + public interface Evidence extends Plugin { + void withConfirmedSpiceHarvest(BlockBreakEvent original,Runnable reward); + } + + @Test void onlyOneConfirmedRemovalEntersRewardAndQuestScope() throws Exception { + var core=mock(DuneCore.class,CALLS_REAL_METHODS); + var key=new NamespacedKey("dunerealms","item"); + var field=DuneCore.class.getDeclaredField("itemKey"); + field.setAccessible(true); + field.set(core,key); + + var world=mock(World.class); + when(world.getName()).thenReturn("arrakis"); + var block=mock(Block.class); + when(block.getWorld()).thenReturn(world); + when(block.getType()).thenReturn(Material.SUSPICIOUS_SAND); + var oldState=mock(BlockState.class); + when(oldState.getType()).thenReturn(Material.SUSPICIOUS_SAND); + var player=mock(Player.class); + when(player.getUniqueId()).thenReturn(UUID.randomUUID()); + when(player.getGameMode()).thenReturn(GameMode.SURVIVAL); + var inventory=mock(PlayerInventory.class); + when(player.getInventory()).thenReturn(inventory); + var shovel=mock(ItemStack.class); + when(inventory.getItemInMainHand()).thenReturn(shovel); + when(shovel.getType()).thenReturn(Material.IRON_SHOVEL); + when(shovel.hasItemMeta()).thenReturn(true); + var meta=mock(ItemMeta.class); + when(shovel.getItemMeta()).thenReturn(meta); + var data=mock(PersistentDataContainer.class); + when(meta.getPersistentDataContainer()).thenReturn(data); + when(data.get(key,PersistentDataType.STRING)).thenReturn("shovel"); + var scheduler=mock(BukkitScheduler.class); + var pluginManager=mock(PluginManager.class); + var evidence=mock(Evidence.class); + when(evidence.isEnabled()).thenReturn(true); + when(pluginManager.getPlugin("JarvisTranslator")).thenReturn(evidence); + + try(var bukkit=mockStatic(Bukkit.class)){ + bukkit.when(Bukkit::getScheduler).thenReturn(scheduler); + bukkit.when(Bukkit::getPluginManager).thenReturn(pluginManager); + var original=new BlockBreakEvent(block,player); + var dropped=new BlockDropItemEvent(block,oldState,player,new java.util.ArrayList<>()); + original.setCancelled(true); + core.onSpice(original); + when(block.getType()).thenReturn(Material.AIR); + core.finishSpiceHarvest(dropped); + verifyNoInteractions(evidence); + + original.setCancelled(false); + when(block.getType()).thenReturn(Material.SUSPICIOUS_SAND); + core.onSpice(original); + core.finishSpiceHarvest(dropped); + when(block.getType()).thenReturn(Material.AIR); + dropped.setCancelled(true); + core.finishSpiceHarvest(dropped); + verifyNoInteractions(evidence); + + dropped.setCancelled(false); + core.finishSpiceHarvest(dropped); + core.finishSpiceHarvest(dropped); + verify(evidence,times(1)).withConfirmedSpiceHarvest(eq(original),any()); + verify(scheduler,never()).runTaskLater(any(Plugin.class),any(Runnable.class),anyLong()); + } + } +} \ No newline at end of file diff --git a/DuneRealms-minecraft-only/src/test/java/com/example/dunerealms/SharedDatabaseTest.java b/DuneRealms-minecraft-only/src/test/java/com/example/dunerealms/SharedDatabaseTest.java index 7dde71e5..de6d4459 100644 --- a/DuneRealms-minecraft-only/src/test/java/com/example/dunerealms/SharedDatabaseTest.java +++ b/DuneRealms-minecraft-only/src/test/java/com/example/dunerealms/SharedDatabaseTest.java @@ -31,10 +31,23 @@ class SharedDatabaseTest { @BeforeEach void prepare() throws Exception { Connection schema = mock(Connection.class); when(schema.createStatement()).thenReturn(mock(Statement.class)); + PreparedStatement hydrationSchema=mock(PreparedStatement.class); + ResultSet hydrationColumns=mock(ResultSet.class); + ResultSetMetaData hydrationMeta=mock(ResultSetMetaData.class); + when(schema.prepareStatement(anyString())).thenReturn(hydrationSchema); + when(hydrationSchema.executeQuery()).thenReturn(hydrationColumns); + when(hydrationColumns.getMetaData()).thenReturn(hydrationMeta); + when(hydrationMeta.getColumnCount()).thenReturn(1); + when(hydrationMeta.getColumnName(1)).thenReturn("hydration"); + when(schema.createStatement().executeQuery(anyString())).thenReturn(hydrationColumns); owner = mock(Connection.class); + DatabaseMetaData ownerMeta=mock(DatabaseMetaData.class); + when(ownerMeta.getDatabaseProductName()).thenReturn("PostgreSQL"); + when(owner.getMetaData()).thenReturn(ownerMeta); lock = mock(PreparedStatement.class); row = mock(PreparedStatement.class); update = mock(PreparedStatement.class); + when(update.getConnection()).thenReturn(owner); lockResult = mock(ResultSet.class); profile = mock(ResultSet.class); when(owner.prepareStatement(anyString())).thenAnswer(call -> { @@ -49,10 +62,11 @@ class SharedDatabaseTest { when(row.executeQuery()).thenReturn(profile); when(profile.next()).thenReturn(true); when(profile.getString("faction")).thenReturn("fremen"); + when(profile.getDouble("hydration")).thenReturn(100.0); when(update.executeUpdate()).thenReturn(1); driver = mock(Driver.class); when(driver.acceptsURL("jdbc:dune-test:profiles")).thenReturn(true); - when(driver.connect(eq("jdbc:dune-test:profiles"), any())).thenReturn(schema, owner); + when(driver.connect(eq("jdbc:dune-test:profiles"), any())).thenReturn(schema, schema, owner); DriverManager.registerDriver(driver); JavaPlugin plugin = mock(JavaPlugin.class); YamlConfiguration config = new YamlConfiguration(); @@ -76,9 +90,27 @@ class SharedDatabaseTest { @AfterEach void cleanup() throws Exception { db.close(); + HydrationProfiles.close(); DriverManager.deregisterDriver(driver); } + @Test void hydrationIsLoadedAndSavedInsideTheOriginalOwnedAtomicCheckpoint() throws Exception { + when(profile.getDouble("hydration")).thenReturn(37.25); + db.loadPlayer(player,factions); + db.savePlayer(player,factions); + verify(update).setDouble(9,37.25); + verify(update).setObject(10,id); + verify(owner).prepareStatement(contains("hydration=? WHERE uuid=?")); + verify(driver,times(3)).connect(eq("jdbc:dune-test:profiles"),any()); + } + + @Test void invalidHydrationRefusesProfileBeforeOpeningOrApplyingInventory() throws Exception { + when(profile.getDouble("hydration")).thenReturn(Double.NaN); + assertThrows(SQLException.class,()->db.loadPlayer(player,factions)); + verify(owner,never()).prepareStatement("UPDATE dune_players SET session_open=TRUE WHERE uuid=?"); + verify(inventory,never()).setContents(any()); + } + @Test void builderCheckpointRejectsCreativeWritesAndRestoresCommittedInventory() throws Exception { db.loadPlayer(player, factions); when(owner.getAutoCommit()).thenReturn(true); @@ -160,13 +192,13 @@ class SharedDatabaseTest { verify(update).setBoolean(7, false); verify(owner).close(); assertFalse(db.isLoaded(id)); - verify(driver, times(2)).connect(anyString(), any()); // Schema + one owned connection only. + verify(driver, times(3)).connect(anyString(), any()); // Schema + hydration schema + one owned connection only. } @Test void duplicateLoadOnSameBackendCannotOverwriteSession() throws Exception { db.loadPlayer(player, factions); assertThrows(SQLException.class, () -> db.loadPlayer(player, factions)); - verify(driver, times(2)).connect(anyString(), any()); + verify(driver, times(3)).connect(anyString(), any()); verify(owner, never()).close(); } diff --git a/DuneRealmsGUI/build.gradle.kts b/DuneRealmsGUI/build.gradle.kts index 0cdbef67..63f78aea 100644 --- a/DuneRealmsGUI/build.gradle.kts +++ b/DuneRealmsGUI/build.gradle.kts @@ -18,6 +18,7 @@ tasks.jar { archiveFileName.set("DunerealmsGUI.jar") } sourceSets.main { java.srcDirs("../citizens-common/src/main/java", "../pack-session-common/src/main/java") } tasks.processResources { from(rootProject.file("../network/content-assets/cookbook/spice-crafting.json")) + from(rootProject.file("../network/content-assets/cookbook/regional-cooking.json")) } val mcguiRuntime = providers.gradleProperty("mcguiRuntime") diff --git a/DuneRealmsGUI/executableitems/regional-cooking/bacon.yml b/DuneRealmsGUI/executableitems/regional-cooking/bacon.yml new file mode 100644 index 00000000..7ea48e88 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/bacon.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBacon", + "material": "COOKED_PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/bacon" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/baguette.yml b/DuneRealmsGUI/executableitems/regional-cooking/baguette.yml new file mode 100644 index 00000000..5a4cefec --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/baguette.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBaguette", + "material": "BREAD", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/baguette" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/baking_dough.yml b/DuneRealmsGUI/executableitems/regional-cooking/baking_dough.yml new file mode 100644 index 00000000..00c829c5 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/baking_dough.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBaking Dough", + "material": "CLAY_BALL", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/baking_dough" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/beef_burger.yml b/DuneRealmsGUI/executableitems/regional-cooking/beef_burger.yml new file mode 100644 index 00000000..4d2d1d8d --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/beef_burger.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBeef Burger", + "material": "COOKED_BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/beef_burger" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/beef_mince.yml b/DuneRealmsGUI/executableitems/regional-cooking/beef_mince.yml new file mode 100644 index 00000000..67b6cc1b --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/beef_mince.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBeef Mince", + "material": "BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/beef_mince" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/beef_stock.yml b/DuneRealmsGUI/executableitems/regional-cooking/beef_stock.yml new file mode 100644 index 00000000..b21b02ae --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/beef_stock.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBeef Stock", + "material": "MUSHROOM_STEW", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/beef_stock" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/berry_cordial.yml b/DuneRealmsGUI/executableitems/regional-cooking/berry_cordial.yml new file mode 100644 index 00000000..53e24ab4 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/berry_cordial.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBerry Cordial", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/berry_cordial" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/berry_tart.yml b/DuneRealmsGUI/executableitems/regional-cooking/berry_tart.yml new file mode 100644 index 00000000..3c8531c5 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/berry_tart.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBerry Tart", + "material": "PUMPKIN_PIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/berry_tart" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/berry_tart_mix.yml b/DuneRealmsGUI/executableitems/regional-cooking/berry_tart_mix.yml new file mode 100644 index 00000000..29554828 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/berry_tart_mix.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBerry Tart Mix", + "material": "CLAY_BALL", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/berry_tart_mix" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/berry_tea.yml b/DuneRealmsGUI/executableitems/regional-cooking/berry_tea.yml new file mode 100644 index 00000000..ddba2e28 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/berry_tea.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBerry Tea", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/berry_tea" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/brown_mushroom_broth.yml b/DuneRealmsGUI/executableitems/regional-cooking/brown_mushroom_broth.yml new file mode 100644 index 00000000..4e99779a --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/brown_mushroom_broth.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBrown Mushroom Broth", + "material": "MUSHROOM_STEW", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/brown_mushroom_broth" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/burger_bun.yml b/DuneRealmsGUI/executableitems/regional-cooking/burger_bun.yml new file mode 100644 index 00000000..9b62fe43 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/burger_bun.yml @@ -0,0 +1,27 @@ +{ + "name": "&fBurger Bun", + "material": "BREAD", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/burger_bun" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/butter.yml b/DuneRealmsGUI/executableitems/regional-cooking/butter.yml new file mode 100644 index 00000000..b249abf9 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/butter.yml @@ -0,0 +1,27 @@ +{ + "name": "&fButter", + "material": "HONEYCOMB", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/butter" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/butter_croissant.yml b/DuneRealmsGUI/executableitems/regional-cooking/butter_croissant.yml new file mode 100644 index 00000000..6a916ac8 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/butter_croissant.yml @@ -0,0 +1,27 @@ +{ + "name": "&fButter Croissant", + "material": "BREAD", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/butter_croissant" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/caladan_berry_wine.yml b/DuneRealmsGUI/executableitems/regional-cooking/caladan_berry_wine.yml new file mode 100644 index 00000000..545e0861 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/caladan_berry_wine.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCaladan Berry Wine", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/caladan_berry_wine" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/caladan_garden_salad.yml b/DuneRealmsGUI/executableitems/regional-cooking/caladan_garden_salad.yml new file mode 100644 index 00000000..42bf7d9f --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/caladan_garden_salad.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCaladan Garden Salad", + "material": "MUSHROOM_STEW", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/caladan_garden_salad" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/caramel_praline.yml b/DuneRealmsGUI/executableitems/regional-cooking/caramel_praline.yml new file mode 100644 index 00000000..3bd89421 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/caramel_praline.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSea-salt Caramel Praline", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/caramel_praline" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/carrot_cake.yml b/DuneRealmsGUI/executableitems/regional-cooking/carrot_cake.yml new file mode 100644 index 00000000..ddc3f41e --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/carrot_cake.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCarrot Cake", + "material": "PUMPKIN_PIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/carrot_cake" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/carrot_cake_mix.yml b/DuneRealmsGUI/executableitems/regional-cooking/carrot_cake_mix.yml new file mode 100644 index 00000000..1e109b29 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/carrot_cake_mix.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCarrot Cake Mix", + "material": "CLAY_BALL", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/carrot_cake_mix" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cheese.yml b/DuneRealmsGUI/executableitems/regional-cooking/cheese.yml new file mode 100644 index 00000000..bbc41825 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cheese.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCheese", + "material": "HONEYCOMB", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cheese" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/chocolate_cookie_mix.yml b/DuneRealmsGUI/executableitems/regional-cooking/chocolate_cookie_mix.yml new file mode 100644 index 00000000..60dd813f --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/chocolate_cookie_mix.yml @@ -0,0 +1,27 @@ +{ + "name": "&fChocolate Cookie Dough", + "material": "CLAY_BALL", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/chocolate_cookie_mix" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/chocolate_cookies.yml b/DuneRealmsGUI/executableitems/regional-cooking/chocolate_cookies.yml new file mode 100644 index 00000000..9d7fdcc1 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/chocolate_cookies.yml @@ -0,0 +1,27 @@ +{ + "name": "&fChocolate Cookies", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/chocolate_cookies" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/chocolate_liqueur.yml b/DuneRealmsGUI/executableitems/regional-cooking/chocolate_liqueur.yml new file mode 100644 index 00000000..70c30134 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/chocolate_liqueur.yml @@ -0,0 +1,27 @@ +{ + "name": "&fChocolate Liqueur", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/chocolate_liqueur" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/chocolate_milk.yml b/DuneRealmsGUI/executableitems/regional-cooking/chocolate_milk.yml new file mode 100644 index 00000000..25acc6e8 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/chocolate_milk.yml @@ -0,0 +1,27 @@ +{ + "name": "&fChocolate Milk", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/chocolate_milk" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/chukka_shawarma.yml b/DuneRealmsGUI/executableitems/regional-cooking/chukka_shawarma.yml new file mode 100644 index 00000000..e2f2befb --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/chukka_shawarma.yml @@ -0,0 +1,27 @@ +{ + "name": "&fChukka Shawarma", + "material": "COOKED_CHICKEN", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/chukka_shawarma" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cocoa_butter.yml b/DuneRealmsGUI/executableitems/regional-cooking/cocoa_butter.yml new file mode 100644 index 00000000..7e24f573 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cocoa_butter.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCocoa Butter", + "material": "HONEYCOMB", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cocoa_butter" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cocoa_powder.yml b/DuneRealmsGUI/executableitems/regional-cooking/cocoa_powder.yml new file mode 100644 index 00000000..741ad963 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cocoa_powder.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCocoa Powder", + "material": "COCOA_BEANS", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cocoa_powder" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cocoa_truffle.yml b/DuneRealmsGUI/executableitems/regional-cooking/cocoa_truffle.yml new file mode 100644 index 00000000..04cecd22 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cocoa_truffle.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCocoa Truffle", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cocoa_truffle" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cocoa_vodka.yml b/DuneRealmsGUI/executableitems/regional-cooking/cocoa_vodka.yml new file mode 100644 index 00000000..3948fb3e --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cocoa_vodka.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCocoa Vodka", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cocoa_vodka" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/corrupted_biomass.yml b/DuneRealmsGUI/executableitems/regional-cooking/corrupted_biomass.yml new file mode 100644 index 00000000..4332bae4 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/corrupted_biomass.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCorrupted Biomass Mash", + "material": "ROTTEN_FLESH", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/corrupted_biomass" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cream.yml b/DuneRealmsGUI/executableitems/regional-cooking/cream.yml new file mode 100644 index 00000000..4a96a1f0 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cream.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCream", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cream" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cream_liqueur.yml b/DuneRealmsGUI/executableitems/regional-cooking/cream_liqueur.yml new file mode 100644 index 00000000..77e66071 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cream_liqueur.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCream Liqueur", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cream_liqueur" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cultured_milk.yml b/DuneRealmsGUI/executableitems/regional-cooking/cultured_milk.yml new file mode 100644 index 00000000..f7818bc8 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cultured_milk.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCultured Milk", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cultured_milk" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cured_ham.yml b/DuneRealmsGUI/executableitems/regional-cooking/cured_ham.yml new file mode 100644 index 00000000..8eb0c9fd --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cured_ham.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCured Ham", + "material": "COOKED_PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cured_ham" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/cured_pork_strips.yml b/DuneRealmsGUI/executableitems/regional-cooking/cured_pork_strips.yml new file mode 100644 index 00000000..f62c5478 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/cured_pork_strips.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCured Pork Strips", + "material": "PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/cured_pork_strips" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/dark_chocolate.yml b/DuneRealmsGUI/executableitems/regional-cooking/dark_chocolate.yml new file mode 100644 index 00000000..6fec2545 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/dark_chocolate.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCaladan Dark Chocolate", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/dark_chocolate" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/factory_ration_brick.yml b/DuneRealmsGUI/executableitems/regional-cooking/factory_ration_brick.yml new file mode 100644 index 00000000..19fadf46 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/factory_ration_brick.yml @@ -0,0 +1,27 @@ +{ + "name": "&fFactory Ration Brick", + "material": "COOKED_BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/factory_ration_brick" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/flour.yml b/DuneRealmsGUI/executableitems/regional-cooking/flour.yml new file mode 100644 index 00000000..2ff646f3 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/flour.yml @@ -0,0 +1,27 @@ +{ + "name": "&fFlour", + "material": "SUGAR", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/flour" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/furnace_roasted_hoglin.yml b/DuneRealmsGUI/executableitems/regional-cooking/furnace_roasted_hoglin.yml new file mode 100644 index 00000000..202da229 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/furnace_roasted_hoglin.yml @@ -0,0 +1,27 @@ +{ + "name": "&fFurnace-roasted Hoglin", + "material": "COOKED_PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/furnace_roasted_hoglin" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/garden_salad.yml b/DuneRealmsGUI/executableitems/regional-cooking/garden_salad.yml new file mode 100644 index 00000000..2fea40b6 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/garden_salad.yml @@ -0,0 +1,27 @@ +{ + "name": "&fGarden Salad", + "material": "MUSHROOM_STEW", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/garden_salad" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/hazelnut_praline.yml b/DuneRealmsGUI/executableitems/regional-cooking/hazelnut_praline.yml new file mode 100644 index 00000000..af3f14fd --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/hazelnut_praline.yml @@ -0,0 +1,27 @@ +{ + "name": "&fHazelnut Praline", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/hazelnut_praline" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/hazelnuts.yml b/DuneRealmsGUI/executableitems/regional-cooking/hazelnuts.yml new file mode 100644 index 00000000..9f219e12 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/hazelnuts.yml @@ -0,0 +1,27 @@ +{ + "name": "&fHazelnuts", + "material": "COCOA_BEANS", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/hazelnuts" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/hoglin_burger.yml b/DuneRealmsGUI/executableitems/regional-cooking/hoglin_burger.yml new file mode 100644 index 00000000..63f34e8c --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/hoglin_burger.yml @@ -0,0 +1,27 @@ +{ + "name": "&fHoglin Burger", + "material": "COOKED_PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/hoglin_burger" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/hoglin_cuts.yml b/DuneRealmsGUI/executableitems/regional-cooking/hoglin_cuts.yml new file mode 100644 index 00000000..9a0531c2 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/hoglin_cuts.yml @@ -0,0 +1,27 @@ +{ + "name": "&fHoglin Cuts", + "material": "PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/hoglin_cuts" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/hot_cocoa.yml b/DuneRealmsGUI/executableitems/regional-cooking/hot_cocoa.yml new file mode 100644 index 00000000..10d97f8f --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/hot_cocoa.yml @@ -0,0 +1,27 @@ +{ + "name": "&fHot Cocoa", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/hot_cocoa" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/industrial_protein_slab.yml b/DuneRealmsGUI/executableitems/regional-cooking/industrial_protein_slab.yml new file mode 100644 index 00000000..cb07a184 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/industrial_protein_slab.yml @@ -0,0 +1,27 @@ +{ + "name": "&fIndustrial Protein Slab", + "material": "COOKED_BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/industrial_protein_slab" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/jerboa_tallow.yml b/DuneRealmsGUI/executableitems/regional-cooking/jerboa_tallow.yml new file mode 100644 index 00000000..d74c2095 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/jerboa_tallow.yml @@ -0,0 +1,27 @@ +{ + "name": "&fJerboa Tallow", + "material": "HONEYCOMB", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/jerboa_tallow" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/melange_cured_jerboa.yml b/DuneRealmsGUI/executableitems/regional-cooking/melange_cured_jerboa.yml new file mode 100644 index 00000000..64bc8f98 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/melange_cured_jerboa.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMelange-cured Jerboa", + "material": "COOKED_RABBIT", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/melange_cured_jerboa" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/melange_liqueur.yml b/DuneRealmsGUI/executableitems/regional-cooking/melange_liqueur.yml new file mode 100644 index 00000000..f730b34a --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/melange_liqueur.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMelange Liqueur", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/melange_liqueur" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/melange_seasoning.yml b/DuneRealmsGUI/executableitems/regional-cooking/melange_seasoning.yml new file mode 100644 index 00000000..de614167 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/melange_seasoning.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMelange Seasoning", + "material": "ORANGE_DYE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/melange_seasoning" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/melange_tea.yml b/DuneRealmsGUI/executableitems/regional-cooking/melange_tea.yml new file mode 100644 index 00000000..ff305047 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/melange_tea.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMelange Tea", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/melange_tea" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/milk_chocolate.yml b/DuneRealmsGUI/executableitems/regional-cooking/milk_chocolate.yml new file mode 100644 index 00000000..961c7897 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/milk_chocolate.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCaladan Milk Chocolate", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/milk_chocolate" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/milkshake.yml b/DuneRealmsGUI/executableitems/regional-cooking/milkshake.yml new file mode 100644 index 00000000..2408eecc --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/milkshake.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMilkshake", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/milkshake" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_burger.yml b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_burger.yml new file mode 100644 index 00000000..a1f3a495 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_burger.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMooshroom Burger", + "material": "COOKED_BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/mooshroom_burger" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_cream_liqueur.yml b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_cream_liqueur.yml new file mode 100644 index 00000000..af3cb978 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_cream_liqueur.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMooshroom Cream Liqueur", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/mooshroom_cream_liqueur" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_cuts.yml b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_cuts.yml new file mode 100644 index 00000000..585d2016 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_cuts.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMooshroom Cuts", + "material": "BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/mooshroom_cuts" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_milk.yml b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_milk.yml new file mode 100644 index 00000000..ae3392e4 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_milk.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMooshroom Milk", + "material": "MILK_BUCKET", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/mooshroom_milk" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_milkshake.yml b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_milkshake.yml new file mode 100644 index 00000000..a8d10a1b --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_milkshake.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMooshroom Milkshake", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/mooshroom_milkshake" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_steak.yml b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_steak.yml new file mode 100644 index 00000000..f00d0f83 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/mooshroom_steak.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMooshroom Steak", + "material": "COOKED_BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/mooshroom_steak" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/mycelium_cheese.yml b/DuneRealmsGUI/executableitems/regional-cooking/mycelium_cheese.yml new file mode 100644 index 00000000..192e00ee --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/mycelium_cheese.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMycelium Cheese", + "material": "HONEYCOMB", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/mycelium_cheese" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/mycelium_culture.yml b/DuneRealmsGUI/executableitems/regional-cooking/mycelium_culture.yml new file mode 100644 index 00000000..84339638 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/mycelium_culture.yml @@ -0,0 +1,27 @@ +{ + "name": "&fMycelium Culture", + "material": "RED_MUSHROOM", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/mycelium_culture" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/natural_casings.yml b/DuneRealmsGUI/executableitems/regional-cooking/natural_casings.yml new file mode 100644 index 00000000..963fb707 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/natural_casings.yml @@ -0,0 +1,27 @@ +{ + "name": "&fNatural Casings", + "material": "STRING", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/natural_casings" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/nutrient_gel.yml b/DuneRealmsGUI/executableitems/regional-cooking/nutrient_gel.yml new file mode 100644 index 00000000..0b56e825 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/nutrient_gel.yml @@ -0,0 +1,27 @@ +{ + "name": "&fNutrient Gel", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/nutrient_gel" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/nutrient_tonic.yml b/DuneRealmsGUI/executableitems/regional-cooking/nutrient_tonic.yml new file mode 100644 index 00000000..47b6e83b --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/nutrient_tonic.yml @@ -0,0 +1,27 @@ +{ + "name": "&fNutrient Tonic", + "material": "HONEY_BOTTLE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/nutrient_tonic" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/ordos_berry_wine.yml b/DuneRealmsGUI/executableitems/regional-cooking/ordos_berry_wine.yml new file mode 100644 index 00000000..036b0b48 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/ordos_berry_wine.yml @@ -0,0 +1,27 @@ +{ + "name": "&fOrdos Berry Wine", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/ordos_berry_wine" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/pork_burger.yml b/DuneRealmsGUI/executableitems/regional-cooking/pork_burger.yml new file mode 100644 index 00000000..f7cb65dd --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/pork_burger.yml @@ -0,0 +1,27 @@ +{ + "name": "&fPork Burger", + "material": "COOKED_PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/pork_burger" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/pork_jerky.yml b/DuneRealmsGUI/executableitems/regional-cooking/pork_jerky.yml new file mode 100644 index 00000000..d3d13e90 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/pork_jerky.yml @@ -0,0 +1,27 @@ +{ + "name": "&fPork Jerky", + "material": "COOKED_PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/pork_jerky" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/pork_mince.yml b/DuneRealmsGUI/executableitems/regional-cooking/pork_mince.yml new file mode 100644 index 00000000..53217ecc --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/pork_mince.yml @@ -0,0 +1,27 @@ +{ + "name": "&fPork Mince", + "material": "PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/pork_mince" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/pork_rinds.yml b/DuneRealmsGUI/executableitems/regional-cooking/pork_rinds.yml new file mode 100644 index 00000000..84cbf5ab --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/pork_rinds.yml @@ -0,0 +1,27 @@ +{ + "name": "&fPork Rinds", + "material": "COOKED_PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/pork_rinds" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/potato_vodka.yml b/DuneRealmsGUI/executableitems/regional-cooking/potato_vodka.yml new file mode 100644 index 00000000..67656901 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/potato_vodka.yml @@ -0,0 +1,27 @@ +{ + "name": "&fPotato Vodka", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/potato_vodka" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/potato_wash.yml b/DuneRealmsGUI/executableitems/regional-cooking/potato_wash.yml new file mode 100644 index 00000000..0f1d4451 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/potato_wash.yml @@ -0,0 +1,27 @@ +{ + "name": "&fPotato Wash", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/potato_wash" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/praline_box.yml b/DuneRealmsGUI/executableitems/regional-cooking/praline_box.yml new file mode 100644 index 00000000..7ec01e57 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/praline_box.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCaladan Praline Box", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/praline_box" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/raw_baguette.yml b/DuneRealmsGUI/executableitems/regional-cooking/raw_baguette.yml new file mode 100644 index 00000000..c147adca --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/raw_baguette.yml @@ -0,0 +1,27 @@ +{ + "name": "&fShaped Baguette Dough", + "material": "CLAY_BALL", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/raw_baguette" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/raw_croissant.yml b/DuneRealmsGUI/executableitems/regional-cooking/raw_croissant.yml new file mode 100644 index 00000000..123a7f00 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/raw_croissant.yml @@ -0,0 +1,27 @@ +{ + "name": "&fButter Croissant Dough", + "material": "CLAY_BALL", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/raw_croissant" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/raw_pork_sausages.yml b/DuneRealmsGUI/executableitems/regional-cooking/raw_pork_sausages.yml new file mode 100644 index 00000000..62888d9e --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/raw_pork_sausages.yml @@ -0,0 +1,27 @@ +{ + "name": "&fRaw Pork Sausages", + "material": "PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/raw_pork_sausages" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/red_mushroom_broth.yml b/DuneRealmsGUI/executableitems/regional-cooking/red_mushroom_broth.yml new file mode 100644 index 00000000..ca8cc112 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/red_mushroom_broth.yml @@ -0,0 +1,27 @@ +{ + "name": "&fRed Mushroom Broth", + "material": "MUSHROOM_STEW", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/red_mushroom_broth" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/refined_protein.yml b/DuneRealmsGUI/executableitems/regional-cooking/refined_protein.yml new file mode 100644 index 00000000..aaa25db7 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/refined_protein.yml @@ -0,0 +1,27 @@ +{ + "name": "&fRefined Protein", + "material": "COOKED_BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/refined_protein" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/refined_vodka.yml b/DuneRealmsGUI/executableitems/regional-cooking/refined_vodka.yml new file mode 100644 index 00000000..126ee051 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/refined_vodka.yml @@ -0,0 +1,27 @@ +{ + "name": "&fRefined Vodka", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/refined_vodka" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/rendered_hoglin_fat.yml b/DuneRealmsGUI/executableitems/regional-cooking/rendered_hoglin_fat.yml new file mode 100644 index 00000000..dd785c9b --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/rendered_hoglin_fat.yml @@ -0,0 +1,27 @@ +{ + "name": "&fRendered Hoglin Fat", + "material": "HONEYCOMB", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/rendered_hoglin_fat" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/rendered_lard.yml b/DuneRealmsGUI/executableitems/regional-cooking/rendered_lard.yml new file mode 100644 index 00000000..47290907 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/rendered_lard.yml @@ -0,0 +1,27 @@ +{ + "name": "&fRendered Lard", + "material": "HONEYCOMB", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/rendered_lard" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/roast_beef.yml b/DuneRealmsGUI/executableitems/regional-cooking/roast_beef.yml new file mode 100644 index 00000000..eb241ab2 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/roast_beef.yml @@ -0,0 +1,27 @@ +{ + "name": "&fRoast Beef", + "material": "COOKED_BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/roast_beef" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/sea_salt.yml b/DuneRealmsGUI/executableitems/regional-cooking/sea_salt.yml new file mode 100644 index 00000000..6fbb7a08 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/sea_salt.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSea Salt", + "material": "SUGAR", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/sea_salt" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/seashell_praline.yml b/DuneRealmsGUI/executableitems/regional-cooking/seashell_praline.yml new file mode 100644 index 00000000..031693c4 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/seashell_praline.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCaladan Seashell Praline", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/seashell_praline" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/sietch_biscuit_dough.yml b/DuneRealmsGUI/executableitems/regional-cooking/sietch_biscuit_dough.yml new file mode 100644 index 00000000..b5814e26 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/sietch_biscuit_dough.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSietch Biscuit Dough", + "material": "CLAY_BALL", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/sietch_biscuit_dough" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/sietch_curing_brine.yml b/DuneRealmsGUI/executableitems/regional-cooking/sietch_curing_brine.yml new file mode 100644 index 00000000..2221d7a5 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/sietch_curing_brine.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSietch Curing Brine", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/sietch_curing_brine" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/sietch_spice_cordial.yml b/DuneRealmsGUI/executableitems/regional-cooking/sietch_spice_cordial.yml new file mode 100644 index 00000000..e28d7eba --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/sietch_spice_cordial.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSietch Spice Cordial", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/sietch_spice_cordial" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/sietch_trail_ration.yml b/DuneRealmsGUI/executableitems/regional-cooking/sietch_trail_ration.yml new file mode 100644 index 00000000..c02bb803 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/sietch_trail_ration.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSietch Trail Ration", + "material": "BREAD", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/sietch_trail_ration" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/sietch_travel_biscuit.yml b/DuneRealmsGUI/executableitems/regional-cooking/sietch_travel_biscuit.yml new file mode 100644 index 00000000..24a3bd4d --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/sietch_travel_biscuit.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSietch Travel Biscuit", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/sietch_travel_biscuit" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/smoked_pork_sausages.yml b/DuneRealmsGUI/executableitems/regional-cooking/smoked_pork_sausages.yml new file mode 100644 index 00000000..262a2494 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/smoked_pork_sausages.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSmoked Pork Sausages", + "material": "COOKED_PORKCHOP", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/smoked_pork_sausages" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/spice_beer.yml b/DuneRealmsGUI/executableitems/regional-cooking/spice_beer.yml new file mode 100644 index 00000000..abdeb320 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/spice_beer.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSpice Beer", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/spice_beer" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/spice_roasted_chukka.yml b/DuneRealmsGUI/executableitems/regional-cooking/spice_roasted_chukka.yml new file mode 100644 index 00000000..c5e6164d --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/spice_roasted_chukka.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSpice-roasted Chukka", + "material": "COOKED_CHICKEN", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/spice_roasted_chukka" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/spice_vodka.yml b/DuneRealmsGUI/executableitems/regional-cooking/spice_vodka.yml new file mode 100644 index 00000000..1bb399de --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/spice_vodka.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSpice Vodka", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/spice_vodka" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/sweet_berry_juice.yml b/DuneRealmsGUI/executableitems/regional-cooking/sweet_berry_juice.yml new file mode 100644 index 00000000..8f00929e --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/sweet_berry_juice.yml @@ -0,0 +1,27 @@ +{ + "name": "&fSweet Berry Juice", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/sweet_berry_juice" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/vat_protein_burger.yml b/DuneRealmsGUI/executableitems/regional-cooking/vat_protein_burger.yml new file mode 100644 index 00000000..c5ec3dd3 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/vat_protein_burger.yml @@ -0,0 +1,27 @@ +{ + "name": "&fVat-protein Burger", + "material": "COOKED_BEEF", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/vat_protein_burger" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/vegetable_burger.yml b/DuneRealmsGUI/executableitems/regional-cooking/vegetable_burger.yml new file mode 100644 index 00000000..6a8d2e02 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/vegetable_burger.yml @@ -0,0 +1,27 @@ +{ + "name": "&fVegetable Burger", + "material": "BREAD", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/vegetable_burger" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/wheat_ale.yml b/DuneRealmsGUI/executableitems/regional-cooking/wheat_ale.yml new file mode 100644 index 00000000..5e46bb1c --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/wheat_ale.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCaladan Wheat Ale", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/wheat_ale" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/wheat_kvass.yml b/DuneRealmsGUI/executableitems/regional-cooking/wheat_kvass.yml new file mode 100644 index 00000000..0652d991 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/wheat_kvass.yml @@ -0,0 +1,27 @@ +{ + "name": "&fWheat Kvass", + "material": "POTION", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/wheat_kvass" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/white_chocolate.yml b/DuneRealmsGUI/executableitems/regional-cooking/white_chocolate.yml new file mode 100644 index 00000000..8703c74f --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/white_chocolate.yml @@ -0,0 +1,27 @@ +{ + "name": "&fCaladan White Chocolate", + "material": "COOKIE", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/white_chocolate" +} diff --git a/DuneRealmsGUI/executableitems/regional-cooking/winter_root_salad.yml b/DuneRealmsGUI/executableitems/regional-cooking/winter_root_salad.yml new file mode 100644 index 00000000..bc9f7f40 --- /dev/null +++ b/DuneRealmsGUI/executableitems/regional-cooking/winter_root_salad.yml @@ -0,0 +1,27 @@ +{ + "name": "&fWinter-root Salad", + "material": "MUSHROOM_STEW", + "lore": [], + "glow": false, + "disableStack": false, + "keepItemOnDeath": false, + "storeItemInfo": false, + "canBeUsedOnlyByTheOwner": false, + "cancelEventIfNoPermission": false, + "config_5": true, + "config_update": false, + "usageFeatures": { + "usage": -1, + "isRefreshableClean": false, + "usageLimit": -1 + }, + "hiders": { + "hideUsage": true + }, + "giveFirstJoinFeatures": { + "giveFirstJoin": false + }, + "activators": {}, + "variables": {}, + "itemModel": "dunerealms:cooking/winter_root_salad" +} diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/OrganisationMenus.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/OrganisationMenus.java index 41ef0163..0c1e680c 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/OrganisationMenus.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/OrganisationMenus.java @@ -44,8 +44,14 @@ final class OrganisationMenus implements Listener { }); } void cookbook(Player player){ + var catalogue=RegionalCookbook.get(plugin); var panel=panel(player,"Cookbook",false); panel.description=recipes.isEmpty()?"The spice recipes are temporarily unavailable.":"Spice cookers, fuel and rails"; + int regionSlot=10; + for(String region:RegionalCookbook.REGION_ORDER){ + if(!catalogue.available())break; + put(panel,regionSlot++,RegionalCookbook.REGIONS.get(region),RegionalCookbook.get(plugin).region(region).size()+" cooking recipes",Material.WRITABLE_BOOK,()->regionalCookbook(player,region,0)); + } int slot=19; for(var recipe:recipes){ int card=slot++; @@ -65,6 +71,58 @@ final class OrganisationMenus implements Listener { }); close(panel,player);show(player,panel); } + private void regionalCookbook(Player player,String region,int page){ + var panel=panel(player,"Cookbook · "+RegionalCookbook.REGIONS.get(region),false); + var entries=RegionalCookbook.get(plugin).region(region); + int perPage=18; + for(int index=page*perPage;indexregionalRecipe(player,recipe,page)); + applyRegionalIcon(panel,slot,recipe.model()); + } + put(panel,45,"Back","Cookbook",Material.ARROW,()->cookbook(player)); + if(page>0)put(panel,47,"Previous","Previous recipes",Material.ARROW,()->regionalCookbook(player,region,page-1)); + if((page+1)*perPageregionalCookbook(player,region,page+1)); + close(panel,player);show(player,panel); + } + private void regionalRecipe(Player player,RegionalCookbook.Entry recipe,int page){ + var panel=panel(player,"Cookbook · "+recipe.name(),false); + String world=RegionalCookbook.REGIONS.get(recipe.region()); + put(panel,4,RegionalCookbook.operation(recipe.station()),world,Material.CRAFTING_TABLE,null); + int index=0; + for(var input:recipe.inputs()){ + var local=RegionalCookbook.get(plugin).entry(input.id()); + var id=input.id().replaceFirst("^minecraft:",""); + var material=local!=null?local.material():Material.matchMaterial(id); + if(material==null)material=switch(id){ + case "spice"->Material.ORANGE_DYE; + case "spice_paste"->Material.SLIME_BALL; + case "spice_dough"->Material.WHEAT; + case "spice_bread"->Material.BREAD; + case "jerboa_cooked_meat"->Material.COOKED_RABBIT; + case "chukka_cooked_meat"->Material.COOKED_CHICKEN; + case "jerboa_raw_meat"->Material.RABBIT; + default->Material.PAPER; + }; + int slot=10+index/3*9+index++%3; + String name=local!=null?local.name():id.equals("potion")?"Plain water bottle":id.replace('_',' '); + put(panel,slot,name,"Quantity: "+input.amount(),material,null); + if(local!=null)applyRegionalIcon(panel,slot,local.model()); + } + put(panel,25,recipe.name(),recipe.grade()+"\n"+recipe.lore()+(recipe.effect().isBlank()?"":"\n"+recipe.effect()), + recipe.material(),null); + applyRegionalIcon(panel,25,recipe.model()); + put(panel,45,"Back",world+" recipes",Material.ARROW,()->regionalCookbook(player,recipe.region(),page)); + close(panel,player);player.openInventory(panel.inventory); + Bukkit.getScheduler().runTaskLater(plugin,panel.gate::expire,2400L); + } + private static void applyRegionalIcon(Panel panel,int slot,NamespacedKey model){ + var icon=panel.inventory.getItem(slot); + icon.editMeta(meta->meta.setItemModel(model)); + panel.inventory.setItem(slot,icon); + } private void cookbookRecipe(Player player,CookbookCatalog.Recipe recipe){ var panel=panel(player,"Cookbook · "+recipe.name(),false); var nativeRecipe=Bukkit.getRecipe(recipe.key()); diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/RegionalCookbook.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/RegionalCookbook.java new file mode 100644 index 00000000..6a920380 --- /dev/null +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/RegionalCookbook.java @@ -0,0 +1,80 @@ +package com.dunerealms.gui; + +import com.google.gson.JsonParser; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.stream.Collectors; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.java.JavaPlugin; + +final class RegionalCookbook { + static final Map REGIONS=Map.of( + "arrakis","Arrakis","caladan","Caladan","kaitain","Kaitain", + "giedi_prime","Giedi Prime","sigma_draconis_iv","Sigma Draconis IV"); + static final List REGION_ORDER=List.of("arrakis","caladan","kaitain","giedi_prime","sigma_draconis_iv"); + private static final List ROMAN=List.of("0","I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV"); + + record Ingredient(String id,int amount){} + record Entry(String id,String name,String region,String station,Material material,NamespacedKey model, + String grade,String lore,List inputs,String effect){} + private final Map entries; + + private static final Map CATALOGUES=new java.util.WeakHashMap<>(); + static RegionalCookbook get(JavaPlugin plugin){return CATALOGUES.computeIfAbsent(plugin,RegionalCookbook::load);} + + private static RegionalCookbook load(JavaPlugin plugin){ + try(var stream=plugin.getResource("regional-cooking.json")){ + if(stream==null)throw new IllegalStateException("Missing cooking catalogue"); + var entries=new ArrayList(); + var document=JsonParser.parseReader(new InputStreamReader(stream,StandardCharsets.UTF_8)).getAsJsonObject(); + for(var item:document.getAsJsonArray("items")){ + var row=item.getAsJsonObject(); + var input=new ArrayList(); + for(var element:row.getAsJsonArray("inputs")){ + var ingredient=element.getAsJsonObject(); + input.add(new Ingredient(ingredient.get("id").getAsString(),ingredient.get("amount").getAsInt())); + } + var lore=new ArrayList();row.getAsJsonArray("lore").forEach(line->lore.add(line.getAsString())); + var alcohol=row.getAsJsonObject("alcohol"); + String effect=alcohol==null?(row.get("hydration").getAsInt()>0?"Hydration +"+row.get("hydration").getAsInt():""): + Math.round(alcohol.get("chance").getAsFloat()*100)+"% chance of nausea · "+alcohol.get("nauseaSeconds").getAsInt()+" s"; + entries.add(new Entry(row.get("id").getAsString(),row.get("name").getAsString(), + row.get("world").getAsString(),row.get("station").getAsString(), + Material.valueOf(row.get("material").getAsString().toUpperCase(Locale.ROOT)), + NamespacedKey.fromString(row.get("model").getAsString()), + row.get("quality").getAsString().replace('_',' ').toUpperCase(Locale.ROOT)+" · MK "+ROMAN.get(row.get("mark").getAsInt()), + String.join(" ",lore),List.copyOf(input),effect)); + } + return new RegionalCookbook(entries); + }catch(Exception failure){ + plugin.getLogger().warning("Regional Cookbook unavailable: "+failure.getClass().getSimpleName()); + return new RegionalCookbook(List.of()); + } + } + + private RegionalCookbook(List rows){ + entries=rows.stream().collect(Collectors.toMap(Entry::id,row->row,(a,b)->{ + throw new IllegalArgumentException("Duplicate recipe "+a.id()); + },java.util.LinkedHashMap::new)); + } + + boolean available(){return !entries.isEmpty();} + List region(String region){return entries.values().stream().filter(entry->entry.region().equals(region)).toList();} + Entry entry(String id){return entries.get(id);} + static String operation(String station){ + return switch(station){ + case "craft"->"Crafting table"; + case "smoker"->"Smoker"; + case "furnace"->"Furnace"; + case "forage"->"Natural oak or birch leaf decay"; + case "milk"->"Milk an adult mooshroom"; + case "harvest"->"Obtain from native livestock"; + default->throw new IllegalArgumentException("Unknown station "+station); + }; + } +} diff --git a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/badlands.json b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/badlands.json index 384568bf..f16ea530 100644 --- a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/badlands.json +++ b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/badlands.json @@ -88,6 +88,12 @@ "minCount": 4, "weight": 100 }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 2, + "weight": 40 + }, { "type": "minecraft:enderman", "maxCount": 4, diff --git a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/dripstone_caves.json b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/dripstone_caves.json index 19a7dc45..a47eb03d 100644 --- a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/dripstone_caves.json +++ b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/dripstone_caves.json @@ -88,6 +88,12 @@ "minCount": 4, "weight": 100 }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 2, + "weight": 40 + }, { "type": "minecraft:enderman", "maxCount": 4, diff --git a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/eroded_badlands.json b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/eroded_badlands.json index 384568bf..f16ea530 100644 --- a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/eroded_badlands.json +++ b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/eroded_badlands.json @@ -88,6 +88,12 @@ "minCount": 4, "weight": 100 }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 2, + "weight": 40 + }, { "type": "minecraft:enderman", "maxCount": 4, diff --git a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/pale_garden.json b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/pale_garden.json index 32d92428..baa7bf0c 100644 --- a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/pale_garden.json +++ b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/pale_garden.json @@ -77,6 +77,12 @@ "minCount": 4, "weight": 100 }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 2, + "weight": 40 + }, { "type": "minecraft:enderman", "maxCount": 4, diff --git a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/stony_peaks.json b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/stony_peaks.json index 00450f63..869543a6 100644 --- a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/stony_peaks.json +++ b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/stony_peaks.json @@ -80,6 +80,12 @@ "minCount": 4, "weight": 100 }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 2, + "weight": 40 + }, { "type": "minecraft:enderman", "maxCount": 4, diff --git a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/windswept_gravelly_hills.json b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/windswept_gravelly_hills.json index eff38c2e..79ee44f6 100644 --- a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/windswept_gravelly_hills.json +++ b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/windswept_gravelly_hills.json @@ -76,6 +76,12 @@ "minCount": 4, "weight": 100 }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 2, + "weight": 40 + }, { "type": "minecraft:enderman", "maxCount": 4, diff --git a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/wooded_badlands.json b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/wooded_badlands.json index c2dd7222..095d3734 100644 --- a/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/wooded_badlands.json +++ b/DuneTerrain/planet-datapacks/giedi_prime/data/minecraft/worldgen/biome/wooded_badlands.json @@ -88,6 +88,12 @@ "minCount": 4, "weight": 100 }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 2, + "weight": 40 + }, { "type": "minecraft:enderman", "maxCount": 4, diff --git a/DuneTerrain/src/main/java/com/example/duneterrain/DuneTerrain.java b/DuneTerrain/src/main/java/com/example/duneterrain/DuneTerrain.java index 68431548..038d2e0f 100644 --- a/DuneTerrain/src/main/java/com/example/duneterrain/DuneTerrain.java +++ b/DuneTerrain/src/main/java/com/example/duneterrain/DuneTerrain.java @@ -444,6 +444,10 @@ public final class DuneTerrain extends JavaPlugin implements Listener { placeRandomSpicePatch(data, chunkX, chunkZ, heights,emittedSpice); if (plugin.getConfig().getBoolean("dense-spice.enabled", true)) { int spacing = Math.max(128, plugin.getConfig().getInt("dense-spice.spacing", 512)); + for(var entries=emittedSpice.iterator();entries.hasNext();){ + var p=entries.next(); + if(DenseSpice.contains(world.getSeed(),chunkX*16+p.x(),chunkZ*16+p.z(),spacing))entries.remove(); + } for (int x=0;x<16;x++) for(int z=0;z<16;z++) if(DenseSpice.contains(world.getSeed(),chunkX*16+x,chunkZ*16+z,spacing)) data.setBlock(x,heights[x][z],z,Material.ORANGE_TERRACOTTA); @@ -479,7 +483,8 @@ public final class DuneTerrain extends JavaPlugin implements Listener { int lx = x + dx, lz = z + dz, ly = y + dy; if (lx < 0 || lx >= 16 || lz < 0 || lz >= 16 || ly >= maxY || !data.getType(lx, ly, lz).isAir()) continue; org.bukkit.block.data.type.Leaves leaves = (org.bukkit.block.data.type.Leaves) Bukkit.createBlockData(Material.OAK_LEAVES); - leaves.setPersistent(true); + leaves.setPersistent(false); + leaves.setDistance(Math.min(7,Math.max(1,Math.abs(dx)+Math.abs(dz)+Math.max(0,dy-height+1)))); data.setBlock(lx, ly, lz, leaves); } } @@ -572,8 +577,8 @@ public final class DuneTerrain extends JavaPlugin implements Listener { for (int i = 0; i < count; i++) { int x = random.nextInt(16), z = random.nextInt(16), y = heights[x][z]; Material surface = data.getType(x, y, z); - if (y + 1 < maxY && y > minY && (surface == Material.SAND || surface == Material.RED_SAND)){ - data.setBlock(x, y, z, Material.SUSPICIOUS_SAND);emitted.add(new SpiceDepositProvenance.Position(x,y,z));} + if (y + 1 < maxY && y > minY && SpiceDepositProvenance.hostSand(surface)) + emitted.add(new SpiceDepositProvenance.Position(x,y,z)); } } private void placeRandomSpicePatch(ChunkData data, int chunkX, int chunkZ, int[][] heights,List emitted) { @@ -603,8 +608,8 @@ public final class DuneTerrain extends JavaPlugin implements Listener { long blockSeed = mix64(gx * 0x9E3779B97F4A7C15L ^ gz * 0xC2B2AE3D27D4EB4FL ^ salt); if (hashUnit(blockSeed) >= density) continue; int y = heights[x][z]; - if (data.getType(x, y, z) == Material.SAND || data.getType(x, y, z) == Material.RED_SAND) - {data.setBlock(x, y, z, Material.SUSPICIOUS_SAND);emitted.add(new SpiceDepositProvenance.Position(x,y,z));} + if (SpiceDepositProvenance.hostSand(data.getType(x, y, z))) + emitted.add(new SpiceDepositProvenance.Position(x,y,z)); } } } diff --git a/DuneTerrain/src/main/java/com/example/duneterrain/KaitainLivestock.java b/DuneTerrain/src/main/java/com/example/duneterrain/KaitainLivestock.java new file mode 100644 index 00000000..4154ca71 --- /dev/null +++ b/DuneTerrain/src/main/java/com/example/duneterrain/KaitainLivestock.java @@ -0,0 +1,53 @@ +package com.example.duneterrain; + +import java.util.concurrent.ThreadLocalRandom; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.entity.Cow; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.MushroomCow; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.plugin.Plugin; + +final class KaitainLivestock implements Listener { + private final Plugin plugin; + + KaitainLivestock(Plugin plugin) { + this.plugin = plugin; + } + + static boolean applies(World world, EntityType type, CreatureSpawnEvent.SpawnReason reason) { + return world.getEnvironment() == World.Environment.NORMAL && world.getName().equals("kaitain") + && type == EntityType.COW && reason == CreatureSpawnEvent.SpawnReason.NATURAL; + } + + static Cow.Variant cowVariant(double roll) { + if (roll < .06) return Cow.Variant.COLD; + if (roll < .28) return Cow.Variant.WARM; + return Cow.Variant.TEMPERATE; + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void spawn(CreatureSpawnEvent event) { + var entity = event.getEntity(); + if (!applies(entity.getWorld(),entity.getType(),event.getSpawnReason()) || entity.hasMetadata("NPC")) return; + Cow cow = (Cow) entity; + var random = ThreadLocalRandom.current(); + cow.setVariant(cowVariant(random.nextDouble())); + double variant = random.nextDouble(); + if (variant >= .04) return; + // Let the original spawn finish and respect its cancellation. The replacement + // has its own native spawn event, so other plugins can reject it independently. + Bukkit.getScheduler().runTask(plugin, () -> { + if (!cow.isValid() || cow.isDead() || cow.hasMetadata("NPC")) return; + var at = cow.getLocation(); + if (!applies(at.getWorld(),cow.getType(),event.getSpawnReason()) || !at.getWorld().isChunkLoaded(at.getBlockX()>>4,at.getBlockZ()>>4)) return; + MushroomCow mushroom = at.getWorld().spawn(at,MushroomCow.class,CreatureSpawnEvent.SpawnReason.NATURAL,false, + mob -> mob.setVariant(variant < .01 ? MushroomCow.Variant.BROWN : MushroomCow.Variant.RED)); + if (mushroom.isValid()) cow.remove(); + }); + } +} diff --git a/DuneTerrain/src/main/java/com/example/duneterrain/NativePlants.java b/DuneTerrain/src/main/java/com/example/duneterrain/NativePlants.java index 48ab1515..291ed936 100644 --- a/DuneTerrain/src/main/java/com/example/duneterrain/NativePlants.java +++ b/DuneTerrain/src/main/java/com/example/duneterrain/NativePlants.java @@ -14,6 +14,7 @@ public final class NativePlants implements Listener { if(!PLANTS.containsKey(world))return true; if((material.equals("MELON")||material.contains("MELON_STEM"))&&!world.equals("caladan"))return false; if((material.equals("PUMPKIN")||material.contains("PUMPKIN_STEM"))&&!world.equals("kaitain"))return false; + if(world.equals("giedi_prime")&&material.equals("POTATOES"))return true; if((world.equals("arrakis")||world.equals("giedi_prime"))&&CROPS.contains(material))return false; return !(material.endsWith("_SAPLING")||Set.of("MANGROVE_PROPAGULE","AZALEA","FLOWERING_AZALEA","BAMBOO","CRIMSON_FUNGUS","WARPED_FUNGUS").contains(material))||PLANTS.get(world).contains(material); } diff --git a/DuneTerrain/src/main/java/com/example/duneterrain/PlanetMobs.java b/DuneTerrain/src/main/java/com/example/duneterrain/PlanetMobs.java index b4eda079..53868bcc 100644 --- a/DuneTerrain/src/main/java/com/example/duneterrain/PlanetMobs.java +++ b/DuneTerrain/src/main/java/com/example/duneterrain/PlanetMobs.java @@ -10,9 +10,9 @@ import org.bukkit.plugin.Plugin; public final class PlanetMobs implements Listener { private static final Set NETHER=Set.of("BLAZE","GHAST","HOGLIN","MAGMA_CUBE","PIGLIN","PIGLIN_BRUTE","STRIDER","WITHER_SKELETON","ZOGLIN","ZOMBIFIED_PIGLIN","SKELETON","ENDERMAN"); private static final Set PASSIVE=Set.of("ALLAY","ARMADILLO","AXOLOTL","BAT","CAMEL","CAT","CHICKEN","COD","COW","DONKEY","FROG","GLOW_SQUID","HORSE","MUSHROOM_COW","MOOSHROOM","MULE","OCELOT","PARROT","PIG","PUFFERFISH","RABBIT","SALMON","SHEEP","SNIFFER","SNOWMAN","SNOW_GOLEM","SQUID","STRIDER","TADPOLE","TROPICAL_FISH","TURTLE","VILLAGER","WANDERING_TRADER"); - public static boolean allowed(String planet,String mob,boolean island){if("sigma_draconis_iv".equals(planet)&&"GOAT".equals(mob)||allowedColdPig(planet,mob))return true;return switch(planet){case "caladan"->!mob.equals("CREEPER");case "kaitain"->PASSIVE.contains(mob);case "giedi_prime"->NETHER.contains(mob);case "sigma_draconis_iv"->Set.of("SKELETON","STRAY","WITHER_SKELETON","BOGGED").contains(mob)||island&&Set.of("MUSHROOM_COW","MOOSHROOM","SULFUR_CUBE").contains(mob);default->true;};} + public static boolean allowed(String planet,String mob,boolean island){if("sigma_draconis_iv".equals(planet)&&"GOAT".equals(mob)||allowedColdPig(planet,mob))return true;return switch(planet){case "caladan"->!mob.equals("CREEPER");case "kaitain"->PASSIVE.contains(mob);case "giedi_prime"->NETHER.contains(mob)||mob.equals("ZOMBIE");case "sigma_draconis_iv"->Set.of("SKELETON","STRAY","WITHER_SKELETON","BOGGED").contains(mob)||island&&Set.of("MUSHROOM_COW","MOOSHROOM","SULFUR_CUBE").contains(mob);default->true;};} public static boolean allowedSpawn(String planet,String mob,boolean island,String reason){return allowed(planet,mob,island)||planet.equals("giedi_prime")&&(reason.equals("SPAWNER")&&Set.of("SKELETON","ZOMBIE","SPIDER","CAVE_SPIDER").contains(mob)||mob.equals("WARDEN"));} - public static void start(Plugin plugin){Bukkit.getPluginManager().registerEvents(new PlanetMobs(),plugin);Bukkit.getPluginManager().registerEvents(new NativePlants(),plugin);PlanetSoil.start(plugin);} + public static void start(Plugin plugin){Bukkit.getPluginManager().registerEvents(new PlanetMobs(),plugin);Bukkit.getPluginManager().registerEvents(new KaitainLivestock(plugin),plugin);Bukkit.getPluginManager().registerEvents(new NativePlants(),plugin);PlanetSoil.start(plugin);} @EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void spawning(CreatureSpawnEvent event){if(sigmaColdPig(event))return;var e=event.getEntity();String planet=e.getWorld().getName();if(!TemperateLandscape.enabled(planet))return; if(e instanceof PiglinAbstract piglin&&planet.equals("giedi_prime"))piglin.setImmuneToZombification(true);if(e instanceof Hoglin hoglin&&planet.equals("giedi_prime"))hoglin.setImmuneToZombification(true); if(event.getSpawnReason()==CreatureSpawnEvent.SpawnReason.CUSTOM||e.hasMetadata("NPC")||e instanceof Tameable pet&&pet.isTamed())return; diff --git a/DuneTerrain/src/main/java/com/example/duneterrain/SpiceDepositProvenance.java b/DuneTerrain/src/main/java/com/example/duneterrain/SpiceDepositProvenance.java index 8a96f2ce..fdf03f3a 100644 --- a/DuneTerrain/src/main/java/com/example/duneterrain/SpiceDepositProvenance.java +++ b/DuneTerrain/src/main/java/com/example/duneterrain/SpiceDepositProvenance.java @@ -32,15 +32,20 @@ final class SpiceDepositProvenance extends BlockPopulator { void capture(WorldInfo world,int cx,int cz,Collection positions,ChunkGenerator.ChunkData data){ if(world.getUID()==null||pending.size()>=4096)return; // Fail closed; never grow an unbounded generation cache. Set actual=new HashSet<>(); - for(Position p:positions)if(data.getType(p.x(),p.y(),p.z())==Material.SUSPICIOUS_SAND)actual.add(new Position(cx*16+p.x(),p.y(),cz*16+p.z())); + for(Position p:positions)if(hostSand(data.getType(p.x(),p.y(),p.z())))actual.add(new Position(cx*16+p.x(),p.y(),cz*16+p.z())); if(!actual.isEmpty())pending.put(new ChunkKey(world.getUID(),cx,cz),Set.copyOf(actual)); } @Override public void populate(WorldInfo world,Random random,int cx,int cz,LimitedRegion region){ Set positions=pending.remove(new ChunkKey(world.getUID(),cx,cz));if(positions==null)return; - for(Position p:positions)if(region.isInRegion(p.x(),p.y(),p.z())&®ion.getType(p.x(),p.y(),p.z())==Material.SUSPICIOUS_SAND){ - BlockState state=region.getBlockState(p.x(),p.y(),p.z());mark(state); + for(Position p:positions)if(region.isInRegion(p.x(),p.y(),p.z())){ + Material host=region.getType(p.x(),p.y(),p.z()); + if(!hostSand(host))continue; + // Materialize the block entity only after native carving and structure population. + region.setType(p.x(),p.y(),p.z(),Material.SUSPICIOUS_SAND); + if(!mark(region.getBlockState(p.x(),p.y(),p.z())))region.setType(p.x(),p.y(),p.z(),host); } } + static boolean hostSand(Material type){return type==Material.SAND||type==Material.RED_SAND;} static boolean mark(BlockState state){ if(state.getType()!=Material.SUSPICIOUS_SAND||!(state instanceof BrushableBlock tile)||tile.getLootTable()!=null||tile.getItem()!=null&&!tile.getItem().isEmpty())return false; tile.getPersistentDataContainer().set(KEY,PersistentDataType.BYTE,(byte)1);return tile.update(true,false); diff --git a/DuneTerrain/src/test/java/com/example/duneterrain/PlanetProfilesTest.java b/DuneTerrain/src/test/java/com/example/duneterrain/PlanetProfilesTest.java index e72d8c9b..b9a5d0b1 100644 --- a/DuneTerrain/src/test/java/com/example/duneterrain/PlanetProfilesTest.java +++ b/DuneTerrain/src/test/java/com/example/duneterrain/PlanetProfilesTest.java @@ -18,10 +18,24 @@ class PlanetProfilesTest { for(String crop:new String[]{"WHEAT","COCOA","POTATOES","SUGAR_CANE","NETHER_WART","CAVE_VINES"})assertFalse(NativePlants.allowed("arrakis",crop)); assertTrue(NativePlants.allowed("arrakis","OAK_SAPLING"));assertFalse(NativePlants.allowed("arrakis","AZALEA"));assertTrue(NativePlants.allowed("caladan","MANGROVE_PROPAGULE")); } - @Test void giediSpawnerExceptionsDoNotEnableOrdinaryZombieOrSpiderSpawns(){ - for(String mob:new String[]{"ZOMBIE","SPIDER","CAVE_SPIDER"}){assertTrue(PlanetMobs.allowedSpawn("giedi_prime",mob,false,"SPAWNER"));assertFalse(PlanetMobs.allowedSpawn("giedi_prime",mob,false,"NATURAL"));assertFalse(PlanetMobs.allowedSpawn("kaitain",mob,false,"SPAWNER"));} + @Test void giediAllowsNaturalZombiesAndKeepsSpidersSpawnerOnly(){ + assertTrue(PlanetMobs.allowedSpawn("giedi_prime","ZOMBIE",false,"NATURAL")); + for(String mob:new String[]{"SPIDER","CAVE_SPIDER"}){assertTrue(PlanetMobs.allowedSpawn("giedi_prime",mob,false,"SPAWNER"));assertFalse(PlanetMobs.allowedSpawn("giedi_prime",mob,false,"NATURAL"));assertFalse(PlanetMobs.allowedSpawn("kaitain",mob,false,"SPAWNER"));} assertTrue(PlanetMobs.allowedSpawn("giedi_prime","WARDEN",false,"NATURAL"));assertFalse(PlanetMobs.allowedSpawn("kaitain","WARDEN",false,"NATURAL")); } + @Test void giediPotatoesAreTheOnlyNewCrop(){ + assertTrue(NativePlants.allowed("giedi_prime","POTATOES")); + for(String crop:new String[]{"CARROTS","WHEAT","BEETROOTS","COCOA","SUGAR_CANE"})assertFalse(NativePlants.allowed("giedi_prime",crop)); + assertTrue(NativePlants.allowed("giedi_prime_nether","NETHER_WART")); + } + @Test void kaitainAllowsLivestockButRejectsNativeHostilesRegardlessOfSpawnRoute(){ + for(String reason:new String[]{"NATURAL","CHUNK_GEN","PATROL","RAID","SPAWNER","TRIAL_SPAWNER","WARDEN"}){ + for(String mob:new String[]{"PILLAGER","RAVAGER","ZOMBIE","SKELETON","CREEPER","WARDEN","BREEZE","PHANTOM"}) + assertFalse(PlanetMobs.allowedSpawn("kaitain",mob,false,reason),mob+" via "+reason); + } + for(String animal:new String[]{"COW","MOOSHROOM","SHEEP","CHICKEN","PIG"}) + assertTrue(PlanetMobs.allowedSpawn("kaitain",animal,false,"NATURAL"),animal); + } @Test void ordosCropsFreezeOnlyWhenTheirColumnIsExposed(){ assertTrue(NativePlants.frozenCrop("sigma_draconis_iv","WHEAT",65,64)); assertFalse(NativePlants.frozenCrop("sigma_draconis_iv","WHEAT",65,70)); diff --git a/DuneTerrain/src/test/java/com/example/duneterrain/SpiceDepositProvenanceTest.java b/DuneTerrain/src/test/java/com/example/duneterrain/SpiceDepositProvenanceTest.java index e00c0d2c..7d89923e 100644 --- a/DuneTerrain/src/test/java/com/example/duneterrain/SpiceDepositProvenanceTest.java +++ b/DuneTerrain/src/test/java/com/example/duneterrain/SpiceDepositProvenanceTest.java @@ -11,13 +11,15 @@ import static org.mockito.Mockito.*; class SpiceDepositProvenanceTest { @Test void onlyRecordedGeneratorCoordinatesAreMarkedAndPopulationConsumesPendingState(){ var provenance=new SpiceDepositProvenance();WorldInfo world=mock(WorldInfo.class);when(world.getUID()).thenReturn(UUID.randomUUID()); - var data=mock(ChunkGenerator.ChunkData.class);when(data.getType(1,70,2)).thenReturn(Material.SUSPICIOUS_SAND);when(data.getType(3,70,4)).thenReturn(Material.SAND); + var data=mock(ChunkGenerator.ChunkData.class);when(data.getType(1,70,2)).thenReturn(Material.SAND);when(data.getType(3,70,4)).thenReturn(Material.SAND); provenance.capture(world,-1,2,List.of(new SpiceDepositProvenance.Position(1,70,2),new SpiceDepositProvenance.Position(3,70,4)),data); - LimitedRegion region=mock(LimitedRegion.class);when(region.isInRegion(-15,70,34)).thenReturn(true);when(region.getType(-15,70,34)).thenReturn(Material.SUSPICIOUS_SAND); + LimitedRegion region=mock(LimitedRegion.class);when(region.isInRegion(-15,70,34)).thenReturn(true);when(region.isInRegion(-13,70,36)).thenReturn(true);when(region.getType(-15,70,34)).thenReturn(Material.SAND);when(region.getType(-13,70,36)).thenReturn(Material.AIR); BrushableBlock tile=mock(BrushableBlock.class);when(tile.getType()).thenReturn(Material.SUSPICIOUS_SAND);var pdc=mock(PersistentDataContainer.class);when(tile.getPersistentDataContainer()).thenReturn(pdc); - when(region.getBlockState(-15,70,34)).thenReturn(tile); + when(region.getBlockState(-15,70,34)).thenReturn(tile);when(tile.update(true,false)).thenReturn(true); provenance.populate(world,new Random(1),-1,2,region);provenance.populate(world,new Random(1),-1,2,region); verify(pdc,times(1)).set(SpiceDepositProvenance.KEY,PersistentDataType.BYTE,(byte)1);verify(tile).update(true,false); + verify(region).setType(-15,70,34,Material.SUSPICIOUS_SAND); + verify(region,never()).setType(-13,70,36,Material.SUSPICIOUS_SAND); verify(region,never()).getBlockState(-13,70,36);verify(region,times(1)).getBlockState(anyInt(),anyInt(),anyInt()); } @Test void playerPlacedOrOldUnmarkedSandAndCompressedDisksAreNotAuthentic(){ diff --git a/JarvisConnector/build.gradle.kts b/JarvisConnector/build.gradle.kts index 6c7fa07d..b2d9b827 100644 --- a/JarvisConnector/build.gradle.kts +++ b/JarvisConnector/build.gradle.kts @@ -15,6 +15,7 @@ tasks.jar { archiveFileName.set("jarvistranslator.jar") } tasks.processResources { + from(rootProject.file("../network/content-assets/cookbook/regional-cooking.json")) from(rootProject.file("../network/content-assets/planet-artwork/profiles.json")) { rename { "planet-item-profiles.json" } } diff --git a/JarvisConnector/src/main/java/com/dunerealms/jarvis/JarvisTranslator.java b/JarvisConnector/src/main/java/com/dunerealms/jarvis/JarvisTranslator.java index f0ef1582..189f6a25 100644 --- a/JarvisConnector/src/main/java/com/dunerealms/jarvis/JarvisTranslator.java +++ b/JarvisConnector/src/main/java/com/dunerealms/jarvis/JarvisTranslator.java @@ -14,6 +14,13 @@ import org.bukkit.event.server.BroadcastMessageEvent; /** Shared central API and server-owned native action translation. Never grants player permissions. */ public final class JarvisTranslator extends JavaPlugin implements Listener { + public void withConfirmedSpiceHarvest(org.bukkit.event.block.BlockBreakEvent original,Runnable reward){ + if(questObservations==null)reward.run(); + else questObservations.confirmedSpiceHarvest(original,reward); + } + public int hydrationRestoration(org.bukkit.inventory.ItemStack item){ + return RegionalCooking.hydrationRestoration(item); + } private SharedGameApi api; private NativeActions actions; private NativeKeys nativeKeys; diff --git a/JarvisConnector/src/main/java/com/dunerealms/jarvis/NativeLeafDecay.java b/JarvisConnector/src/main/java/com/dunerealms/jarvis/NativeLeafDecay.java new file mode 100644 index 00000000..b06e11cd --- /dev/null +++ b/JarvisConnector/src/main/java/com/dunerealms/jarvis/NativeLeafDecay.java @@ -0,0 +1,93 @@ +package com.dunerealms.jarvis; + +import java.util.ArrayDeque; +import java.util.HashSet; +import java.util.LinkedHashSet; +import org.bukkit.Bukkit; +import org.bukkit.Tag; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.type.Leaves; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockExplodeEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.plugin.Plugin; + +final class NativeLeafDecay implements Listener { + private static final BlockFace[] NEIGHBORS={BlockFace.UP,BlockFace.DOWN,BlockFace.NORTH,BlockFace.SOUTH,BlockFace.EAST,BlockFace.WEST}; + private static final int RADIUS=8, WIDTH=RADIUS*2+1, VOLUME=WIDTH*WIDTH*WIDTH; + private final LinkedHashSet logs=new LinkedHashSet<>(); + private final LinkedHashSet leaves=new LinkedHashSet<>(); + private int offset; + private record Search(Block block,int distance){} + + NativeLeafDecay(Plugin plugin) { + Bukkit.getPluginManager().registerEvents(this,plugin); + Bukkit.getScheduler().runTaskTimer(plugin,this::update,10,1); + } + + private void removed(Block block){ + if(block.getWorld().getEnvironment()!=World.Environment.THE_END&&Tag.LOGS.isTagged(block.getType()) + && logs.size()<128)logs.add(block); + } + + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + public void broken(BlockBreakEvent event){removed(event.getBlock());} + + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + public void burned(BlockBurnEvent event){removed(event.getBlock());} + + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + public void explosion(EntityExplodeEvent event){event.blockList().forEach(this::removed);} + + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + public void explosion(BlockExplodeEvent event){event.blockList().forEach(this::removed);} + + private void update(){ + for(int count=0;count<256&&!logs.isEmpty()&&leaves.size()<1024;count++){ + Block log=logs.getFirst(); + if(!loaded(log)||Tag.LOGS.isTagged(log.getType())){ + logs.removeFirst();offset=0;continue; + } + int x=offset%WIDTH-RADIUS,y=offset/WIDTH%WIDTH-RADIUS,z=offset/(WIDTH*WIDTH)-RADIUS; + Block candidate=log.getRelative(x,y,z); + if(loaded(candidate)&&Tag.LEAVES.isTagged(candidate.getType()))leaves.add(candidate); + if(++offset==VOLUME){logs.removeFirst();offset=0;} + } + for(int count=0;count<8&&!leaves.isEmpty();count++){ + Block block=leaves.removeFirst(); + if(!loaded(block)||!(block.getBlockData() instanceof Leaves data)||data.isPersistent()||hasSupport(block))continue; + data.setDistance(7); + block.setBlockData(data,false); + block.randomTick(); + } + } + + private static boolean loaded(Block block){ + World world=block.getWorld(); + return block.getY()>=world.getMinHeight()&&block.getY()>4,block.getZ()>>4); + } + + private static boolean hasSupport(Block start){ + var queue=new ArrayDeque(); + var seen=new HashSet(); + queue.add(new Search(start,0));seen.add(start); + while(!queue.isEmpty()){ + Search node=queue.remove(); + for(BlockFace face:NEIGHBORS){ + Block next=node.block().getRelative(face); + if(next.getY()=next.getWorld().getMaxHeight())continue; + if(!loaded(next)||Tag.LOGS.isTagged(next.getType()))return true; + if(node.distance()<5&&Tag.LEAVES.isTagged(next.getType())&&seen.add(next)) + queue.add(new Search(next,node.distance()+1)); + } + } + return false; + } +} diff --git a/JarvisConnector/src/main/java/com/dunerealms/jarvis/QuestObservations.java b/JarvisConnector/src/main/java/com/dunerealms/jarvis/QuestObservations.java index 774f71f8..7c9b26d4 100644 --- a/JarvisConnector/src/main/java/com/dunerealms/jarvis/QuestObservations.java +++ b/JarvisConnector/src/main/java/com/dunerealms/jarvis/QuestObservations.java @@ -127,6 +127,13 @@ final class QuestObservations implements Listener,AutoCloseable { if(e.isCancelled()||harvest.drops().isEmpty())return; Bukkit.getScheduler().runTask(plugin,()->{if(e.getBlock().getType()==Material.SUSPICIOUS_SAND)return;for(var proof:harvest.drops()){if(!captured.offer(proof))warning();var flight=proof.deepCopy();flight.addProperty("kind","flight_spice");flight.addProperty("dimension","NORMAL");flight.addProperty("eventId",UUID.nameUUIDFromBytes(("flight:"+proof.get("eventId").getAsString()).getBytes(java.nio.charset.StandardCharsets.UTF_8)).toString());if(!captured.offer(flight))warning();}}); } + void confirmedSpiceHarvest(BlockBreakEvent original,Runnable reward){ + if(Bukkit.isPrimaryThread()&&server.equals("arrakis")&&eligible(original.getPlayer()) + &&!original.isCancelled()&&original.getBlock().getType().isAir()){ + harvests.push(new Harvest(original,new ArrayList<>())); + try{reward.run();}finally{finishHarvest(original);} + }else reward.run(); + } private void sample(Player p){ UUID id=p.getUniqueId();long now=System.nanoTime(); if(!eligible(p)){since.remove(id);movement.remove(id);return;} diff --git a/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalCooking.java b/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalCooking.java new file mode 100644 index 00000000..963dc33f --- /dev/null +++ b/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalCooking.java @@ -0,0 +1,144 @@ +package com.dunerealms.jarvis; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.RecipeChoice; +import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.PotionType; + +final class RegionalCooking { + private static volatile Map hydratingDrinks=Map.of(); + private static final Set STATIONS=Set.of("craft","smoker","furnace","harvest","forage","milk"); + private static final Map LEGACY=Map.of( + "spice",Material.ORANGE_DYE,"spice_paste",Material.SLIME_BALL,"spice_dough",Material.WHEAT, + "spice_bread",Material.BREAD,"jerboa_raw_meat",Material.RABBIT,"jerboa_cooked_meat",Material.COOKED_RABBIT, + "chukka_cooked_meat",Material.COOKED_CHICKEN); + private final Map products=new LinkedHashMap<>(); + private final Map prototypes=new LinkedHashMap<>(); + private final ItemMetadataOverlay metadata; + + record Product(String id, String world, Material material, String model, String station, + int mark, int amount, String lore, RegionalFoodItem.Serving serving, List inputs) {} + record Input(String id, int amount) {} + private record Drink(ItemStack prototype,int restoration) {} + + static void start(Plugin plugin,ItemMetadataOverlay metadata,SurvivalFoodRecipes engine) throws ReflectiveOperationException { + var cooking=new RegionalCooking(plugin,metadata,engine); + String server=plugin.getConfig().getString("native.server-key", + plugin.getDataFolder().getAbsoluteFile().getParentFile().getParentFile().getName()); + new RegionalFoodStations(plugin,server,cooking.recipes()); + new RegionalFoodAcquisition(plugin,cooking); + var drinks=new LinkedHashMap(); + for(Product product:cooking.products.values()){ + var serving=product.serving(); + if(serving!=null&&serving.drink()&&serving.hydration()>0&&serving.intoxicationChance()==0) + drinks.put(product.id(),new Drink(cooking.item(product.id()),serving.hydration())); + } + hydratingDrinks=Map.copyOf(drinks); + plugin.getLogger().info("Regional Cooking & Baking recipes and products ready"); + } + + static int hydrationRestoration(ItemStack item){ + if(item==null||item.getAmount()<1||!item.hasItemMeta())return 0; + String id=item.getItemMeta().getPersistentDataContainer().get(RegionalFoodItem.FOOD_ID, + org.bukkit.persistence.PersistentDataType.STRING); + if(id==null)return 0; + Drink drink=hydratingDrinks.get(id); + return drink!=null&&drink.prototype().isSimilar(item)?drink.restoration():0; + } + + private RegionalCooking(Plugin plugin,ItemMetadataOverlay metadata,SurvivalFoodRecipes engine) throws ReflectiveOperationException { + this.metadata=metadata; + var stream=plugin.getResource("regional-cooking.json"); + if(stream==null)throw new IllegalStateException("Missing cooking catalogue"); + JsonObject doc=JsonParser.parseReader(new InputStreamReader(stream,StandardCharsets.UTF_8)).getAsJsonObject(); + if(doc.get("schema").getAsInt()!=1)throw new IllegalArgumentException("Invalid cooking catalogue"); + for(var element:doc.getAsJsonArray("items")){ + Product row=parse(element.getAsJsonObject()); + if(products.putIfAbsent(row.id(),row)!=null)throw new IllegalArgumentException("Duplicate regional product "+row.id()); + ItemStack item=RegionalFoodItem.output(engine.nativeItem(row.id()),row.id(),row.material(),row.model(),row.world(), + row.mark(),row.amount(),row.lore(),row.serving(),metadata); + prototypes.put(row.id(),item); + } + } + + private static Product parse(JsonObject row) { + String id=text(row,"id"),world=text(row,"world"),station=text(row,"station"),kind=text(row,"kind"),model=text(row,"model"); + int mark=row.get("mark").getAsInt(),amount=row.get("amount").getAsInt(); + var material=Material.valueOf(text(row,"material").toUpperCase(Locale.ROOT)); + if(!id.matches("[a-z_]+")||!STATIONS.contains(station)||!model.equals("dunerealms:cooking/"+id) + ||mark<3||mark>14||!CraftingGrades.quality(mark).equals(text(row,"quality")))throw new IllegalArgumentException("Invalid product "+id); + var alcohol=row.getAsJsonObject("alcohol"); + var serving=kind.equals("resource") ? null : new RegionalFoodItem.Serving( + row.get("nutrition").getAsInt(),row.get("saturation").getAsFloat(),kind.equals("drink")||alcohol!=null, + row.get("hydration").getAsInt(),alcohol==null?0:Math.round(alcohol.get("chance").getAsFloat()*100), + alcohol==null?0:alcohol.get("nauseaSeconds").getAsInt()); + var inputs=new ArrayList(); + for(var entry:row.getAsJsonArray("inputs")){ + var input=entry.getAsJsonObject(); + inputs.add(new Input(text(input,"id"),input.get("amount").getAsInt())); + } + var lore=new ArrayList();row.getAsJsonArray("lore").forEach(line->lore.add(line.getAsString())); + return new Product(id,world,material,model.substring("dunerealms:".length()),station,mark,amount,String.join(" ",lore),serving,List.copyOf(inputs)); + } + + private static String text(JsonObject row,String field){return row.get(field).getAsString();} + + Product product(String id){return products.get(id);} + ItemStack item(String id){return prototypes.get(id).clone();} + ItemStack item(String id,String origin){ + var result=item(id); + result.editMeta(meta->meta.getPersistentDataContainer().remove(ItemOrigin.WORLD)); + ItemOrigin.created(result,origin); + metadata.stamp(result); + return result; + } + + private List recipes() { + var rows=new ArrayList(); + for(Product row:products.values()){ + RegionalFoodStations.Station station=switch(row.station()){ + case "craft"->RegionalFoodStations.Station.CRAFTING; + case "smoker"->RegionalFoodStations.Station.SMOKER; + case "furnace"->RegionalFoodStations.Station.FURNACE; + default->null; + }; + if(station==null)continue; + var inputs=new ArrayList(); + for(Input input:row.inputs()){ + if(input.amount()<1||input.amount()>9)throw new IllegalArgumentException("Invalid ingredient count in "+row.id()); + String id=input.id(),origin=row.id().equals("spice_beer")&&id.equals("minecraft:wheat")?"caladan":null; + RecipeChoice choice; + if(id.startsWith("minecraft:")){ + var material=Material.valueOf(id.substring("minecraft:".length()).toUpperCase(Locale.ROOT)); + choice=new RecipeChoice.MaterialChoice(material); + id=null; + }else if(id.equals("hoglin_cuts"))choice=new RecipeChoice.ExactChoice(item(id,"giedi_prime_nether").asOne()); + else if(products.containsKey(id))choice=new RecipeChoice.ExactChoice(item(id).asOne()); + else if(LEGACY.containsKey(id))choice=new RecipeChoice.MaterialChoice(LEGACY.get(id)); + else throw new IllegalArgumentException("Unknown ingredient "+id); + for(int n=0;n craftingRecipe; + private final Method keyOf, lookup, add, remove, valueOf, size, stackAt, toBukkit, toNative; + private final java.lang.reflect.Constructor holder; + + RegionalCraftRemainders() throws ReflectiveOperationException { + var server=Class.forName("net.minecraft.server.MinecraftServer"); + var managerType=Class.forName("net.minecraft.world.item.crafting.RecipeManager"); + var holderType=Class.forName("net.minecraft.world.item.crafting.RecipeHolder"); + var resourceKey=Class.forName("net.minecraft.resources.ResourceKey"); + var recipeType=Class.forName("net.minecraft.world.item.crafting.Recipe"); + var input=Class.forName("net.minecraft.world.item.crafting.CraftingInput"); + var stack=Class.forName("net.minecraft.world.item.ItemStack"); + var item=Class.forName("org.bukkit.craftbukkit.inventory.CraftItemStack"); + craftingRecipe=Class.forName("net.minecraft.world.item.crafting.CraftingRecipe"); + manager=server.getMethod("getRecipeManager").invoke(server.getMethod("getServer").invoke(null)); + recipeRegistry=Class.forName("net.minecraft.core.registries.Registries").getField("RECIPE").get(null); + keyOf=Class.forName("org.bukkit.craftbukkit.util.CraftNamespacedKey").getMethod("toResourceKey",resourceKey,NamespacedKey.class); + lookup=managerType.getMethod("byKey",resourceKey); + add=managerType.getMethod("addRecipe",holderType); + remove=managerType.getMethod("removeRecipe",resourceKey); + valueOf=holderType.getMethod("value"); + holder=holderType.getConstructor(resourceKey,recipeType); + size=input.getMethod("size"); + stackAt=input.getMethod("getItem",int.class); + toBukkit=item.getMethod("asBukkitCopy",stack); + toNative=item.getMethod("asNMSCopy",ItemStack.class); + } + + void install(NamespacedKey name, ItemStack result) throws ReflectiveOperationException { + Object key=keyOf.invoke(null,recipeRegistry,name); + Object originalHolder=((Optional)lookup.invoke(manager,key)).orElseThrow(); + Object original=valueOf.invoke(originalHolder); + if(!craftingRecipe.isInstance(original))throw new IllegalArgumentException("Expected regional native craft recipe"); + Object wrapped=Proxy.newProxyInstance(craftingRecipe.getClassLoader(),new Class[]{craftingRecipe},(p,method,args)->{ + try { + Object outcome=method.invoke(original,args); + if(method.getName().equals("getRemainingItems")){ + @SuppressWarnings("unchecked") List remainder=(List)outcome; + Object input=args[0]; + int slots=(Integer)size.invoke(input); + int reusedBottles=filledGlass(result.getType())?result.getAmount():0; + var sources=new Material[slots]; + for(int i=0;i0)reusedBottles--; + } + for(int i=0;i0&&filledGlass(sources[i]) + &&(nativeRemainder.isEmpty()||nativeRemainder.getType()==Material.GLASS_BOTTLE)){ + remainder.set(i,toNative.invoke(null,new ItemStack(Material.AIR))); + reusedBottles--; + continue; + } + if(!nativeRemainder.isEmpty())continue; + Material container=container(sources[i]); + if(container!=null)remainder.set(i,toNative.invoke(null,new ItemStack(container))); + } + } + return outcome; + }catch(InvocationTargetException failure){throw failure.getCause();} + }); + if(!Boolean.TRUE.equals(remove.invoke(manager,key)))throw new IllegalStateException("Could not replace regional craft recipe"); + try {add.invoke(manager,holder.newInstance(key,wrapped));} + catch(ReflectiveOperationException|RuntimeException failure){ + add.invoke(manager,originalHolder); + throw failure; + } + } + + static boolean filledGlass(Material material) { + return material==Material.POTION||material==Material.HONEY_BOTTLE; + } + + static Material container(Material input) { + return switch(input){ + case POTION->Material.GLASS_BOTTLE; + case MUSHROOM_STEW,RABBIT_STEW,BEETROOT_SOUP,SUSPICIOUS_STEW->Material.BOWL; + default->null; + }; + } +} diff --git a/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodAcquisition.java b/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodAcquisition.java new file mode 100644 index 00000000..3732de96 --- /dev/null +++ b/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodAcquisition.java @@ -0,0 +1,124 @@ +package com.dunerealms.jarvis; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ThreadLocalRandom; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.data.type.Leaves; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.MushroomCow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.ItemStack; +import org.bukkit.persistence.PersistentDataType; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +final class RegionalFoodAcquisition implements Listener { + private final Plugin plugin; + private final RegionalCooking cooking; + private final Map milking=new HashMap<>(); + private record Milk(MushroomCow source,EquipmentSlot hand) {} + + RegionalFoodAcquisition(Plugin plugin,RegionalCooking cooking){ + this.plugin=plugin; + this.cooking=cooking; + Bukkit.getPluginManager().registerEvents(this,plugin); + } + + private static boolean kaitain(World world){ + return world.getEnvironment()==World.Environment.NORMAL&&world.getName().equals("kaitain"); + } + + @EventHandler(priority=EventPriority.HIGHEST) + public void death(EntityDeathEvent event){ + var entity=event.getEntity(); + if(entity.hasMetadata("NPC"))return; + World world=entity.getWorld(); + String id; + Material raw,cooked; + if(entity instanceof MushroomCow&&kaitain(world)){ + id="mooshroom_cuts";raw=Material.BEEF;cooked=Material.COOKED_BEEF; + }else if(entity.getType()==EntityType.HOGLIN&&world.getEnvironment()==World.Environment.NETHER + &&world.getName().equals("giedi_prime_nether")){ + id="hoglin_cuts";raw=Material.PORKCHOP;cooked=Material.COOKED_PORKCHOP; + }else return; + var drops=event.getDrops(); + var replaced=new ArrayList(); + for(ItemStack item:drops){ + if(item.getType()!=raw&&item.getType()!=cooked){replaced.add(item);continue;} + var product=cooking.item(id,world.getName()); + product.setAmount(item.getAmount()); + replaced.add(product); + } + drops.clear();drops.addAll(replaced); + } + + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + public void beginMilk(PlayerInteractEntityEvent event){ + if(!(event.getRightClicked() instanceof MushroomCow source)||!source.isAdult() + ||source.hasMetadata("NPC")||!kaitain(source.getWorld()) + ||event.getPlayer().getInventory().getItem(event.getHand()).getType()!=Material.BUCKET)return; + UUID player=event.getPlayer().getUniqueId(); + var intent=new Milk(source,event.getHand()); + milking.put(player,intent); + Bukkit.getScheduler().runTask(plugin,()->milking.remove(player,intent)); + } + + @EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) + public void fillMilk(PlayerBucketFillEvent event){ + if(event.getItemStack()==null||event.getItemStack().getType()!=Material.MILK_BUCKET)return; + var intent=milking.remove(event.getPlayer().getUniqueId()); + if(intent==null||intent.hand()!=event.getHand()||!intent.source().isValid() + ||!intent.source().getLocation().getBlock().equals(event.getBlockClicked()))return; + event.setItemStack(cooking.item("mooshroom_milk")); + } + + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + public void forage(LeavesDecayEvent event){ + var block=event.getBlock();World world=block.getWorld(); + if(!world.getName().equals("caladan")||world.getEnvironment()!=World.Environment.NORMAL + ||!(block.getBlockData() instanceof Leaves leaves)||leaves.isPersistent() + ||block.getType()!=Material.OAK_LEAVES&&block.getType()!=Material.BIRCH_LEAVES + ||ThreadLocalRandom.current().nextDouble()>=.02)return; + Bukkit.getScheduler().runTask(plugin,()->{ + if(!event.isCancelled()&&world.isChunkLoaded(block.getX()>>4,block.getZ()>>4)&&block.getType().isAir()) + world.dropItemNaturally(block.getLocation().add(.5,.5,.5),cooking.item("hazelnuts")); + }); + } + + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + public void consumed(PlayerItemConsumeEvent event){ + var data=event.getItem().getItemMeta().getPersistentDataContainer(); + String id=data.get(RegionalFoodItem.FOOD_ID,PersistentDataType.STRING); + if(id==null||!id.equals(data.get(RegionalFoodItem.ENGINE_ID,PersistentDataType.STRING)))return; + var row=cooking.product(id); + if(row==null||row.serving()==null||row.serving().intoxicationChance()==0)return; + Player player=event.getPlayer(); + Bukkit.getScheduler().runTask(plugin,()->{ + if(!player.isOnline()||event.isCancelled()||!survivalWorld(player) + ||ThreadLocalRandom.current().nextInt(100)>=row.serving().intoxicationChance())return; + player.addPotionEffect(new PotionEffect(PotionEffectType.NAUSEA,row.serving().intoxicationSeconds()*20,0)); + }); + } + + private static boolean survivalWorld(Player player){ + if(player.getGameMode()!=GameMode.SURVIVAL&&player.getGameMode()!=GameMode.ADVENTURE)return false; + String name=player.getWorld().getName(); + return ItemOrigin.label(name)!=null&&!name.startsWith("lobby")&&!name.equals("guild_lobby"); + } +} diff --git a/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodItem.java b/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodItem.java new file mode 100644 index 00000000..5f0c94f2 --- /dev/null +++ b/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodItem.java @@ -0,0 +1,85 @@ +package com.dunerealms.jarvis; + +import io.papermc.paper.datacomponent.DataComponentTypes; +import io.papermc.paper.datacomponent.item.Consumable; +import io.papermc.paper.datacomponent.item.FoodProperties; +import io.papermc.paper.datacomponent.item.UseRemainder; +import io.papermc.paper.datacomponent.item.consumable.ItemUseAnimation; +import java.util.ArrayList; +import java.util.List; +import net.kyori.adventure.key.Key; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.TextDecoration; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.ItemStack; +import org.bukkit.persistence.PersistentDataType; + +/** Apply stable regional metadata at production, before exposing the native recipe prototype. */ +final class RegionalFoodItem { + static final NamespacedKey ENGINE_ID = new NamespacedKey("executableitems","ei-id"); + static final NamespacedKey FOOD_ID = new NamespacedKey("dunerealms","regional_food"); + static final NamespacedKey THIRST = new NamespacedKey("dunerealms","regional_hydration"); + + record Serving(int nutrition, float saturation, boolean drink, int hydration, + int intoxicationChance, int intoxicationSeconds) { + Serving { + if (nutrition < 0 || nutrition > 20 || !Float.isFinite(saturation) || saturation < 0 || saturation > 20 + || hydration < 0 || hydration > 100 || intoxicationChance < 0 || intoxicationChance > 100 + || intoxicationSeconds < 0 || intoxicationSeconds > 45 + || intoxicationChance > 0 && (!drink || hydration != 0 || intoxicationSeconds == 0)) { + throw new IllegalArgumentException("Invalid regional serving"); + } + } + } + + private RegionalFoodItem() {} + + static ItemStack output(ItemStack definition, String id, Material material, String model, String world, + int mark, int amount, String flavour, Serving serving, ItemMetadataOverlay metadata) { + if (definition == null || definition.getType()!=material || mark < 1 || mark > 14 + || amount < 1 || amount > definition.getMaxStackSize() || ItemOrigin.label(world)==null) { + throw new IllegalArgumentException("Invalid regional item definition: "+id); + } + var result=definition.clone(); + var meta=result.getItemMeta(); + var data=meta.getPersistentDataContainer(); + if (!id.equals(data.get(ENGINE_ID,PersistentDataType.STRING)) || data.has(ItemOrigin.WORLD)) { + throw new IllegalArgumentException("Wrong regional item identity: "+id); + } + data.set(FOOD_ID,PersistentDataType.STRING,id); + data.set(new NamespacedKey("dunerealms","quality"),PersistentDataType.STRING,CraftingGrades.quality(mark)); + data.set(new NamespacedKey("dunerealms","equipment_mark"),PersistentDataType.STRING,Integer.toString(mark)); + data.set(new NamespacedKey("dunerealms","item_class"),PersistentDataType.STRING,serving==null?"resource":"consumable"); + data.set(new NamespacedKey("dunerealms","metadata_policy"),PersistentDataType.STRING,ItemMetadataPolicy.VERSION); + if (model != null) meta.setItemModel(new NamespacedKey("dunerealms",model)); + var lore=new ArrayList<>(meta.hasLore()?meta.lore():List.of()); + if (!flavour.isBlank()) lore.add(Component.text(flavour,NamedTextColor.GRAY).decoration(TextDecoration.ITALIC,false)); + if (serving != null && serving.hydration() > 0) + data.set(THIRST,PersistentDataType.INTEGER,serving.hydration()); + if (serving != null && serving.intoxicationChance() > 0) lore.add(Component.text( + "Drunkenness: "+serving.intoxicationChance()+"% · "+serving.intoxicationSeconds()+" s", + NamedTextColor.GRAY).decoration(TextDecoration.ITALIC,false)); + meta.lore(lore); + result.setItemMeta(meta); + if (serving != null) { + result.setData(DataComponentTypes.FOOD,FoodProperties.food().nutrition(serving.nutrition()) + .saturation(serving.saturation()).canAlwaysEat(serving.drink())); + var consume=Consumable.consumable().consumeSeconds(1.6f) + .animation(serving.drink()?ItemUseAnimation.DRINK:ItemUseAnimation.EAT) + .sound(Key.key(serving.drink()?"entity.generic.drink":"entity.generic.eat")) + .hasConsumeParticles(!serving.drink()); + result.setData(DataComponentTypes.CONSUMABLE,consume); + Material container=RegionalCraftRemainders.container(material); + if(container!=null)result.setData(DataComponentTypes.USE_REMAINDER,UseRemainder.useRemainder(new ItemStack(container))); + } else { + result.unsetData(DataComponentTypes.FOOD); + result.unsetData(DataComponentTypes.CONSUMABLE); + } + ItemOrigin.created(result,world); + metadata.stamp(result); + result.setAmount(amount); + return result; + } +} diff --git a/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodStations.java b/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodStations.java new file mode 100644 index 00000000..02077667 --- /dev/null +++ b/JarvisConnector/src/main/java/com/dunerealms/jarvis/RegionalFoodStations.java @@ -0,0 +1,145 @@ +package com.dunerealms.jarvis; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.bukkit.Bukkit; +import org.bukkit.Keyed; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.World; +import org.bukkit.block.Crafter; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockCookEvent; +import org.bukkit.event.block.CrafterCraftEvent; +import org.bukkit.event.inventory.CraftItemEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.inventory.FurnaceRecipe; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.Recipe; +import org.bukkit.inventory.RecipeChoice; +import org.bukkit.inventory.ShapelessRecipe; +import org.bukkit.inventory.SmokingRecipe; +import org.bukkit.persistence.PersistentDataType; +import org.bukkit.plugin.Plugin; + +final class RegionalFoodStations implements Listener { + private static final Set WORLDS=Set.of("arrakis","caladan","giedi_prime","kaitain","sigma_draconis_iv"); + private static final NamespacedKey LEGACY=new NamespacedKey("dunerealms","item"); + private final Map productions = new HashMap<>(); + + enum Station { CRAFTING, FURNACE, SMOKER } + + record Ingredient(RecipeChoice choice, String itemId, String origin) { + boolean matches(ItemStack item) { + if (item == null || item.isEmpty() || !choice.test(item)) return false; + var data=item.getItemMeta().getPersistentDataContainer(); + String actual=data.get(RegionalFoodItem.ENGINE_ID,PersistentDataType.STRING); + if (data.has(new NamespacedKey("dunerealms","preview_only"))) return false; + if ("spice".equals(itemId)&&!ExchangeInventory.rawSpice(item))return false; + if (itemId == null) { + if (actual != null || data.has(LEGACY) || item.getType()==Material.POTION&&!RegionalCooking.plainWater(item)) return false; + } else if (!itemId.equals(actual) && !itemId.equals(data.get(LEGACY,PersistentDataType.STRING))) return false; + return origin == null || origin.equals(data.get(ItemOrigin.WORLD,PersistentDataType.STRING)); + } + } + + record Production(NamespacedKey key, String world, Station station, List ingredients, + ItemStack result, int cookTicks) { + Production { + ingredients=List.copyOf(ingredients); + if (!WORLDS.contains(world) || ingredients.isEmpty() || ingredients.size() > 9 + || station != Station.CRAFTING && (ingredients.size() != 1 || cookTicks <= 0)) + throw new IllegalArgumentException("Invalid regional recipe "+key); + } + } + + RegionalFoodStations(Plugin plugin, String serverKey, List rows) throws ReflectiveOperationException { + String local=serverKey.replace('-','_'); + RegionalCraftRemainders remainders=null; + for (Production row : rows) { + if (!local.equals(row.world())) continue; + if (productions.putIfAbsent(row.key(),row)!=null || Bukkit.getRecipe(row.key())!=null) + throw new IllegalStateException("Duplicate regional recipe "+row.key()); + if (!Bukkit.addRecipe(recipe(row))) throw new IllegalStateException("Could not register "+row.key()); + if(row.station()==Station.CRAFTING && (RegionalCraftRemainders.filledGlass(row.result().getType()) + ||row.ingredients().stream().anyMatch(ingredient->RegionalCraftRemainders.container(ingredient.choice().getItemStack().getType())!=null))){ + if(remainders==null)remainders=new RegionalCraftRemainders(); + remainders.install(row.key(),row.result()); + } + } + Bukkit.getPluginManager().registerEvents(this,plugin); + } + + static Recipe recipe(Production row) { + if (row.station()==Station.CRAFTING) { + var recipe=new ShapelessRecipe(row.key(),row.result()); + for (Ingredient ingredient : row.ingredients()) recipe.addIngredient(ingredient.choice()); + return recipe; + } + RecipeChoice choice=row.ingredients().getFirst().choice(); + return row.station()==Station.FURNACE + ? new FurnaceRecipe(row.key(),row.result(),choice,0f,row.cookTicks()) + : new SmokingRecipe(row.key(),row.result(),choice,0f,row.cookTicks()); + } + + static boolean permitted(Production row, World world, ItemStack[] matrix) { + return world != null && world.getEnvironment()==World.Environment.NORMAL && row.world().equals(world.getName()) + && matches(row.ingredients(),matrix); + } + + static boolean matches(List ingredients, ItemStack[] matrix) { + var items=new ArrayList(); + for (ItemStack item : matrix) if (item!=null&&!item.isEmpty()) items.add(item); + return ingredients.size()==items.size() && match(ingredients,items,0,0); + } + + private static boolean match(List ingredients,List items,int current,int assigned) { + if (current==ingredients.size()) return true; + for (int index=0;indexx.getFileName().toString().endsWith(".png")).sorted().toList()){ + BufferedImage image=ImageIO.read(p.toFile()); + if(image==null)throw new IllegalArgumentException("Invalid sprite: "+p); + if(!image.getColorModel().hasAlpha()||((image.getRGB(0,0)>>>24)&255)!=0){System.out.println("ALPHA_FAIL "+p.getFileName());continue;} + BufferedImage small=new BufferedImage(32,32,BufferedImage.TYPE_INT_ARGB); + Graphics2D g=small.createGraphics();g.setComposite(AlphaComposite.Src); + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); + double scale=32.0/Math.max(image.getWidth(),image.getHeight()); + int w=Math.max(1,(int)Math.round(image.getWidth()*scale)),h=Math.max(1,(int)Math.round(image.getHeight()*scale)); + g.drawImage(image,(32-w)/2,(32-h)/2,w,h,null);g.dispose(); + boolean visible=false;for(int y=0;y<32;y++)for(int x=0;x<32;x++)if((small.getRGB(x,y)>>>24)!=0)visible=true; + if(!visible)throw new IllegalArgumentException("Empty texture: "+p); + ImageIO.write(small,"png",out.resolve(p.getFileName()).toFile());count++; + } + } + System.out.println("Validated and sized "+count+" transparent inventory sprites to 32x32; originals unchanged."); + } +} diff --git a/tools/HydrationMerge.java b/tools/HydrationMerge.java new file mode 100644 index 00000000..947d7665 --- /dev/null +++ b/tools/HydrationMerge.java @@ -0,0 +1,54 @@ +import java.nio.file.*; +import java.util.*; +import java.util.zip.*; +import org.objectweb.asm.*; +import org.objectweb.asm.tree.*; + +/** Adds profile hydration to the retained native SQL paths without replacing their ownership logic. */ +public class HydrationMerge { + static final String P="com/example/dunerealms/",H=P+"HydrationProfiles",DB=P+"SharedDatabase"; + static MethodInsnNode call(String name,String descriptor){return new MethodInsnNode(Opcodes.INVOKESTATIC,H,name,descriptor,false);} + static ClassNode read(byte[] b){ClassNode c=new ClassNode();new ClassReader(b).accept(c,0);return c;} + static byte[] write(ClassNode c){ClassWriter w=new ClassWriter(ClassWriter.COMPUTE_MAXS);c.accept(w);return w.toByteArray();} + static void need(boolean condition,String message){if(!condition)throw new IllegalStateException(message);} + public static void main(String[] args)throws Exception{ + Path out=Path.of(args[1]);Files.createDirectories(out); + try(ZipFile zip=new ZipFile(args[0])){ + ClassNode db=read(zip.getInputStream(zip.getEntry(DB+".class")).readAllBytes()); + int ctors=0,loads=0,writes=0,loadCalls=0,binds=0,releases=0; + for(MethodNode m:db.methods){ + if(m.name.equals(""))for(AbstractInsnNode n:m.instructions.toArray())if(n.getOpcode()==Opcodes.RETURN){InsnList x=new InsnList();x.add(new VarInsnNode(Opcodes.ALOAD,0));x.add(call("initialize","(L"+DB+";)V"));m.instructions.insertBefore(n,x);ctors++;} + if(m.name.equals("loadPlayer")){ + for(AbstractInsnNode n:m.instructions.toArray()){ + if(n instanceof LdcInsnNode l&&l.cst instanceof String s&&s.startsWith("SELECT faction,inventory")&&s.contains("session_open FROM dune_players")){l.cst=s.replace("session_open FROM","session_open,hydration FROM");loads++;} + if(n instanceof MethodInsnNode i&&i.owner.equals("java/sql/ResultSet")&&i.name.equals("getString")&&n.getPrevious() instanceof LdcInsnNode l&&"faction".equals(l.cst)&&l.getPrevious() instanceof VarInsnNode v&&v.getOpcode()==Opcodes.ALOAD){InsnList x=new InsnList();x.add(new VarInsnNode(Opcodes.ALOAD,1));x.add(new VarInsnNode(Opcodes.ALOAD,v.var));x.add(call("load","(Lorg/bukkit/entity/Player;Ljava/sql/ResultSet;)V"));m.instructions.insertBefore(v,x);loadCalls++;} + } + } + if(m.name.equals("writePlayer"))for(AbstractInsnNode n:m.instructions.toArray()){ + if(n instanceof InvokeDynamicInsnNode indy)for(int a=0;a0&&loads==1&&loadCalls==1&&(writes==1||writes==2)&&binds==1&&releases>0,"Native SQL anchor mismatch: "+List.of(ctors,loads,loadCalls,writes,binds,releases)); + Files.write(out.resolve("SharedDatabase.class"),write(db)); + ClassNode core=read(zip.getInputStream(zip.getEntry(P+"DuneCore.class")).readAllBytes()); + boolean getter=core.methods.stream().anyMatch(m->m.name.equals("sharedDatabase")&&m.desc.equals("()L"+DB+";")&&(m.access&Opcodes.ACC_PUBLIC)!=0); + if(!getter){need(core.fields.stream().anyMatch(f->f.name.equals("sharedDatabase")&&f.desc.equals("L"+DB+";")),"Shared profile field missing");MethodNode m=new MethodNode(Opcodes.ACC_PUBLIC,"sharedDatabase","()L"+DB+";",null,null);m.instructions.add(new VarInsnNode(Opcodes.ALOAD,0));m.instructions.add(new FieldInsnNode(Opcodes.GETFIELD,core.name,"sharedDatabase","L"+DB+";"));m.instructions.add(new InsnNode(Opcodes.ARETURN));core.methods.add(m);} + int enable=0,disable=0; + for(MethodNode m:core.methods)for(AbstractInsnNode n:m.instructions.toArray())if(n.getOpcode()==Opcodes.RETURN){ + if(m.name.equals("onEnable")){InsnList x=new InsnList();x.add(new VarInsnNode(Opcodes.ALOAD,0));x.add(call("start","(Lorg/bukkit/plugin/java/JavaPlugin;)V"));m.instructions.insertBefore(n,x);enable++;} + if(m.name.equals("onDisable")){m.instructions.insertBefore(n,call("close","()V"));disable++;} + } + need(enable>0&&disable>0,"Core lifecycle missing");Files.write(out.resolve("DuneCore.class"),write(core)); + System.out.println("Preserved retained SQL/session logic; added hydration hooks "+List.of(ctors,loads,loadCalls,writes,binds,releases,enable,disable)); + } + } +} diff --git a/tools/RegionalCookingMerge.java b/tools/RegionalCookingMerge.java new file mode 100644 index 00000000..fef5de36 --- /dev/null +++ b/tools/RegionalCookingMerge.java @@ -0,0 +1,159 @@ +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashSet; +import java.util.Set; +import org.objectweb.asm.*; +import org.objectweb.asm.tree.*; + +class RegionalCookingMerge implements Opcodes { + private static final String JARVIS="com/dunerealms/jarvis/"; + private static final String TERRAIN="com/example/duneterrain/"; + private static final String PLUGIN="Lorg/bukkit/plugin/Plugin;"; + public static void main(String[] args) throws Exception { + if(args.length!=3)throw new IllegalArgumentException("Expected retained, donor and output classes"); + var reader=new ClassReader(Files.readAllBytes(Path.of(args[0]))); + var old=parse(reader); + var donor=parse(new ClassReader(Files.readAllBytes(Path.of(args[1])))); + if(!old.name.equals(donor.name))throw new IllegalArgumentException("Class mismatch"); + switch(old.name){ + case JARVIS+"JarvisTranslator" -> copy(old,donor,"hydrationRestoration","withConfirmedSpiceHarvest"); + case JARVIS+"QuestObservations" -> copy(old,donor,"confirmedSpiceHarvest"); + case JARVIS+"SurvivalFoodRecipes" -> addRegionalStartup(old); + case "com/dunerealms/gui/OrganisationMenus" -> copy(old,donor, + "cookbook","regionalCookbook","regionalRecipe","applyRegionalIcon"); + case TERRAIN+"NativePlants" -> copy(old,donor,"allowed"); + case TERRAIN+"PlanetMobs" -> { + if(args[2].endsWith("giedi.class"))copy(old,donor,"allowed"); + else if(args[2].endsWith("kaitain.class"))addLivestock(old); + else throw new IllegalArgumentException("Unknown PlanetMobs profile"); + } + case TERRAIN+"DuneTerrain$PlanetChunkGenerator" -> copy(old,donor, + "placeOasisTree","generateNoise","placeSpiceDeposits","placeRandomSpicePatch"); + case TERRAIN+"SpiceDepositProvenance" -> copy(old,donor,"capture","populate","hostSand"); + case "com/example/dunerealms/DuneCore" -> { + addPendingSpice(old,donor); + copy(old,donor,"onSpice","arrakisSpice","resyncDeniedSpice","finishSpiceHarvest", + "harvestWithEvidence","dropConfirmedSpice"); + } + default -> throw new IllegalArgumentException("Unexpected target "+old.name); + } + var writer=new ClassWriter(reader,0); + old.accept(writer); + Files.write(Path.of(args[2]),writer.toByteArray()); + } + private static void addPendingSpice(ClassNode owner,ClassNode donor){ + String field="pendingSpiceHarvests",desc="Ljava/util/Map;"; + var source=donor.fields.stream().filter(f->f.name.equals(field)&&f.desc.equals(desc) + &&(f.access&ACC_STATIC)!=0).findFirst().orElseThrow(); + if(owner.fields.stream().anyMatch(f->f.name.equals(field)))throw new IllegalArgumentException("Spice state already installed"); + owner.fields.add(source); + var init=owner.methods.stream().filter(m->m.name.equals("")).findFirst().orElseGet(()->{ + var method=new MethodNode(ACC_STATIC,"","()V",null,null); + method.instructions.add(new InsnNode(RETURN)); + owner.methods.add(method); + return method; + }); + var hook=new InsnList(); + hook.add(new TypeInsnNode(NEW,"java/util/HashMap")); + hook.add(new InsnNode(DUP)); + hook.add(new MethodInsnNode(INVOKESPECIAL,"java/util/HashMap","","()V",false)); + hook.add(new FieldInsnNode(PUTSTATIC,owner.name,field,desc)); + init.instructions.insert(hook); + init.maxStack=Math.max(init.maxStack,2); + } + private static void addRegionalStartup(ClassNode owner){ + var method=unique(owner,"loaded"); + AbstractInsnNode anchor=null; + for(var instruction:method.instructions){ + if(instruction instanceof LdcInsnNode constant && constant.cst instanceof String text + && text.startsWith("Survival food smoker recipes registered;")){ + var next=instruction.getNext(); + if(anchor!=null || !(next instanceof MethodInsnNode call) || !call.owner.equals("java/util/logging/Logger") + || !call.name.equals("info"))throw new IllegalArgumentException("Unexpected food startup anchor"); + anchor=next; + } + } + if(anchor==null)throw new IllegalArgumentException("Food startup anchor absent"); + var hook=new InsnList(); + hook.add(new TypeInsnNode(NEW,JARVIS+"NativeLeafDecay")); + hook.add(new InsnNode(DUP)); + hook.add(new VarInsnNode(ALOAD,0)); + hook.add(new FieldInsnNode(GETFIELD,owner.name,"plugin",PLUGIN)); + hook.add(new MethodInsnNode(INVOKESPECIAL,JARVIS+"NativeLeafDecay","","("+PLUGIN+")V",false)); + hook.add(new InsnNode(POP)); + hook.add(new VarInsnNode(ALOAD,0)); + hook.add(new FieldInsnNode(GETFIELD,owner.name,"plugin",PLUGIN)); + hook.add(new VarInsnNode(ALOAD,0)); + hook.add(new FieldInsnNode(GETFIELD,owner.name,"metadata","L"+JARVIS+"ItemMetadataOverlay;")); + hook.add(new VarInsnNode(ALOAD,0)); + hook.add(new MethodInsnNode(INVOKESTATIC,JARVIS+"RegionalCooking","start", + "("+PLUGIN+"L"+JARVIS+"ItemMetadataOverlay;L"+owner.name+";)V",false)); + method.instructions.insert(anchor,hook); + method.maxStack=Math.max(method.maxStack,4); + } + private static void addLivestock(ClassNode owner){ + var method=unique(owner,"start"); + if(!method.desc.equals("("+PLUGIN+")V") || (method.access&ACC_STATIC)==0) + throw new IllegalArgumentException("Unexpected Terrain startup signature"); + var hook=new InsnList(); + hook.add(new MethodInsnNode(INVOKESTATIC,"org/bukkit/Bukkit","getPluginManager","()Lorg/bukkit/plugin/PluginManager;",false)); + hook.add(new TypeInsnNode(NEW,TERRAIN+"KaitainLivestock")); + hook.add(new InsnNode(DUP)); + hook.add(new VarInsnNode(ALOAD,0)); + hook.add(new MethodInsnNode(INVOKESPECIAL,TERRAIN+"KaitainLivestock","","("+PLUGIN+")V",false)); + hook.add(new VarInsnNode(ALOAD,0)); + hook.add(new MethodInsnNode(INVOKEINTERFACE,"org/bukkit/plugin/PluginManager","registerEvents", + "(Lorg/bukkit/event/Listener;"+PLUGIN+")V",true)); + method.instructions.insert(hook); + method.maxStack=Math.max(method.maxStack,4); + } + private static void copy(ClassNode old, ClassNode donor, String... names) { + var copied = new HashSet(); + for (String name : names) { + var method = unique(donor, name); + var prior = old.methods.stream().filter(m -> m.name.equals(name) && m.desc.equals(method.desc)).findFirst(); + if (prior.isEmpty() && !Set.of("hydrationRestoration", "withConfirmedSpiceHarvest", "confirmedSpiceHarvest", + "regionalCookbook", "regionalRecipe", "applyRegionalIcon", "hostSand", "arrakisSpice", + "resyncDeniedSpice", "finishSpiceHarvest", "harvestWithEvidence", "dropConfirmedSpice").contains(name)) { + throw new IllegalArgumentException("Missing retained method " + name); + } + prior.ifPresent(old.methods::remove); + copyMethod(old, donor, method, copied); + } + } + + private static void copyMethod(ClassNode old, ClassNode donor, MethodNode method, Set copied) { + if (!copied.add(method.name + method.desc)) return; + var clone = new MethodNode(method.access, method.name, method.desc, method.signature, method.exceptions.toArray(String[]::new)); + method.accept(clone); + if (clone.name.startsWith("lambda$")) clone.name = "regionalCooking$" + clone.name; + if (old.methods.stream().anyMatch(m -> m.name.equals(clone.name) && m.desc.equals(clone.desc))) { + throw new IllegalArgumentException("Duplicate method " + clone.name); + } + for (var instruction : clone.instructions) { + if (!(instruction instanceof InvokeDynamicInsnNode dynamic)) continue; + for (int i = 0; i < dynamic.bsmArgs.length; i++) { + if (!(dynamic.bsmArgs[i] instanceof Handle handle) || !handle.getOwner().equals(donor.name) + || !handle.getName().startsWith("lambda$")) continue; + var target = donor.methods.stream().filter(m -> m.name.equals(handle.getName()) + && m.desc.equals(handle.getDesc())).findFirst().orElseThrow(); + copyMethod(old, donor, target, copied); + dynamic.bsmArgs[i] = new Handle(handle.getTag(), handle.getOwner(), + "regionalCooking$" + handle.getName(), handle.getDesc(), handle.isInterface()); + } + } + old.methods.add(clone); + } + + private static MethodNode unique(ClassNode node, String name) { + var methods = node.methods.stream().filter(m -> m.name.equals(name)).toList(); + if (methods.size() != 1) throw new IllegalArgumentException("Expected one " + node.name + "." + name); + return methods.getFirst(); + } + + private static ClassNode parse(ClassReader reader) { + var node = new ClassNode(); + reader.accept(node, 0); + return node; + } +} diff --git a/tools/build_cooking_bedrock.py b/tools/build_cooking_bedrock.py new file mode 100644 index 00000000..865484d7 --- /dev/null +++ b/tools/build_cooking_bedrock.py @@ -0,0 +1,43 @@ +"""Build additive Geyser v2 item-model mappings and the matching Bedrock artwork pack. + +Format/component contract: https://geysermc.org/wiki/geyser/custom-items/ +No Java or existing Bedrock pack is replaced. Source is the same authored99-item catalogue. +""" +import argparse,json,uuid +from pathlib import Path +from plugin_wild_update import digest,write_archive +from cooking_beta_artwork import artwork,STONE,STONE_SHA + +def build(source,output): + source=Path(source);output=Path(output);output.mkdir(parents=True,exist_ok=True) + rows=json.loads((source/'network/content-assets/cookbook/regional-cooking.json').read_text(encoding='utf-8'))['items'] + sprites=artwork(source);mapping={'format_version':2,'items':{}};textures={};files={};names=[] + for row in rows: + ident=row['id'];key='dr_cooking_'+ident;bedrock='dunerealms:cooking_'+ident + if row['kind']=='resource':components={'!minecraft:food':{},'!minecraft:consumable':{}} + else: + drink=row['kind']=='drink'or bool(row.get('alcohol')) + components={'minecraft:food':{'nutrition':row['nutrition'],'saturation':row['saturation'],'can_always_eat':drink},'minecraft:consumable':{'animation':'drink'if drink else'eat','consume_seconds':1.6}} + definition={'type':'definition','model':row['model'],'bedrock_identifier':bedrock,'display_name':row['name'],'bedrock_options':{'icon':key,'allow_offhand':True,'creative_category':'items'},'components':components} + mapping['items'].setdefault('minecraft:'+row['material'],[]).append(definition) + textures[key]={'textures':'textures/items/cooking/'+ident} + files['textures/items/cooking/'+ident+'.png']=sprites['assets/dunerealms/textures/item/cooking/'+ident+'.png'] + names.append('item.'+bedrock+'.name='+row['name']) + encode=lambda d:(json.dumps(d,indent=2,ensure_ascii=False)+'\n').encode('utf-8') + packid=str(uuid.uuid5(uuid.NAMESPACE_URL,'https://www.dunerealms.com/packs/cooking-baking-beta/bedrock/v1')) + moduleid=str(uuid.uuid5(uuid.NAMESPACE_URL,'https://www.dunerealms.com/packs/cooking-baking-beta/bedrock/v1/resources')) + files['manifest.json']=encode({'format_version':2,'header':{'name':'DuneRealms Cooking & Baking Beta','description':'Regional food, drink and ingredient artwork. Original DuneRealms pixel art.','uuid':packid,'version':[1,0,0],'min_engine_version':[1,21,0]},'modules':[{'type':'resources','uuid':moduleid,'version':[1,0,0]}]}) + files['textures/item_texture.json']=encode({'resource_pack_name':'dunerealms_cooking_beta','texture_name':'atlas.items','texture_data':textures}) + files['texts/en_US.lang']=('\n'.join(names)+'\n').encode('utf-8') + files['pack_icon.png']=sprites['assets/dunerealms/textures/item/cooking/praline_box.png'] + stone=(source/'network/resource-pack/realistic-stone-family'/STONE).read_bytes() + if digest(stone)!=STONE_SHA:raise ValueError('Unreviewed Bedrock stone override') + files['textures/blocks/stone.png']=stone + pack=write_archive(files);mapping_bytes=encode(mapping) + (output/'DuneRealms-Cooking-Beta-Bedrock-v1.mcpack').write_bytes(pack) + (output/'dunerealms-cooking-beta-v2.json').write_bytes(mapping_bytes) + proof={'items':len(rows),'packUuid':packid,'packSha256':digest(pack),'mappingSha256':digest(mapping_bytes),'entries':{n:digest(b)for n,b in files.items()},'source':'network/content-assets/cookbook/regional-cooking.json'} + (output/'bedrock-cooking-proof.json').write_bytes(encode(proof));return proof + +if __name__=='__main__': + p=argparse.ArgumentParser(description=__doc__);p.add_argument('source',type=Path);p.add_argument('output',type=Path);a=p.parse_args();r=build(a.source,a.output);print(json.dumps({k:v if not isinstance(v,dict)else len(v)for k,v in r.items()})) diff --git a/tools/cooking_beta_artwork.py b/tools/cooking_beta_artwork.py new file mode 100644 index 00000000..24a302be --- /dev/null +++ b/tools/cooking_beta_artwork.py @@ -0,0 +1,54 @@ +"""Append the 99 reviewed cooking sprites; replace only the requested matte stone texture.""" +import argparse,hashlib,json,struct +from pathlib import Path +from plugin_wild_update import read_archive,write_archive,digest + +NETWORK='cb13b75c44d8158f1ec772c76beff14dfe14645ebaa4c30f7b6dba929be946b8' +MENUS={'02ffea4ec37f0e1c6d08581b47ac0b0d7ae2ccc9d4166b72c2e4e04ba03aff7e','149047b7be7068d8dbdc3cc917a8599867acd373d63414f5c47463fd27f26381'} +STONE='assets/minecraft/textures/block/stone.png' +STONE_SHA='7b137ffe5074b7e9ce137cc1a435f157f82dcbbe902c5a491227ee67f9a9845b' + +def artwork(source): + root=source/'network/resource-pack/cooking-beta';overlay=root/'overlay' + rows=json.loads((source/'network/content-assets/cookbook/regional-cooking.json').read_text(encoding='utf-8'))['items'] + hashes=json.loads((root/'artwork-manifest.json').read_text(encoding='utf-8')) + if len(rows)!=99 or len({r['id']for r in rows})!=99:raise ValueError('Expected99 unique authored items') + payload={} + for row in rows: + ident=row['id'];key='cooking/'+ident + if row['model']!='dunerealms:'+key:raise ValueError('Catalogue model mismatch') + item='assets/dunerealms/items/'+key+'.json';model='assets/dunerealms/models/item/'+key+'.json';texture='assets/dunerealms/textures/item/'+key+'.png' + entry={n:(overlay/n).read_bytes()for n in [item,model,texture]} + if json.loads(entry[item])!={'model':{'type':'minecraft:model','model':'dunerealms:item/'+key}}:raise ValueError('Invalid item model '+ident) + if json.loads(entry[model])!={'parent':'minecraft:item/generated','textures':{'layer0':'dunerealms:item/'+key}}:raise ValueError('Invalid texture binding '+ident) + png=entry[texture] + if png[:16]!=b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR' or struct.unpack('>II',png[16:24])!=(32,32)or png[25]!=6:raise ValueError('Expected32px RGBA sprite '+ident) + if digest(png)!=hashes[ident+'.png']['sha256']:raise ValueError('Artwork hash mismatch '+ident) + payload.update(entry) + if {p.relative_to(overlay).as_posix()for p in overlay.rglob('*')if p.is_file()}!=set(payload):raise ValueError('Unreviewed artwork path') + return payload + +def assemble(source,baseline,output,mode): + old=baseline.read_bytes();sha=digest(old) + if mode=='network'and sha!=NETWORK or mode=='menus'and sha not in MENUS:raise ValueError('Unexpected current pack/cache preimage') + base=read_archive(old);prefix='menu-art/pack/'if mode=='menus'else'' + added={prefix+n:b for n,b in artwork(source).items()} + if set(added)&set(base):raise ValueError('Cooking art already present or collision') + stone=(source/'network/resource-pack/realistic-stone-family'/STONE).read_bytes() + if digest(stone)!=STONE_SHA:raise ValueError('Unreviewed stone texture') + key=prefix+STONE + if mode=='network'and key not in base:raise ValueError('Existing stone missing') + final=base|added|{key:stone} + data=write_archive(final) + if output.resolve()==baseline.resolve():raise ValueError('Never overwrite source archive') + output.write_bytes(data) + actual=read_archive(data) + changed={n for n in base if actual[n]!=base[n]} + if changed-{key}or set(base)-set(actual)or set(actual)-set(base)!=set(added)|({key}-set(base)):raise ValueError('Unexpected archive delta') + proof={'baselineSha256':sha,'sha256':digest(data),'sha1':hashlib.sha1(data).hexdigest(),'bytes':len(data),'added':sorted(set(actual)-set(base)),'changed':sorted(changed),'items':99} + output.with_suffix(output.suffix+'.proof.json').write_text(json.dumps(proof,indent=2)+'\n',encoding='utf-8') + return proof + +if __name__=='__main__': + p=argparse.ArgumentParser(description=__doc__);p.add_argument('source',type=Path);p.add_argument('baseline',type=Path);p.add_argument('output',type=Path);p.add_argument('mode',choices=['network','menus']);a=p.parse_args() + r=assemble(a.source,a.baseline,a.output,a.mode);print(json.dumps({k:v if not isinstance(v,list)else len(v)for k,v in r.items()})) diff --git a/tools/plugin_hydration.py b/tools/plugin_hydration.py new file mode 100644 index 00000000..92a3f118 --- /dev/null +++ b/tools/plugin_hydration.py @@ -0,0 +1,28 @@ +"""Deterministic narrow retained Core overlay; baseline, donor and helper must be source-pinned by caller.""" +import argparse,hashlib,os,pathlib,subprocess,tempfile,zipfile +p=argparse.ArgumentParser();p.add_argument('baseline');p.add_argument('baseline_sha');p.add_argument('donor_class');p.add_argument('donor_sha');p.add_argument('output');p.add_argument('asm_classpath');a=p.parse_args() +sha=lambda b:hashlib.sha256(b).hexdigest() +base=pathlib.Path(a.baseline);donor=pathlib.Path(a.donor_class);target=pathlib.Path(a.output) +assert sha(base.read_bytes())==a.baseline_sha,'Retained baseline hash mismatch' +assert sha(donor.read_bytes())==a.donor_sha,'Donor class hash mismatch' +assert base.resolve()!=target.resolve(),'Never overwrite baseline' +java=pathlib.Path(os.environ['JAVA_HOME'])/'bin'/('java.exe'if os.name=='nt'else'java') +helper=pathlib.Path(__file__).with_name('HydrationMerge.java') +with tempfile.TemporaryDirectory()as tmp: + subprocess.run([str(java),'--class-path',a.asm_classpath,str(helper),str(base),tmp],check=True) + prefix='com/example/dunerealms/' + changes={prefix+n:(pathlib.Path(tmp)/n).read_bytes()for n in ['DuneCore.class','SharedDatabase.class']} + addition=prefix+'HydrationProfiles.class' + with zipfile.ZipFile(base)as old: + assert addition not in old.namelist(),'Hydration already installed' + assert len(old.namelist())==len(set(old.namelist())),'Duplicate baseline archive entry' + with zipfile.ZipFile(target,'w',compression=zipfile.ZIP_DEFLATED,compresslevel=9)as new: + for info in old.infolist(): + if info.is_dir():continue + new.writestr(info,changes.get(info.filename,old.read(info))) + z=zipfile.ZipInfo(addition,(2026,1,1,0,0,0));z.compress_type=zipfile.ZIP_DEFLATED;new.writestr(z,donor.read_bytes()) + with zipfile.ZipFile(target)as new,zipfile.ZipFile(base)as old: + previous={i.filename for i in old.infolist()if not i.is_dir()};now=set(new.namelist()) + assert now-previous=={addition}and previous-now==set() + actual={n for n in previous if old.read(n)!=new.read(n)};assert actual==set(changes) +print('OUTPUT_SHA256',sha(target.read_bytes()),'CHANGED',','.join(sorted(changes)),'ADDED',addition) diff --git a/tools/plugin_regional_cooking.py b/tools/plugin_regional_cooking.py new file mode 100644 index 00000000..2ad74fe7 --- /dev/null +++ b/tools/plugin_regional_cooking.py @@ -0,0 +1,69 @@ +"""Build add-only and exact-method overlays for retained regional cooking plugins.""" +import argparse +import os +from pathlib import Path +import subprocess +from tempfile import TemporaryDirectory + +from plugin_golden_path import pinned +from plugin_wild_update import write_archive + +JARVIS = "com/dunerealms/jarvis/" +GUI = "com/dunerealms/gui/" +TERRAIN = "com/example/duneterrain/" +CATALOG = "regional-cooking.json" +ROLES = { + "jarvis": ((JARVIS + "JarvisTranslator", JARVIS + "SurvivalFoodRecipes", JARVIS + "QuestObservations"), ( + JARVIS + "RegionalCooking", JARVIS + "RegionalCraftRemainders", + JARVIS + "RegionalFoodAcquisition", JARVIS + "RegionalFoodItem", + JARVIS + "RegionalFoodStations", JARVIS + "NativeLeafDecay"), (CATALOG,)), + "gui": ((GUI + "OrganisationMenus",), (GUI + "RegionalCookbook",), (CATALOG,)), + "arrakis": ((TERRAIN + "DuneTerrain$PlanetChunkGenerator", TERRAIN + "SpiceDepositProvenance"), (), ()), + "giedi": ((TERRAIN + "PlanetMobs", TERRAIN + "NativePlants"), (), ()), + "kaitain": ((TERRAIN + "PlanetMobs",), (TERRAIN + "KaitainLivestock",), ()), + "arrakis-core": (("com/example/dunerealms/DuneCore",), (), ()), +} + +def slice_donor(archive, role): + changed, families, resources = ROLES[role] + selected = {name + ".class" for name in changed} | set(resources) + for family in families: + selected.add(family + ".class") + selected.update(entry for entry in archive if entry.startswith(family + "$") and entry.endswith(".class")) + return {entry: archive[entry] for entry in sorted(selected)} + +def assemble(role, baseline, baseline_sha, donor, donor_sha, output, classpath): + existing = pinned(baseline, baseline_sha) + compiled = pinned(donor, donor_sha) + selection = slice_donor(compiled, role) + changed = {name + ".class" for name in ROLES[role][0]} + additions = selection.keys() - changed + if existing.keys() & additions: + raise ValueError("An additive cooking entry already exists in the retained archive") + helper = Path(__file__).with_name("RegionalCookingMerge.java") + with TemporaryDirectory() as temporary: + root = Path(temporary) + classes = root / "helper" + classes.mkdir() + subprocess.run(["javac", "-cp", classpath, "-d", str(classes), str(helper)], check=True) + for entry in sorted(changed): + old, new, result = root / "old.class", root / "donor.class", root / f"changed-{role}.class" + old.write_bytes(existing[entry]) + new.write_bytes(selection[entry]) + subprocess.run(["java", "-cp", f"{classes}{os.pathsep}{classpath}", "RegionalCookingMerge", + str(old), str(new), str(result)], check=True) + existing[entry] = result.read_bytes() + existing.update({entry: selection[entry] for entry in additions}) + with output.open("xb") as target: + target.write(write_archive(existing)) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("role", choices=ROLES) + parser.add_argument("baseline", type=Path) + parser.add_argument("baseline_sha") + parser.add_argument("donor", type=Path) + parser.add_argument("donor_sha") + parser.add_argument("output", type=Path) + parser.add_argument("classpath") + assemble(**vars(parser.parse_args())) diff --git a/tools/test_cooking_bedrock.py b/tools/test_cooking_bedrock.py new file mode 100644 index 00000000..31fc35a6 --- /dev/null +++ b/tools/test_cooking_bedrock.py @@ -0,0 +1,27 @@ +import json,sys,tempfile,unittest,zipfile +from pathlib import Path +sys.path.insert(0,str(Path(__file__).resolve().parent)) +import build_cooking_bedrock as b +ROOT=Path(__file__).resolve().parents[1] + +class BedrockCookingTest(unittest.TestCase): + def test_all99_model_and_food_contracts_match_native_and_pack(self): + rows=json.loads((ROOT/'network/content-assets/cookbook/regional-cooking.json').read_text())['items'] + with tempfile.TemporaryDirectory()as tmp: + out=Path(tmp);proof=b.build(ROOT,out);mapping=json.loads((out/'dunerealms-cooking-beta-v2.json').read_bytes());defs=[d for group in mapping['items'].values()for d in group] + self.assertEqual(len(defs),99);self.assertEqual(len({d['bedrock_identifier']for d in defs}),99) + self.assertEqual(len({d['model']for d in defs}),99) + with zipfile.ZipFile(out/'DuneRealms-Cooking-Beta-Bedrock-v1.mcpack')as z: + textures=json.loads(z.read('textures/item_texture.json'))['texture_data'];manifest=json.loads(z.read('manifest.json')) + self.assertNotEqual(manifest['header']['uuid'],manifest['modules'][0]['uuid']) + self.assertEqual(len(textures),99) + for row in rows: + d=next(x for x in defs if x['model']==row['model']);key=d['bedrock_options']['icon'];self.assertIn(textures[key]['textures']+'.png',z.namelist()) + self.assertIn(d,mapping['items']['minecraft:'+row['material']]) + if row['kind']=='resource':self.assertEqual(d['components'],{'!minecraft:food':{},'!minecraft:consumable':{}}) + else: + self.assertEqual(d['components']['minecraft:food']['nutrition'],row['nutrition']);self.assertEqual(d['components']['minecraft:food']['saturation'],row['saturation']) + drink=row['kind']=='drink'or bool(row.get('alcohol'));self.assertEqual(d['components']['minecraft:food']['can_always_eat'],drink) + first=(out/'DuneRealms-Cooking-Beta-Bedrock-v1.mcpack').read_bytes();b.build(ROOT,out);self.assertEqual(first,(out/'DuneRealms-Cooking-Beta-Bedrock-v1.mcpack').read_bytes()) + +if __name__=='__main__':unittest.main() diff --git a/tools/test_cooking_beta_artwork.py b/tools/test_cooking_beta_artwork.py new file mode 100644 index 00000000..9ab5e765 --- /dev/null +++ b/tools/test_cooking_beta_artwork.py @@ -0,0 +1,31 @@ +import json,sys,tempfile,unittest,shutil +from pathlib import Path +sys.path.insert(0,str(Path(__file__).resolve().parent)) +import cooking_beta_artwork as art +ROOT=Path(__file__).resolve().parents[1] + +class CookingArtworkTest(unittest.TestCase): + def test_all99_authored_icons_have_closed_models_and_source_hashes(self): + files=art.artwork(ROOT) + self.assertEqual(len(files),297) + self.assertEqual(sum(n.endswith('.png')for n in files),99) + self.assertEqual(len({b for n,b in files.items()if n.endswith('.png')}),99) + self.assertTrue(all(n.startswith('assets/dunerealms/')and'/cooking/'in n for n in files)) + def test_unknown_preimage_cannot_be_overwritten(self): + with tempfile.TemporaryDirectory()as tmp: + base=Path(tmp)/'old';base.write_bytes(b'wrong pack');out=Path(tmp)/'new' + with self.assertRaisesRegex(ValueError,'preimage'):art.assemble(ROOT,base,out,'network') + self.assertEqual(base.read_bytes(),b'wrong pack');self.assertFalse(out.exists()) + def test_missing_or_unreviewed_texture_is_rejected(self): + with tempfile.TemporaryDirectory()as tmp: + root=Path(tmp);artRoot=root/'network/resource-pack/cooking-beta';source=ROOT/'network/resource-pack/cooking-beta' + shutil.copytree(source,artRoot) + dst=root/'network/content-assets/cookbook';dst.mkdir(parents=True) + shutil.copyfile(ROOT/'network/content-assets/cookbook/regional-cooking.json',dst/'regional-cooking.json') + png=artRoot/'overlay/assets/dunerealms/textures/item/cooking/pork_mince.png' + data=png.read_bytes();png.write_bytes(data+b'unreviewed') + with self.assertRaisesRegex(ValueError,'hash mismatch'):art.artwork(root) + png.unlink() + with self.assertRaises(FileNotFoundError):art.artwork(root) + +if __name__=='__main__':unittest.main()