feat(anotherworld): ajouter le coffre-fort joueur 3 × 3 #16

Merged
koka merged 1 commits from feature/safe-vault into main 2026-08-27 11:51:01 +00:00
29 changed files with 1252 additions and 38 deletions
+12
View File
@@ -6,6 +6,18 @@ Ce journal suit les **versions du modpack**. Lorsqu'un seul module change, sa ve
- Depuis `26.2.0-alpha.6`, le pack et les modules ont des versions indépendantes. I Like To Move It et Only Fun deviennent les cinquième et sixième modules actifs dans l'alpha 46.
- Les versions ci-dessous ont été reconstituées à partir des JAR archivés, des packs locaux et du code source actuel. Les dates n'étant pas enregistrées de manière fiable, elles ne sont pas inventées.
## En développement — coffre-fort 3 × 3
Modules modifiés : **Another World `0.0.0-alpha.50`** et **Sanctuary `0.0.0-alpha.117`**. Le pack distribué reste en `26.2.0-alpha.201` jusqu’à la préparation dune release dédiée.
- ajoute `anotherworld:safe_block`, crafté avec huit blocs dor autour dun coffre, et active un unique coffre-fort par joueur lorsque neuf blocs du même propriétaire forment un carré horizontal exact de 3 × 3 ;
- conserve 27 emplacements globaux pour rubis, saphirs et émeraudes sous la clé versionnée `anotherworld_safe_vaults`, ce qui garde le solde accessible au Shop lorsque le chunk de la structure est déchargé ;
- expose dans Sanctuary une API publique de fournisseurs de monnaie et relie explicitement `Another World → Sanctuary` dans Gradle et Fabric, sans cycle ni copie des règles du Shop ;
- ajoute `anotherworld:titanium_drill` avec la texture 16×16 fournie et une recette en titane, redstone, piston, blocs de fer et pioche en diamant ;
- impose un forage serveur continu de 60 secondes sur un coffre ennemi dont le propriétaire est connecté, alerte celui-ci, consomme la foreuse en cas de réussite et transfère 20 % des gemmes au pillard ;
- protège le coffre pendant 24 heures après un pillage réussi, bloque les attaques concurrentes et interdit la casse par un tiers ou le démontage dun coffre rempli ;
- porte les données Another World de v1 à v2 pour la nouvelle sauvegarde, sans changer les protocoles Another World 1 et Sanctuary 21 ni exiger de réinitialisation du monde.
## `26.2.0-alpha.201`
Module modifié : **Sanctuary `0.0.0-alpha.116`**. Les neuf autres modules conservent leur version issue de lalpha.200.
+3 -1
View File
@@ -22,7 +22,9 @@ Licence : **GNU GPL 3.0 or Later** (`GPL-3.0-or-later`)
Les descriptions FR/EN/RU sont déclarées dans chaque `fabric.mod.json` et dans les fichiers de langue. Les images fournies servent d'icônes Fabric de leur module.
Version courante du pack local : **`26.2.0-alpha.201`**. Sanctuary passe en **`0.0.0-alpha.116`** ; les neuf autres modules conservent leur version de lalpha.200.
Version courante du pack distribué : **`26.2.0-alpha.201`**. Le développement du coffre-fort porte Another World en **`0.0.0-alpha.50`** et Sanctuary en **`0.0.0-alpha.117`** sans republier encore le pack.
Le coffre-fort joueur utilise neuf blocs Another World disposés horizontalement en 3 × 3. Il accepte rubis, saphirs et émeraudes dans 27 emplacements liés au joueur et les rend disponibles aux transactions du Shop même lorsque la structure est déchargée. Une foreuse en titane maintenue pendant 60 secondes permet de piller 20 % du contenu dun propriétaire connecté, qui reçoit immédiatement une alerte ; une réussite consomme la foreuse et protège ensuite le coffre pendant 24 heures.
Lalpha.201 rend les demandes communautaires réellement terminables. Le demandeur dépose la récompense lors de la publication, le preneur confirme sans commande après avoir lu les détails, KILL progresse automatiquement, BRING livre les objets au demandeur et PAY est confirmé par le joueur désigné. La récompense séquestrée est ensuite expédiée une seule fois dans la Mailbox du preneur. Le pseudonyme conserve la couleur du joueur et le panneau rose adopte une palette plus claire et poudrée.
+125 -14
View File
@@ -7,6 +7,18 @@ def generatedResources = layout.buildDirectory.dir("generated/resources")
sourceSets.main.resources.srcDir(generatedResources)
tasks.register("vaultRulesSmoke", JavaExec) {
group = "verification"
description = "Checks the 3x3 vault, one-minute raid, 20% loot and 24-hour protection rules."
dependsOn tasks.named("testClasses")
classpath = sourceSets.test.runtimeClasspath
mainClass = "fr.koka99cab.sanctuary26.anotherworld.vault.VaultRulesSmoke"
}
tasks.named("test") {
failOnNoDiscoveredTests = false
}
tasks.register("generateAnotherWorldResources") {
group = "build"
description = "Generates the reproducible Another World 26.2 material catalog."
@@ -165,6 +177,29 @@ tasks.register("generateAnotherWorldResources") {
// Mirror, creative-only rainbow blocks, gems and first-pass metal art.
simpleBlock("mirror", "minecraft:block/cube_all", "anotherworld:block/mirror_glass")
writeJson("assets/anotherworld/blockstates/safe_block.json", [variants: [
"facing=north": [model: "anotherworld:block/safe_block"],
"facing=east": [model: "anotherworld:block/safe_block", y: 90],
"facing=south": [model: "anotherworld:block/safe_block", y: 180],
"facing=west": [model: "anotherworld:block/safe_block", y: 270]
]])
writeJson("assets/anotherworld/models/block/safe_block.json", [
parent: "minecraft:block/cube",
textures: [
particle: "anotherworld:block/safe_vault/front",
down: "anotherworld:block/safe_vault/bottom",
up: "anotherworld:block/safe_vault/top",
north: "anotherworld:block/safe_vault/front",
south: "anotherworld:block/safe_vault/side",
west: "anotherworld:block/safe_vault/side",
east: "anotherworld:block/safe_vault/side"
]
])
writeJson("assets/anotherworld/models/item/safe_block.json", [
parent: "minecraft:item/generated", textures: [layer0: "anotherworld:item/safe_block"]
])
writeJson("assets/anotherworld/items/safe_block.json", modelItem("anotherworld:item/safe_block"))
selfLoot("safe_block")
simpleBlock("black_sand", "minecraft:block/cube_all", "anotherworld:block/black_sand")
def rainbowColors = ["white", "light_gray", "gray", "black", "brown", "red", "orange", "yellow", "lime", "green", "cyan", "light_blue", "blue", "purple", "magenta", "pink"]
rainbowColors.each { color ->
@@ -215,6 +250,7 @@ tasks.register("generateAnotherWorldResources") {
titanium_nugget: "anotherworld:item/titanium_nugget"
].each { path, texture -> standaloneItem(path, texture) }
standaloneItem("golden_egg", "anotherworld:item/golden_egg")
standaloneItem("titanium_drill", "anotherworld:item/titanium_drill")
// Lootbox-only titanium uniques: diamond-grade properties, 7.5 mining speed and unbreakable.
def titaniumEquipment = [
@@ -431,6 +467,12 @@ tasks.register("generateAnotherWorldResources") {
standaloneItem("${family}_${part}", "anotherworld:item/${family}_${part}")
}
}
shaped("safe_block", "building", ["GGG", "GCG", "GGG"],
[G: "minecraft:gold_block", C: "minecraft:chest"], "anotherworld:safe_block")
shaped("titanium_drill", "equipment", ["TTT", "RPR", "FDF"], [
T: "anotherworld:titanium_ingot", R: "minecraft:redstone", P: "minecraft:piston",
F: "minecraft:iron_block", D: "minecraft:diamond_pickaxe"
], "anotherworld:titanium_drill")
// The five full mossy-wood blocks persist four visual growth stages.
def mossModel = { String base, int level -> level == 0 ? base : "${base}_moss_${level}" }
@@ -652,7 +694,7 @@ tasks.register("generateAnotherWorldResources") {
tag("item", "minecraft", "stairs", coloredBrickStairs)
tag("block", "minecraft", "slabs", coloredBrickSlabs)
tag("item", "minecraft", "slabs", coloredBrickSlabs)
def pickaxe = ["anotherworld:mirror", "anotherworld:ruby_ore", "anotherworld:deepslate_ruby_ore", "anotherworld:ruby_block", "anotherworld:sapphire_ore", "anotherworld:deepslate_sapphire_ore", "anotherworld:sapphire_block", "anotherworld:deepslate_silver_ore", "anotherworld:raw_silver_block", "anotherworld:silver_block", "anotherworld:deepslate_titanium_ore", "anotherworld:raw_titanium_block", "anotherworld:titanium_block"]
def pickaxe = ["anotherworld:mirror", "anotherworld:safe_block", "anotherworld:ruby_ore", "anotherworld:deepslate_ruby_ore", "anotherworld:ruby_block", "anotherworld:sapphire_ore", "anotherworld:deepslate_sapphire_ore", "anotherworld:sapphire_block", "anotherworld:deepslate_silver_ore", "anotherworld:raw_silver_block", "anotherworld:silver_block", "anotherworld:deepslate_titanium_ore", "anotherworld:raw_titanium_block", "anotherworld:titanium_block"]
pickaxe.addAll(coloredBricks)
pickaxe.addAll(coloredBrickStairs)
pickaxe.addAll(coloredBrickSlabs)
@@ -660,7 +702,7 @@ tasks.register("generateAnotherWorldResources") {
tag("block", "minecraft", "mineable/shovel", coloredClay + ["anotherworld:black_sand"])
tag("block", "minecraft", "mineable/hoe", coloredLeaves + flowerBlocks + ["anotherworld:turquoise_moss", "anotherworld:giant_flower_stem", "anotherworld:giant_flower_pistil"])
tag("block", "minecraft", "needs_iron_tool", ["anotherworld:ruby_ore", "anotherworld:deepslate_ruby_ore", "anotherworld:ruby_block", "anotherworld:raw_silver_block", "anotherworld:silver_block"])
tag("block", "minecraft", "needs_diamond_tool", ["anotherworld:sapphire_ore", "anotherworld:deepslate_sapphire_ore", "anotherworld:sapphire_block", "anotherworld:deepslate_silver_ore", "anotherworld:deepslate_titanium_ore", "anotherworld:raw_titanium_block", "anotherworld:titanium_block"])
tag("block", "minecraft", "needs_diamond_tool", ["anotherworld:safe_block", "anotherworld:sapphire_ore", "anotherworld:deepslate_sapphire_ore", "anotherworld:sapphire_block", "anotherworld:deepslate_silver_ore", "anotherworld:deepslate_titanium_ore", "anotherworld:raw_titanium_block", "anotherworld:titanium_block"])
[
"gems/ruby": ["anotherworld:ruby"], "gems/sapphire": ["anotherworld:sapphire"],
"raw_materials/silver": ["anotherworld:raw_silver"], "ingots/silver": ["anotherworld:silver_ingot"], "nuggets/silver": ["anotherworld:silver_nugget"],
@@ -1452,13 +1494,13 @@ tasks.register("generateAnotherWorldResources") {
def languageEntries = [
en_us: [
description: "Owns the material things that make up the world.", tab: "Another World",
mirror: "Mirror", black_sand: "Black Sand", ruby_ore: "Ruby Ore", deepslate_ruby_ore: "Deepslate Ruby Ore", ruby_block: "Block of Ruby",
mirror: "Mirror", safe_block: "Safe Block", black_sand: "Black Sand", ruby_ore: "Ruby Ore", deepslate_ruby_ore: "Deepslate Ruby Ore", ruby_block: "Block of Ruby",
sapphire_ore: "Sapphire Ore", deepslate_sapphire_ore: "Deepslate Sapphire Ore", sapphire_block: "Block of Sapphire",
deepslate_silver_ore: "Deepslate Silver Ore", raw_silver_block: "Block of Raw Silver", silver_block: "Block of Silver",
deepslate_titanium_ore: "Deepslate Titanium Ore", raw_titanium_block: "Block of Raw Titanium", titanium_block: "Block of Titanium",
ruby: "Ruby", sapphire: "Sapphire", raw_silver: "Raw Silver", silver_ingot: "Silver Ingot", silver_nugget: "Silver Nugget",
silver_rod: "Silver Rod", silver_plate: "Silver Plate", silver_gear: "Silver Gear", aircraft_cockpit: "Aircraft Cockpit",
raw_titanium: "Raw Titanium", titanium_ingot: "Titanium Ingot", titanium_nugget: "Titanium Nugget", golden_egg: "Golden Egg",
raw_titanium: "Raw Titanium", titanium_ingot: "Titanium Ingot", titanium_nugget: "Titanium Nugget", titanium_drill: "Titanium Drill", golden_egg: "Golden Egg",
titanium_sword: "Titanium Sword", titanium_shovel: "Titanium Shovel", titanium_pickaxe: "Titanium Pickaxe", titanium_axe: "Titanium Axe",
titanium_hoe: "Titanium Hoe", titanium_spear: "Titanium Spear", titanium_shears: "Titanium Shears",
titanium_helmet: "Titanium Helmet", titanium_chestplate: "Titanium Chestplate", titanium_leggings: "Titanium Leggings", titanium_boots: "Titanium Boots",
@@ -1469,13 +1511,13 @@ tasks.register("generateAnotherWorldResources") {
],
fr_fr: [
description: "Possède les choses matérielles qui composent le monde.", tab: "Another World",
mirror: "Miroir", black_sand: "Sable noir", ruby_ore: "Minerai de rubis", deepslate_ruby_ore: "Minerai de rubis des abîmes", ruby_block: "Bloc de rubis",
mirror: "Miroir", safe_block: "Bloc de coffre-fort", black_sand: "Sable noir", ruby_ore: "Minerai de rubis", deepslate_ruby_ore: "Minerai de rubis des abîmes", ruby_block: "Bloc de rubis",
sapphire_ore: "Minerai de saphir", deepslate_sapphire_ore: "Minerai de saphir des abîmes", sapphire_block: "Bloc de saphir",
deepslate_silver_ore: "Minerai dargent des abîmes", raw_silver_block: "Bloc dargent brut", silver_block: "Bloc dargent",
deepslate_titanium_ore: "Minerai de titane des abîmes", raw_titanium_block: "Bloc de titane brut", titanium_block: "Bloc de titane",
ruby: "Rubis", sapphire: "Saphir", raw_silver: "Argent brut", silver_ingot: "Lingot dargent", silver_nugget: "Pépite dargent",
silver_rod: "Tige dargent", silver_plate: "Plaque dargent", silver_gear: "Engrenage dargent", aircraft_cockpit: "Cockpit davion",
raw_titanium: "Titane brut", titanium_ingot: "Lingot de titane", titanium_nugget: "Pépite de titane", golden_egg: "Œuf doré",
raw_titanium: "Titane brut", titanium_ingot: "Lingot de titane", titanium_nugget: "Pépite de titane", titanium_drill: "Foreuse en titane", golden_egg: "Œuf doré",
titanium_sword: "Épée en titane", titanium_shovel: "Pelle en titane", titanium_pickaxe: "Pioche en titane", titanium_axe: "Hache en titane",
titanium_hoe: "Houe en titane", titanium_spear: "Lance en titane", titanium_shears: "Cisailles en titane",
titanium_helmet: "Casque en titane", titanium_chestplate: "Plastron en titane", titanium_leggings: "Jambières en titane", titanium_boots: "Bottes en titane",
@@ -1486,13 +1528,13 @@ tasks.register("generateAnotherWorldResources") {
],
ru_ru: [
description: "Содержит материальные элементы, из которых состоит мир.", tab: "Another World",
mirror: "Зеркало", black_sand: "Чёрный песок", ruby_ore: "Рубиновая руда", deepslate_ruby_ore: "Рубиноносный глубинный сланец", ruby_block: "Рубиновый блок",
mirror: "Зеркало", safe_block: "Блок сейфа", black_sand: "Чёрный песок", ruby_ore: "Рубиновая руда", deepslate_ruby_ore: "Рубиноносный глубинный сланец", ruby_block: "Рубиновый блок",
sapphire_ore: "Сапфировая руда", deepslate_sapphire_ore: "Сапфироносный глубинный сланец", sapphire_block: "Сапфировый блок",
deepslate_silver_ore: "Сереброносный глубинный сланец", raw_silver_block: "Блок необработанного серебра", silver_block: "Серебряный блок",
deepslate_titanium_ore: "Титаноносный глубинный сланец", raw_titanium_block: "Блок необработанного титана", titanium_block: "Титановый блок",
ruby: "Рубин", sapphire: "Сапфир", raw_silver: "Необработанное серебро", silver_ingot: "Серебряный слиток", silver_nugget: "Кусочек серебра",
silver_rod: "Серебряный стержень", silver_plate: "Серебряная пластина", silver_gear: "Серебряная шестерня", aircraft_cockpit: "Кабина самолёта",
raw_titanium: "Необработанный титан", titanium_ingot: "Титановый слиток", titanium_nugget: "Кусочек титана", golden_egg: "Золотое яйцо",
raw_titanium: "Необработанный титан", titanium_ingot: "Титановый слиток", titanium_nugget: "Кусочек титана", titanium_drill: "Титановая дрель", golden_egg: "Золотое яйцо",
titanium_sword: "Титановый меч", titanium_shovel: "Титановая лопата", titanium_pickaxe: "Титановая кирка", titanium_axe: "Титановый топор",
titanium_hoe: "Титановая мотыга", titanium_spear: "Титановое копьё", titanium_shears: "Титановые ножницы",
titanium_helmet: "Титановый шлем", titanium_chestplate: "Титановый нагрудник", titanium_leggings: "Титановые поножи", titanium_boots: "Титановые ботинки",
@@ -1548,6 +1590,74 @@ tasks.register("generateAnotherWorldResources") {
lang["options.miroir.reflection.tooltip"] = locale == "fr_fr"
? "Dose le mélange entre métal sombre et couleur réfléchie."
: locale == "ru_ru" ? "Настраивает смешивание тёмного металла и отражённого цвета." : "Blends dark metal with the reflected color."
def vaultText = locale == "fr_fr" ? [
"container.anotherworld.safe_vault": "Coffre-fort",
"tooltip.anotherworld.titanium_drill.use": "Maintenir sur un coffre-fort ennemi pour le forer.",
"tooltip.anotherworld.titanium_drill.consumed": "Consommée après un pillage réussi.",
"message.anotherworld.safe_vault.incomplete": "Le coffre-fort exige exactement 9 blocs appartenant au même joueur, posés en 3 × 3.",
"message.anotherworld.safe_vault.locked": "Ce coffre-fort appartient à un autre joueur.",
"message.anotherworld.safe_vault.formed": "Coffre-fort 3 × 3 lié à vous en %s, %s, %s.",
"message.anotherworld.safe_vault.already_owned": "Vous possédez déjà un coffre-fort actif.",
"message.anotherworld.safe_vault.break_not_owner": "Seul le propriétaire peut démonter ce bloc de coffre-fort.",
"message.anotherworld.safe_vault.empty_before_break": "Videz le coffre-fort et attendez la fin du forage avant de le démonter.",
"message.anotherworld.safe_vault.drill_own": "Vous ne pouvez pas forer votre propre coffre-fort.",
"message.anotherworld.safe_vault.inactive": "Ce coffre-fort nest pas actif.",
"message.anotherworld.safe_vault.empty": "Ce coffre-fort est vide.",
"message.anotherworld.safe_vault.owner_offline": "Le propriétaire doit être connecté pour que le coffre-fort soit attaquable.",
"message.anotherworld.safe_vault.protected": "Ce coffre-fort reste protégé pendant environ %s minute(s).",
"message.anotherworld.safe_vault.already_drilling": "Une autre foreuse attaque déjà ce coffre-fort.",
"message.anotherworld.safe_vault.alarm": "ALERTE : %s fore votre coffre-fort en %s, %s, %s !",
"message.anotherworld.safe_vault.drilling_started": "Forage lancé : gardez la foreuse dirigée vers la structure pendant 60 secondes.",
"message.anotherworld.safe_vault.drilling_progress": "Forage : %s %%",
"message.anotherworld.safe_vault.drilling_cancelled": "Forage interrompu.",
"message.anotherworld.safe_vault.raided_owner": "%s a pillé %s gemme(s) dans votre coffre-fort.",
"message.anotherworld.safe_vault.raided": "Pillage réussi : %s gemme(s) récupérée(s)."
] : locale == "ru_ru" ? [
"container.anotherworld.safe_vault": "Сейф",
"tooltip.anotherworld.titanium_drill.use": "Удерживайте на чужом сейфе, чтобы просверлить его.",
"tooltip.anotherworld.titanium_drill.consumed": "Расходуется после успешного ограбления.",
"message.anotherworld.safe_vault.incomplete": "Сейф требует ровно 9 блоков одного владельца, уложенных 3 × 3.",
"message.anotherworld.safe_vault.locked": "Этот сейф принадлежит другому игроку.",
"message.anotherworld.safe_vault.formed": "Сейф 3 × 3 привязан к вам в точке %s, %s, %s.",
"message.anotherworld.safe_vault.already_owned": "У вас уже есть активный сейф.",
"message.anotherworld.safe_vault.break_not_owner": "Разобрать этот блок может только владелец.",
"message.anotherworld.safe_vault.empty_before_break": "Опустошите сейф и дождитесь окончания сверления перед разборкой.",
"message.anotherworld.safe_vault.drill_own": "Нельзя сверлить собственный сейф.",
"message.anotherworld.safe_vault.inactive": "Этот сейф не активен.",
"message.anotherworld.safe_vault.empty": "Этот сейф пуст.",
"message.anotherworld.safe_vault.owner_offline": "Владелец должен быть в сети, чтобы атаковать сейф.",
"message.anotherworld.safe_vault.protected": "Сейф защищён ещё примерно %s минут(ы).",
"message.anotherworld.safe_vault.already_drilling": "Этот сейф уже сверлит другой игрок.",
"message.anotherworld.safe_vault.alarm": "ТРЕВОГА: %s сверлит ваш сейф в точке %s, %s, %s!",
"message.anotherworld.safe_vault.drilling_started": "Сверление началось: держите дрель наведённой 60 секунд.",
"message.anotherworld.safe_vault.drilling_progress": "Сверление: %s %%",
"message.anotherworld.safe_vault.drilling_cancelled": "Сверление прервано.",
"message.anotherworld.safe_vault.raided_owner": "%s похитил(а) %s драгоценностей из вашего сейфа.",
"message.anotherworld.safe_vault.raided": "Ограбление удалось: получено %s драгоценностей."
] : [
"container.anotherworld.safe_vault": "Safe",
"tooltip.anotherworld.titanium_drill.use": "Hold on an enemy safe to drill it.",
"tooltip.anotherworld.titanium_drill.consumed": "Consumed after a successful raid.",
"message.anotherworld.safe_vault.incomplete": "A safe requires exactly 9 blocks owned by one player in a 3 × 3 square.",
"message.anotherworld.safe_vault.locked": "This safe belongs to another player.",
"message.anotherworld.safe_vault.formed": "3 × 3 safe linked to you at %s, %s, %s.",
"message.anotherworld.safe_vault.already_owned": "You already own an active safe.",
"message.anotherworld.safe_vault.break_not_owner": "Only the owner may dismantle this safe block.",
"message.anotherworld.safe_vault.empty_before_break": "Empty the safe and wait for drilling to end before dismantling it.",
"message.anotherworld.safe_vault.drill_own": "You cannot drill your own safe.",
"message.anotherworld.safe_vault.inactive": "This safe is not active.",
"message.anotherworld.safe_vault.empty": "This safe is empty.",
"message.anotherworld.safe_vault.owner_offline": "The owner must be online before the safe can be raided.",
"message.anotherworld.safe_vault.protected": "This safe remains protected for about %s minute(s).",
"message.anotherworld.safe_vault.already_drilling": "Another drill is already attacking this safe.",
"message.anotherworld.safe_vault.alarm": "ALARM: %s is drilling your safe at %s, %s, %s!",
"message.anotherworld.safe_vault.drilling_started": "Drilling started: keep aiming at the structure for 60 seconds.",
"message.anotherworld.safe_vault.drilling_progress": "Drilling: %s %%",
"message.anotherworld.safe_vault.drilling_cancelled": "Drilling interrupted.",
"message.anotherworld.safe_vault.raided_owner": "%s stole %s gem item(s) from your safe.",
"message.anotherworld.safe_vault.raided": "Raid successful: recovered %s gem item(s)."
]
lang.putAll(vaultText)
def tagTranslations = locale == "fr_fr" ? [
"tag.item.anotherworld.lavender_logs": "Bûches de lavande", "tag.item.anotherworld.ebony_logs": "Bûches d’ébène", "tag.item.anotherworld.mossy_logs": "Bûches moussues", "tag.item.anotherworld.blueberry_logs": "Bûches de myrtille",
"tag.item.anotherworld.colored_bricks": "Blocs de briques colorées", "tag.item.anotherworld.colored_brick_items": "Briques colorées", "tag.item.anotherworld.colored_clay": "Argiles colorées", "tag.item.anotherworld.colored_clay_balls": "Boules dargile colorées", "tag.item.anotherworld.colored_flower_blocks": "Blocs de fleurs colorés", "tag.item.anotherworld.colored_leaves": "Feuilles colorées",
@@ -1574,7 +1684,7 @@ tasks.register("generateAnotherWorldResources") {
names.findAll { key, ignored -> !(key in ["description", "tab"]) }.each { path, name ->
def registry = path in (["ruby", "sapphire", "raw_silver", "silver_ingot", "silver_nugget",
"silver_rod", "silver_plate", "silver_gear", "aircraft_cockpit",
"raw_titanium", "titanium_ingot", "titanium_nugget", "golden_egg"] + titaniumEquipment) ? "item" : "block"
"raw_titanium", "titanium_ingot", "titanium_nugget", "titanium_drill", "golden_egg"] + titaniumEquipment) ? "item" : "block"
lang["${registry}.anotherworld.${path}"] = name
}
rainbowColors.each { color ->
@@ -1656,7 +1766,7 @@ tasks.named("sourcesJar") {
tasks.register("verifyAnotherWorldCatalog") {
group = "verification"
description = "Checks the Another World alpha.49 catalog and climate-aware biome mixer."
description = "Checks the Another World alpha.50 catalog, player vault and climate-aware biome mixer."
dependsOn tasks.named("generateAnotherWorldResources")
inputs.file(file("src/main/resources/data/anotherworld/sanctuary_biome_catalog.json"))
inputs.file(rootProject.file("sanctuary/src/main/resources/data/sanctuary/worldgen/noise_settings/sanctuary.json"))
@@ -1794,7 +1904,7 @@ tasks.register("verifyAnotherWorldCatalog") {
"src/main/resources/assets/redstoner/textures/item/weather_gauge.png",
"src/main/resources/data/redstoner/recipe/weather_gauge.json"
]
if (project.version.toString() != "0.0.0-alpha.49"
if (project.version.toString() != "0.0.0-alpha.50"
|| sulfurMigration.target?.modules?.anotherworld != "0.0.0-alpha.44"
|| sulfurMigration.sulfur_caves?.sanctuary?.dripstone_cell_period != 2
|| !javaText.contains('Identifier.parse("sanctuary:sulfur_caves")')
@@ -2217,7 +2327,7 @@ tasks.register("verifyAnotherWorldCatalog") {
def parts = ["planks", "log", "wood", "stripped_log", "stripped_wood", "leaves", "sapling", "stairs", "slab", "fence", "fence_gate", "door", "trapdoor", "pressure_plate", "button"]
def signParts = ["sign", "wall_sign", "hanging_sign", "wall_hanging_sign"]
def blocks = [
"mirror", "black_sand", "ruby_ore", "deepslate_ruby_ore", "ruby_block", "sapphire_ore", "deepslate_sapphire_ore", "sapphire_block",
"mirror", "safe_block", "black_sand", "ruby_ore", "deepslate_ruby_ore", "ruby_block", "sapphire_ore", "deepslate_sapphire_ore", "sapphire_block",
"deepslate_silver_ore", "raw_silver_block", "silver_block", "deepslate_titanium_ore", "raw_titanium_block", "titanium_block",
"lavender", "pale_lavender", "pink_lavender", "blue_lavender", "dusk_lavender", "hibiscus", "narcissus", "green_bell_mushroom", "brown_shelf_mushroom", "rose", "blue_rose",
"turquoise_moss", "giant_flower_stem", "giant_flower_pistil"
@@ -2238,7 +2348,7 @@ tasks.register("verifyAnotherWorldCatalog") {
"titanium_spear", "titanium_shears", "titanium_helmet", "titanium_chestplate",
"titanium_leggings", "titanium_boots"
]
def standaloneItems = ["ruby", "sapphire", "raw_silver", "silver_ingot", "silver_nugget", "silver_rod", "silver_plate", "silver_gear", "aircraft_cockpit", "raw_titanium", "titanium_ingot", "titanium_nugget", "golden_egg"] + titaniumEquipmentIds
def standaloneItems = ["ruby", "sapphire", "raw_silver", "silver_ingot", "silver_nugget", "silver_rod", "silver_plate", "silver_gear", "aircraft_cockpit", "raw_titanium", "titanium_ingot", "titanium_nugget", "titanium_drill", "golden_egg"] + titaniumEquipmentIds
standaloneItems.addAll(colors.collect { "${it}_brick" })
standaloneItems.addAll(colors.collect { "${it}_clay_ball" })
standaloneItems.addAll(woodFamilies.collectMany { family -> ["${family}_boat", "${family}_chest_boat"] })
@@ -3098,6 +3208,7 @@ tasks.register("verifyAnotherWorldCatalog") {
tasks.named("check") {
dependsOn tasks.named("verifyAnotherWorldCatalog")
dependsOn tasks.named("vaultRulesSmoke")
}
tasks.register("verifyClimateBiomeMixer") {
@@ -3110,7 +3221,7 @@ tasks.register("verifyClimateBiomeMixer") {
"pack/migrations/26.2.0-alpha.188-beta-climate-provinces-to-alpha.189.json"))
def mixer = file(
"src/main/java/fr/koka99cab/sanctuary26/anotherworld/mixin/MultiNoiseBiomeSourceParameterListPresetMixin.java").text
if (project.version.toString() != "0.0.0-alpha.49"
if (project.version.toString() != "0.0.0-alpha.50"
|| migration.source?.pack_version != "26.2.0-alpha.188"
|| migration.target?.pack_version != "26.2.0-alpha.189"
|| migration.target?.modules?.anotherworld != "0.0.0-alpha.48"
@@ -4,6 +4,7 @@ import fr.koka99cab.canon.CanonMod;
import fr.koka99cab.sanctuary26.anotherworld.item.WeatherCompassItem;
import fr.koka99cab.sanctuary26.anotherworld.network.AnotherWorldNetworking;
import fr.koka99cab.sanctuary26.anotherworld.registry.AnotherWorldRegistries;
import fr.koka99cab.sanctuary26.anotherworld.vault.VaultService;
import net.fabricmc.api.ModInitializer;
import net.minecraft.resources.Identifier;
import org.slf4j.Logger;
@@ -12,7 +13,7 @@ import org.slf4j.LoggerFactory;
public final class AnotherWorldMod implements ModInitializer {
public static final String MOD_ID = "anotherworld";
public static final String DISPLAY_NAME = "Another World";
public static final int CURRENT_DATA_VERSION = 1;
public static final int CURRENT_DATA_VERSION = 2;
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public AnotherWorldMod() {
@@ -25,6 +26,7 @@ public final class AnotherWorldMod implements ModInitializer {
@Override
public void onInitialize() {
AnotherWorldRegistries.initialize();
VaultService.initialize();
WeatherCompassItem.registerFrameInteraction();
CanonMod.initialize();
AnotherWorldNetworking.initialize();
@@ -0,0 +1,117 @@
package fr.koka99cab.sanctuary26.anotherworld.block;
import com.mojang.serialization.MapCodec;
import fr.koka99cab.sanctuary26.anotherworld.block.entity.SafeVaultBlockEntity;
import fr.koka99cab.sanctuary26.anotherworld.registry.AnotherWorldItems;
import fr.koka99cab.sanctuary26.anotherworld.vault.VaultData;
import fr.koka99cab.sanctuary26.anotherworld.vault.VaultDrillingService;
import fr.koka99cab.sanctuary26.anotherworld.vault.VaultService;
import fr.koka99cab.sanctuary26.anotherworld.vault.VaultStructure;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.phys.BlockHitResult;
public final class SafeVaultBlock extends BaseEntityBlock {
public static final MapCodec<SafeVaultBlock> CODEC = simpleCodec(SafeVaultBlock::new);
public static final EnumProperty<Direction> FACING = BlockStateProperties.HORIZONTAL_FACING;
public SafeVaultBlock(Properties properties) {
super(properties);
registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH));
}
@Override protected MapCodec<? extends BaseEntityBlock> codec() { return CODEC; }
@Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new SafeVaultBlockEntity(pos, state); }
@Override protected RenderShape getRenderShape(BlockState state) { return RenderShape.MODEL; }
@Override public BlockState getStateForPlacement(BlockPlaceContext context) {
return defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());
}
@Override protected BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
@Override protected BlockState mirror(BlockState state, Mirror mirror) {
return rotate(state, mirror.getRotation(state.getValue(FACING)));
}
@Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
@Override
public void setPlacedBy(Level level, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
super.setPlacedBy(level, pos, state, placer, stack);
if (!(level instanceof ServerLevel serverLevel) || !(placer instanceof ServerPlayer player)) return;
if (level.getBlockEntity(pos) instanceof SafeVaultBlockEntity blockEntity) {
blockEntity.setOwner(player.getUUID());
VaultService.onSegmentPlaced(serverLevel, pos, player);
}
}
@Override
protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos,
Player player, InteractionHand hand, BlockHitResult hit) {
if (!stack.is(AnotherWorldItems.TITANIUM_DRILL)) return InteractionResult.TRY_WITH_EMPTY_HAND;
if (level.isClientSide()) {
player.startUsingItem(hand);
return InteractionResult.SUCCESS;
}
if (player instanceof ServerPlayer serverPlayer
&& VaultDrillingService.begin(serverPlayer, (ServerLevel) level, pos, hand)) {
player.startUsingItem(hand);
return InteractionResult.SUCCESS_SERVER;
}
return InteractionResult.CONSUME;
}
@Override
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos,
Player player, BlockHitResult hit) {
if (level.isClientSide()) return InteractionResult.SUCCESS;
VaultStructure.Formed formed = VaultStructure.find(level, pos).orElse(null);
if (formed == null) {
player.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.incomplete"));
return InteractionResult.CONSUME;
}
ServerLevel serverLevel = (ServerLevel) level;
VaultData data = VaultData.get(serverLevel.getServer());
if (!data.isRegistered(serverLevel, formed.center(), formed.owner())
&& !VaultService.tryRegister(serverLevel, formed, player instanceof ServerPlayer sp ? sp : null)) {
return InteractionResult.CONSUME;
}
if (!formed.owner().equals(player.getUUID())) {
player.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.locked"));
return InteractionResult.CONSUME;
}
if (level.getBlockEntity(formed.center()) instanceof SafeVaultBlockEntity controller) {
player.openMenu(controller);
return InteractionResult.SUCCESS_SERVER;
}
return InteractionResult.CONSUME;
}
@Override
protected void affectNeighborsAfterRemoval(BlockState state, ServerLevel level, BlockPos pos,
boolean movedByPiston) {
if (!movedByPiston) VaultData.get(level.getServer()).unregisterNear(level, pos);
super.affectNeighborsAfterRemoval(state, level, pos, movedByPiston);
}
}
@@ -0,0 +1,60 @@
package fr.koka99cab.sanctuary26.anotherworld.block.entity;
import fr.koka99cab.sanctuary26.anotherworld.registry.AnotherWorldBlockEntities;
import fr.koka99cab.sanctuary26.anotherworld.vault.VaultData;
import java.util.UUID;
import net.minecraft.core.BlockPos;
import net.minecraft.core.UUIDUtil;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.ValueInput;
import net.minecraft.world.level.storage.ValueOutput;
/** One owned segment of a player vault. The shared inventory lives in versioned world data. */
public final class SafeVaultBlockEntity extends BlockEntity implements MenuProvider {
private UUID owner;
public SafeVaultBlockEntity(BlockPos pos, BlockState state) {
super(AnotherWorldBlockEntities.SAFE_VAULT, pos, state);
}
public UUID owner() {
return owner;
}
public void setOwner(UUID owner) {
this.owner = owner;
setChanged();
}
@Override
protected void saveAdditional(ValueOutput output) {
super.saveAdditional(output);
if (owner != null) output.store("Owner", UUIDUtil.CODEC, owner);
}
@Override
protected void loadAdditional(ValueInput input) {
super.loadAdditional(input);
owner = input.read("Owner", UUIDUtil.CODEC).orElse(null);
}
@Override
public Component getDisplayName() {
return Component.translatable("container.anotherworld.safe_vault");
}
@Override
public AbstractContainerMenu createMenu(int containerId, Inventory inventory, Player player) {
if (owner == null || !owner.equals(player.getUUID()) || !(level instanceof ServerLevel serverLevel)) return null;
return ChestMenu.threeRows(containerId, inventory,
VaultData.get(serverLevel.getServer()).container(owner, serverLevel, getBlockPos()));
}
}
@@ -0,0 +1,41 @@
package fr.koka99cab.sanctuary26.anotherworld.item;
import fr.koka99cab.sanctuary26.anotherworld.vault.VaultDrillingService;
import java.util.function.Consumer;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemUseAnimation;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.component.TooltipDisplay;
import net.minecraft.world.level.Level;
public final class TitaniumDrillItem extends Item {
public TitaniumDrillItem(Properties properties) {
super(properties);
}
@Override
public void onUseTick(Level level, LivingEntity entity, ItemStack stack, int remainingUseTicks) {
if (entity instanceof ServerPlayer player) VaultDrillingService.tick(player, stack);
}
@Override
public boolean releaseUsing(ItemStack stack, Level level, LivingEntity entity, int remainingUseTicks) {
if (entity instanceof ServerPlayer player) VaultDrillingService.cancel(player, true);
return false;
}
@Override public int getUseDuration(ItemStack stack, LivingEntity entity) { return 72_000; }
@Override public ItemUseAnimation getUseAnimation(ItemStack stack) { return ItemUseAnimation.NONE; }
@Override
public void appendHoverText(ItemStack stack, TooltipContext context, TooltipDisplay display,
Consumer<Component> tooltip, TooltipFlag flag) {
tooltip.accept(Component.translatable("tooltip.anotherworld.titanium_drill.use").withStyle(ChatFormatting.GRAY));
tooltip.accept(Component.translatable("tooltip.anotherworld.titanium_drill.consumed").withStyle(ChatFormatting.DARK_GRAY));
}
}
@@ -2,6 +2,7 @@ package fr.koka99cab.sanctuary26.anotherworld.registry;
import fr.koka99cab.sanctuary26.anotherworld.AnotherWorldMod;
import fr.koka99cab.sanctuary26.anotherworld.block.entity.MirrorBlockEntity;
import fr.koka99cab.sanctuary26.anotherworld.block.entity.SafeVaultBlockEntity;
import java.util.ArrayList;
import java.util.List;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityType;
@@ -14,6 +15,11 @@ import net.minecraft.world.level.block.entity.BlockEntityTypes;
public final class AnotherWorldBlockEntities {
public static final BlockEntityType<MirrorBlockEntity> MIRROR = registerMirror();
public static final BlockEntityType<SafeVaultBlockEntity> SAFE_VAULT = Registry.register(
BuiltInRegistries.BLOCK_ENTITY_TYPE,
AnotherWorldMod.id("safe_vault"),
FabricBlockEntityTypeBuilder.create(SafeVaultBlockEntity::new, AnotherWorldBlocks.SAFE_BLOCK).build()
);
private AnotherWorldBlockEntities() {
}
@@ -33,7 +39,7 @@ public final class AnotherWorldBlockEntities {
hangingSignType.addValidBlock(family.hangingSign());
hangingSignType.addValidBlock(family.wallHangingSign());
});
AnotherWorldMod.LOGGER.debug("[{}] Mirror block entity and custom sign compatibility registered.", AnotherWorldMod.DISPLAY_NAME);
AnotherWorldMod.LOGGER.debug("[{}] Mirror, safe-vault and custom sign block entities registered.", AnotherWorldMod.DISPLAY_NAME);
}
private static BlockEntityType<MirrorBlockEntity> registerMirror() {
@@ -14,6 +14,7 @@ import fr.koka99cab.sanctuary26.anotherworld.block.PricklyRoseBlock;
import fr.koka99cab.sanctuary26.anotherworld.block.ProgressiveMossBlock;
import fr.koka99cab.sanctuary26.anotherworld.block.ProgressiveMossPillarBlock;
import fr.koka99cab.sanctuary26.anotherworld.block.RainbowBlock;
import fr.koka99cab.sanctuary26.anotherworld.block.SafeVaultBlock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -55,6 +56,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
public final class AnotherWorldBlocks {
public static final List<String> DYE_COLORS = List.of(
@@ -93,6 +95,16 @@ public final class AnotherWorldBlocks {
.sound(SoundType.GLASS)
.noOcclusion()
);
public static final SafeVaultBlock SAFE_BLOCK = register(
"safe_block",
SafeVaultBlock::new,
BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK)
.mapColor(MapColor.GOLD)
.requiresCorrectToolForDrops()
.strength(8.0F, 1_200.0F)
.sound(SoundType.METAL)
.pushReaction(PushReaction.BLOCK)
);
public static final Map<String, RainbowBlock> RAINBOW_BLOCKS = registerRainbowBlocks();
public static final Map<String, Block> COLORED_BRICKS = registerColoredBlocks("bricks", Blocks.BRICKS);
@@ -3,6 +3,7 @@ package fr.koka99cab.sanctuary26.anotherworld.registry;
import fr.koka99cab.sanctuary26.anotherworld.AnotherWorldMod;
import fr.koka99cab.sanctuary26.anotherworld.item.WeatherCompassItem;
import fr.koka99cab.sanctuary26.anotherworld.item.TitaniumEquipment;
import fr.koka99cab.sanctuary26.anotherworld.item.TitaniumDrillItem;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -54,6 +55,11 @@ public final class AnotherWorldItems {
public static final Item RAW_TITANIUM = register("raw_titanium");
public static final Item TITANIUM_INGOT = registerTrimMaterial("titanium_ingot", TITANIUM_TRIM_MATERIAL);
public static final Item TITANIUM_NUGGET = register("titanium_nugget");
public static final Item TITANIUM_DRILL = register(
"titanium_drill",
TitaniumDrillItem::new,
new Item.Properties().stacksTo(1)
);
public static final Item TITANIUM_SWORD = register(
"titanium_sword",
Item::new,
@@ -0,0 +1,274 @@
package fr.koka99cab.sanctuary26.anotherworld.vault;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import fr.koka99cab.sanctuary26.anotherworld.AnotherWorldMod;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.Identifier;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Container;
import net.minecraft.world.ContainerHelper;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.saveddata.SavedData;
import net.minecraft.world.level.saveddata.SavedDataType;
/** Global player-linked vault inventory, available to the Shop even when its structure is unloaded. */
public final class VaultData extends SavedData {
public static final String SAVE_KEY = "safe_vaults";
public static final int DATA_VERSION = 1;
private static final Identifier RUBY = Identifier.fromNamespaceAndPath("anotherworld", "ruby");
private static final Identifier SAPPHIRE = Identifier.fromNamespaceAndPath("anotherworld", "sapphire");
private static final Identifier EMERALD = Identifier.withDefaultNamespace("emerald");
private static final Codec<StoredSlot> SLOT_CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.INT.fieldOf("slot").forGetter(StoredSlot::slot),
ItemStack.CODEC.fieldOf("item").forGetter(StoredSlot::item)
).apply(instance, StoredSlot::new));
private static final Codec<StoredAccount> ACCOUNT_CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.STRING.fieldOf("owner").forGetter(StoredAccount::owner),
SLOT_CODEC.listOf().optionalFieldOf("items", List.of()).forGetter(StoredAccount::items),
Codec.LONG.optionalFieldOf("protected_until", 0L).forGetter(StoredAccount::protectedUntil)
).apply(instance, StoredAccount::new));
private static final Codec<VaultAddress> ADDRESS_CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.STRING.fieldOf("dimension").forGetter(VaultAddress::dimension),
Codec.LONG.fieldOf("pos").forGetter(VaultAddress::pos),
Codec.STRING.fieldOf("owner").forGetter(VaultAddress::owner)
).apply(instance, VaultAddress::new));
private static final Codec<VaultData> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.INT.optionalFieldOf("data_version", DATA_VERSION).forGetter(data -> data.dataVersion),
ACCOUNT_CODEC.listOf().optionalFieldOf("accounts", List.of()).forGetter(VaultData::storedAccounts),
ADDRESS_CODEC.listOf().optionalFieldOf("vaults", List.of()).forGetter(data -> data.vaults)
).apply(instance, VaultData::new));
private static final SavedDataType<VaultData> TYPE = new SavedDataType<>(
AnotherWorldMod.id(SAVE_KEY), VaultData::new, CODEC, null);
private int dataVersion;
private final Map<UUID, Account> accounts = new LinkedHashMap<>();
private final List<VaultAddress> vaults = new ArrayList<>();
public VaultData() {
this(DATA_VERSION, List.of(), List.of());
}
private VaultData(int dataVersion, List<StoredAccount> accounts, List<VaultAddress> vaults) {
this.dataVersion = dataVersion;
for (StoredAccount stored : accounts == null ? List.<StoredAccount>of() : accounts) {
try {
UUID owner = UUID.fromString(stored.owner());
NonNullList<ItemStack> items = NonNullList.withSize(VaultRules.STORAGE_SLOTS, ItemStack.EMPTY);
for (StoredSlot slot : stored.items()) {
if (slot.slot() >= 0 && slot.slot() < items.size() && isCurrency(slot.item())) {
items.set(slot.slot(), slot.item().copy());
}
}
this.accounts.put(owner, new Account(items, Math.max(0L, stored.protectedUntil())));
} catch (IllegalArgumentException ignored) {
AnotherWorldMod.LOGGER.warn("[Vault] Ignored account with invalid owner {}.", stored.owner());
}
}
if (vaults != null) this.vaults.addAll(vaults);
}
public static VaultData get(MinecraftServer server) {
ServerLevel overworld = server.getLevel(Level.OVERWORLD);
if (overworld == null) throw new IllegalStateException("Overworld unavailable for vault data");
VaultData data = overworld.getDataStorage().computeIfAbsent(TYPE);
if (data.dataVersion < DATA_VERSION) {
data.dataVersion = DATA_VERSION;
data.setDirty();
}
return data;
}
public boolean register(ServerLevel level, BlockPos center, UUID owner) {
String dimension = dimension(level);
String ownerId = owner.toString();
for (VaultAddress address : vaults) {
if (address.owner().equals(ownerId)) {
return address.dimension().equals(dimension) && address.pos() == center.asLong();
}
}
vaults.add(new VaultAddress(dimension, center.asLong(), ownerId));
accounts.computeIfAbsent(owner, ignored -> new Account());
setDirty();
return true;
}
public boolean isRegistered(ServerLevel level, BlockPos center, UUID owner) {
String dimension = dimension(level), ownerId = owner.toString();
return vaults.stream().anyMatch(address -> address.dimension().equals(dimension)
&& address.pos() == center.asLong() && address.owner().equals(ownerId));
}
public void unregisterNear(ServerLevel level, BlockPos member) {
String dimension = dimension(level);
boolean changed = vaults.removeIf(address -> {
if (!address.dimension().equals(dimension)) return false;
BlockPos center = BlockPos.of(address.pos());
return center.getY() == member.getY() && Math.abs(center.getX() - member.getX()) <= 1
&& Math.abs(center.getZ() - member.getZ()) <= 1;
});
if (changed) setDirty();
}
public Container container(UUID owner, ServerLevel level, BlockPos center) {
accounts.computeIfAbsent(owner, ignored -> new Account());
return new VaultContainer(this, owner, level, center.immutable());
}
public int count(UUID owner, Item item) {
if (!isCurrency(item)) return 0;
Account account = accounts.get(owner);
if (account == null) return 0;
long count = 0L;
for (ItemStack stack : account.items) if (stack.is(item)) count += stack.getCount();
return (int) Math.min(Integer.MAX_VALUE, count);
}
public int remove(UUID owner, Item item, int amount) {
if (!isCurrency(item) || amount <= 0) return 0;
Account account = accounts.get(owner);
if (account == null) return 0;
int remaining = amount;
for (ItemStack stack : account.items) {
if (remaining <= 0) break;
if (!stack.is(item)) continue;
int removed = Math.min(remaining, stack.getCount());
stack.shrink(removed);
remaining -= removed;
}
if (remaining != amount) setDirty();
return amount - remaining;
}
public boolean hasContents(UUID owner) {
Account account = accounts.get(owner);
return account != null && account.items.stream().anyMatch(stack -> !stack.isEmpty());
}
public List<ItemStack> raidLoot(UUID owner) {
List<ItemStack> loot = new ArrayList<>();
for (Identifier id : List.of(RUBY, SAPPHIRE, EMERALD)) {
Item item = BuiltInRegistries.ITEM.getOptional(id).orElse(null);
if (item == null) continue;
int amount = VaultRules.raidLoot(count(owner, item));
int removed = remove(owner, item, amount);
while (removed > 0) {
int stackSize = Math.min(removed, item.getDefaultMaxStackSize());
loot.add(new ItemStack(item, stackSize));
removed -= stackSize;
}
}
return List.copyOf(loot);
}
public long protectionRemaining(UUID owner, long gameTime) {
Account account = accounts.get(owner);
return account == null ? 0L : Math.max(0L, account.protectedUntil - gameTime);
}
public void protectAfterRaid(UUID owner, long gameTime) {
Account account = accounts.computeIfAbsent(owner, ignored -> new Account());
account.protectedUntil = gameTime + VaultRules.RAID_PROTECTION_TICKS;
setDirty();
}
public static boolean isCurrency(ItemStack stack) {
return stack != null && !stack.isEmpty() && isCurrency(stack.getItem());
}
public static boolean isCurrency(Item item) {
if (item == null) return false;
Identifier id = BuiltInRegistries.ITEM.getKey(item);
return RUBY.equals(id) || SAPPHIRE.equals(id) || EMERALD.equals(id);
}
private NonNullList<ItemStack> items(UUID owner) {
return accounts.computeIfAbsent(owner, ignored -> new Account()).items;
}
private List<StoredAccount> storedAccounts() {
List<StoredAccount> stored = new ArrayList<>();
accounts.forEach((owner, account) -> {
List<StoredSlot> slots = new ArrayList<>();
for (int index = 0; index < account.items.size(); index++) {
ItemStack stack = account.items.get(index);
if (!stack.isEmpty()) slots.add(new StoredSlot(index, stack));
}
stored.add(new StoredAccount(owner.toString(), List.copyOf(slots), account.protectedUntil));
});
return List.copyOf(stored);
}
private static String dimension(ServerLevel level) {
return level.dimension().identifier().toString();
}
private static final class Account {
private final NonNullList<ItemStack> items;
private long protectedUntil;
private Account() { this(NonNullList.withSize(VaultRules.STORAGE_SLOTS, ItemStack.EMPTY), 0L); }
private Account(NonNullList<ItemStack> items, long protectedUntil) {
this.items = items;
this.protectedUntil = protectedUntil;
}
}
private static final class VaultContainer implements Container {
private final VaultData data;
private final UUID owner;
private final ServerLevel level;
private final BlockPos center;
private VaultContainer(VaultData data, UUID owner, ServerLevel level, BlockPos center) {
this.data = data;
this.owner = owner;
this.level = level;
this.center = center;
}
@Override public int getContainerSize() { return VaultRules.STORAGE_SLOTS; }
@Override public boolean isEmpty() { return data.items(owner).stream().allMatch(ItemStack::isEmpty); }
@Override public ItemStack getItem(int slot) { return data.items(owner).get(slot); }
@Override public ItemStack removeItem(int slot, int amount) {
ItemStack removed = ContainerHelper.removeItem(data.items(owner), slot, amount);
if (!removed.isEmpty()) setChanged();
return removed;
}
@Override public ItemStack removeItemNoUpdate(int slot) {
ItemStack removed = ContainerHelper.takeItem(data.items(owner), slot);
if (!removed.isEmpty()) setChanged();
return removed;
}
@Override public void setItem(int slot, ItemStack stack) {
if (stack != null && !stack.isEmpty() && !isCurrency(stack)) return;
data.items(owner).set(slot, stack == null ? ItemStack.EMPTY : stack);
setChanged();
}
@Override public void setChanged() { data.setDirty(); }
@Override public boolean stillValid(Player player) {
if (player == null || !player.getUUID().equals(owner)
|| player.distanceToSqr(center.getX() + 0.5D, center.getY() + 0.5D, center.getZ() + 0.5D) > 64.0D)
return false;
return data.isRegistered(level, center, owner)
&& VaultStructure.find(level, center).filter(formed -> formed.center().equals(center)).isPresent();
}
@Override public void clearContent() { data.items(owner).clear(); setChanged(); }
@Override public boolean canPlaceItem(int slot, ItemStack stack) { return isCurrency(stack); }
}
private record StoredSlot(int slot, ItemStack item) {}
private record StoredAccount(String owner, List<StoredSlot> items, long protectedUntil) {}
private record VaultAddress(String dimension, long pos, String owner) {}
}
@@ -0,0 +1,176 @@
package fr.koka99cab.sanctuary26.anotherworld.vault;
import fr.koka99cab.sanctuary26.anotherworld.AnotherWorldMod;
import fr.koka99cab.sanctuary26.anotherworld.registry.AnotherWorldItems;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
/** Server-authoritative continuous titanium-drill raid session. */
public final class VaultDrillingService {
private static final Map<UUID, Session> SESSIONS = new HashMap<>();
private static final Map<Target, UUID> ACTIVE_TARGETS = new HashMap<>();
private static boolean initialized;
private VaultDrillingService() {
}
public static void initialize() {
if (initialized) return;
initialized = true;
ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> cancel(handler.player, false));
}
public static boolean begin(ServerPlayer attacker, ServerLevel level, BlockPos clicked, InteractionHand hand) {
VaultStructure.Formed formed = VaultStructure.find(level, clicked).orElse(null);
if (formed == null) {
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.incomplete"));
return false;
}
if (formed.owner().equals(attacker.getUUID())) {
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.drill_own"));
return false;
}
VaultData data = VaultData.get(level.getServer());
if (!data.isRegistered(level, formed.center(), formed.owner())) {
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.inactive"));
return false;
}
if (!data.hasContents(formed.owner())) {
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.empty"));
return false;
}
ServerPlayer owner = level.getServer().getPlayerList().getPlayer(formed.owner());
if (owner == null) {
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.owner_offline"));
return false;
}
long remaining = data.protectionRemaining(formed.owner(), level.getServer().overworld().getGameTime());
if (remaining > 0L) {
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.protected",
Math.max(1L, (remaining + 1199L) / 1200L)));
return false;
}
Target target = Target.of(level, formed.center());
UUID active = ACTIVE_TARGETS.get(target);
if (active != null && !active.equals(attacker.getUUID())) {
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.already_drilling"));
return false;
}
cancel(attacker, false);
Session session = new Session(target, formed.owner(), hand, 0);
SESSIONS.put(attacker.getUUID(), session);
ACTIVE_TARGETS.put(target, attacker.getUUID());
owner.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.alarm",
attacker.getDisplayName(), formed.center().getX(), formed.center().getY(), formed.center().getZ()));
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.drilling_started"));
level.playSound(null, clicked, SoundEvents.PISTON_EXTEND, SoundSource.BLOCKS, 1.0F, 0.65F);
AnotherWorldMod.LOGGER.info("[Vault] {} started drilling {}'s vault at {}.",
attacker.getGameProfile().name(), owner.getGameProfile().name(), formed.center().toShortString());
return true;
}
public static void tick(ServerPlayer attacker, ItemStack drill) {
Session session = SESSIONS.get(attacker.getUUID());
if (session == null) return;
if (!drill.is(AnotherWorldItems.TITANIUM_DRILL)
|| attacker.getUsedItemHand() != session.hand()
|| !(attacker.level() instanceof ServerLevel level)
|| !session.target().dimension().equals(dimension(level))) {
cancel(attacker, true);
return;
}
HitResult hit = attacker.pick(attacker.blockInteractionRange() + 1.0D, 1.0F, false);
VaultStructure.Formed formed = hit instanceof BlockHitResult blockHit
? VaultStructure.find(level, blockHit.getBlockPos()).orElse(null) : null;
if (formed == null || !formed.center().equals(session.target().center())
|| !formed.owner().equals(session.owner())
|| level.getServer().getPlayerList().getPlayer(session.owner()) == null) {
cancel(attacker, true);
attacker.stopUsingItem();
return;
}
int elapsed = session.elapsedTicks() + 1;
Session progressed = session.withElapsed(elapsed);
SESSIONS.put(attacker.getUUID(), progressed);
if (elapsed % 10 == 0) {
BlockPos center = formed.center();
level.playSound(null, center, SoundEvents.ANVIL_LAND, SoundSource.BLOCKS, 0.35F, 1.65F);
level.sendParticles(ParticleTypes.ELECTRIC_SPARK, center.getX() + 0.5D, center.getY() + 1.0D,
center.getZ() + 0.5D, 5, 0.7D, 0.25D, 0.7D, 0.04D);
}
if (elapsed % 20 == 0) {
attacker.sendOverlayMessage(Component.translatable("message.anotherworld.safe_vault.drilling_progress",
VaultRules.progressPercent(elapsed)));
}
if (elapsed >= VaultRules.RAID_DURATION_TICKS) complete(attacker, level, progressed, formed);
}
private static void complete(ServerPlayer attacker, ServerLevel level, Session session,
VaultStructure.Formed formed) {
VaultData data = VaultData.get(level.getServer());
List<ItemStack> loot = data.raidLoot(session.owner());
if (loot.isEmpty()) {
cancel(attacker, true);
attacker.stopUsingItem();
return;
}
int total = loot.stream().mapToInt(ItemStack::getCount).sum();
loot.forEach(stack -> attacker.getInventory().placeItemBackInInventory(stack));
data.protectAfterRaid(session.owner(), level.getServer().overworld().getGameTime());
ItemStack drill = attacker.getItemInHand(session.hand());
if (!attacker.hasInfiniteMaterials()) drill.shrink(1);
ServerPlayer owner = level.getServer().getPlayerList().getPlayer(session.owner());
if (owner != null) owner.sendSystemMessage(Component.translatable(
"message.anotherworld.safe_vault.raided_owner", attacker.getDisplayName(), total));
attacker.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.raided", total));
level.playSound(null, formed.center(), SoundEvents.VAULT_OPEN_SHUTTER, SoundSource.BLOCKS, 1.0F, 0.8F);
level.sendParticles(ParticleTypes.CRIT, formed.center().getX() + 0.5D, formed.center().getY() + 1.0D,
formed.center().getZ() + 0.5D, 24, 0.8D, 0.4D, 0.8D, 0.12D);
AnotherWorldMod.LOGGER.info("[Vault] {} stole {} currency items from {} at {}.",
attacker.getGameProfile().name(), total, session.owner(), formed.center().toShortString());
cancel(attacker, false);
attacker.stopUsingItem();
}
public static void cancel(ServerPlayer player, boolean notify) {
Session removed = SESSIONS.remove(player.getUUID());
if (removed == null) return;
ACTIVE_TARGETS.remove(removed.target(), player.getUUID());
if (notify) player.sendOverlayMessage(Component.translatable("message.anotherworld.safe_vault.drilling_cancelled"));
}
public static boolean isActive(ServerLevel level, BlockPos center) {
return ACTIVE_TARGETS.containsKey(Target.of(level, center));
}
private static String dimension(ServerLevel level) {
return level.dimension().identifier().toString();
}
private record Target(String dimension, BlockPos center) {
private static Target of(ServerLevel level, BlockPos center) {
return new Target(VaultDrillingService.dimension(level), center.immutable());
}
}
private record Session(Target target, UUID owner, InteractionHand hand, int elapsedTicks) {
private Session withElapsed(int elapsed) { return new Session(target, owner, hand, elapsed); }
}
}
@@ -0,0 +1,25 @@
package fr.koka99cab.sanctuary26.anotherworld.vault;
/** Pure balancing rules shared by runtime code and smoke tests. */
public final class VaultRules {
public static final int STRUCTURE_WIDTH = 3;
public static final int STRUCTURE_RADIUS = 1;
public static final int STRUCTURE_BLOCKS = STRUCTURE_WIDTH * STRUCTURE_WIDTH;
public static final int STORAGE_SLOTS = 27;
public static final int RAID_DURATION_TICKS = 60 * 20;
public static final int RAID_LOOT_PERCENT = 20;
public static final long RAID_PROTECTION_TICKS = 24L * 60L * 60L * 20L;
private VaultRules() {
}
public static int raidLoot(int stored) {
if (stored <= 0) return 0;
long rounded = ((long) stored * RAID_LOOT_PERCENT + 99L) / 100L;
return (int) Math.min(stored, Math.max(1L, rounded));
}
public static int progressPercent(int elapsedTicks) {
return Math.clamp((int) ((long) Math.max(0, elapsedTicks) * 100L / RAID_DURATION_TICKS), 0, 100);
}
}
@@ -0,0 +1,78 @@
package fr.koka99cab.sanctuary26.anotherworld.vault;
import fr.koka99cab.sanctuary26.anotherworld.AnotherWorldMod;
import fr.koka99cab.sanctuary26.anotherworld.block.entity.SafeVaultBlockEntity;
import fr.koka99cab.sanctuary26.anotherworld.block.SafeVaultBlock;
import fr.koka99cab.sanctuary26.anotherworld.registry.AnotherWorldBlocks;
import fr.koka99cab.sanctuary26.sanctuary.api.inventory.SanctuaryCurrencyStorage;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.permissions.Permissions;
import net.minecraft.world.entity.player.Player;
/** Owns vault lifecycle, break protection and Sanctuary currency-storage integration. */
public final class VaultService {
private static boolean initialized;
private VaultService() {
}
public static void initialize() {
if (initialized) return;
initialized = true;
SanctuaryCurrencyStorage.register(AnotherWorldMod.id("safe_vault"), new SanctuaryCurrencyStorage.Provider() {
@Override public int count(ServerPlayer player, net.minecraft.world.item.Item item) {
return VaultData.get(player.level().getServer()).count(player.getUUID(), item);
}
@Override public int remove(ServerPlayer player, net.minecraft.world.item.Item item, int amount) {
return VaultData.get(player.level().getServer()).remove(player.getUUID(), item, amount);
}
});
PlayerBlockBreakEvents.BEFORE.register((level, player, pos, state, blockEntity) -> {
if (!state.is(AnotherWorldBlocks.SAFE_BLOCK) || !(level instanceof ServerLevel serverLevel)
|| !(blockEntity instanceof SafeVaultBlockEntity segment)) return true;
if (isOperator(player)) return true;
if (segment.owner() == null || !segment.owner().equals(player.getUUID())) {
player.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.break_not_owner"));
return false;
}
VaultStructure.Formed formed = VaultStructure.find(serverLevel, pos).orElse(null);
if (formed != null && (VaultData.get(serverLevel.getServer()).hasContents(formed.owner())
|| VaultDrillingService.isActive(serverLevel, formed.center()))) {
player.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.empty_before_break"));
return false;
}
return true;
});
VaultDrillingService.initialize();
}
public static void onSegmentPlaced(ServerLevel level, net.minecraft.core.BlockPos pos, ServerPlayer player) {
VaultStructure.find(level, pos).ifPresent(formed -> {
var facing = level.getBlockState(pos).getValue(SafeVaultBlock.FACING);
formed.members().forEach(member -> level.setBlock(member,
level.getBlockState(member).setValue(SafeVaultBlock.FACING, facing),
net.minecraft.world.level.block.Block.UPDATE_CLIENTS));
tryRegister(level, formed, player);
});
}
public static boolean tryRegister(ServerLevel level, VaultStructure.Formed formed, ServerPlayer player) {
VaultData data = VaultData.get(level.getServer());
if (data.register(level, formed.center(), formed.owner())) {
if (player != null) player.sendSystemMessage(Component.translatable(
"message.anotherworld.safe_vault.formed",
formed.center().getX(), formed.center().getY(), formed.center().getZ()));
return true;
}
if (player != null) player.sendSystemMessage(Component.translatable("message.anotherworld.safe_vault.already_owned"));
return false;
}
private static boolean isOperator(Player player) {
return player instanceof ServerPlayer serverPlayer && serverPlayer.createCommandSourceStack().permissions()
.hasPermission(Permissions.COMMANDS_GAMEMASTER);
}
}
@@ -0,0 +1,61 @@
package fr.koka99cab.sanctuary26.anotherworld.vault;
import fr.koka99cab.sanctuary26.anotherworld.block.entity.SafeVaultBlockEntity;
import fr.koka99cab.sanctuary26.anotherworld.registry.AnotherWorldBlocks;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
/** Detects one isolated horizontal 3x3 platform owned by a single player. */
public final class VaultStructure {
private VaultStructure() {
}
public static Optional<Formed> find(Level level, BlockPos member) {
if (level == null || member == null) return Optional.empty();
for (int offsetX = -VaultRules.STRUCTURE_RADIUS; offsetX <= VaultRules.STRUCTURE_RADIUS; offsetX++) {
for (int offsetZ = -VaultRules.STRUCTURE_RADIUS; offsetZ <= VaultRules.STRUCTURE_RADIUS; offsetZ++) {
BlockPos center = member.offset(-offsetX, 0, -offsetZ);
Formed formed = validate(level, center);
if (formed != null && formed.contains(member)) return Optional.of(formed);
}
}
return Optional.empty();
}
private static Formed validate(Level level, BlockPos center) {
UUID owner = null;
List<BlockPos> members = new ArrayList<>(VaultRules.STRUCTURE_BLOCKS);
for (int x = -VaultRules.STRUCTURE_RADIUS; x <= VaultRules.STRUCTURE_RADIUS; x++) {
for (int z = -VaultRules.STRUCTURE_RADIUS; z <= VaultRules.STRUCTURE_RADIUS; z++) {
BlockPos pos = center.offset(x, 0, z);
if (!level.getBlockState(pos).is(AnotherWorldBlocks.SAFE_BLOCK)
|| !(level.getBlockEntity(pos) instanceof SafeVaultBlockEntity blockEntity)
|| blockEntity.owner() == null) return null;
if (owner == null) owner = blockEntity.owner();
else if (!owner.equals(blockEntity.owner())) return null;
members.add(pos.immutable());
}
}
// Reject ambiguous 3x4/4x3 carpets: a vault is one discrete 3x3 structure.
for (int x = -2; x <= 2; x++) {
for (int z = -2; z <= 2; z++) {
if (Math.abs(x) <= 1 && Math.abs(z) <= 1) continue;
if (level.getBlockState(center.offset(x, 0, z)).is(AnotherWorldBlocks.SAFE_BLOCK)) return null;
}
}
return new Formed(center.immutable(), owner, List.copyOf(members));
}
public record Formed(BlockPos center, UUID owner, List<BlockPos> members) {
public boolean contains(BlockPos pos) {
return pos != null && pos.getY() == center.getY()
&& Math.abs(pos.getX() - center.getX()) <= VaultRules.STRUCTURE_RADIUS
&& Math.abs(pos.getZ() - center.getZ()) <= VaultRules.STRUCTURE_RADIUS;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

@@ -30,13 +30,14 @@
"minecraft": "~26.2",
"java": ">=25",
"fabric-api": ">=0.154.2+26.2",
"ambiance": "*"
"ambiance": "*",
"sanctuary": ">=0.0.0-alpha.117"
},
"custom": {
"sanctuary26": {
"system_type": "gameplay-system",
"namespace": "anotherworld",
"data_version": 1,
"data_version": 2,
"network_protocol": 1,
"lifecycle": "${lifecycle}",
"pack_version": "${pack_version}",
@@ -0,0 +1,26 @@
package fr.koka99cab.sanctuary26.anotherworld.vault;
public final class VaultRulesSmoke {
private VaultRulesSmoke() {
}
public static void main(String[] args) {
require(VaultRules.STRUCTURE_WIDTH == 3, "vault width");
require(VaultRules.STRUCTURE_BLOCKS == 9, "vault footprint");
require(VaultRules.STORAGE_SLOTS == 27, "vault capacity");
require(VaultRules.RAID_DURATION_TICKS == 1_200, "raid duration");
require(VaultRules.RAID_PROTECTION_TICKS == 1_728_000L, "raid protection");
require(VaultRules.raidLoot(0) == 0, "empty loot");
require(VaultRules.raidLoot(1) == 1, "minimum loot");
require(VaultRules.raidLoot(5) == 1, "exact 20 percent");
require(VaultRules.raidLoot(64) == 13, "rounded 20 percent");
require(VaultRules.raidLoot(Integer.MAX_VALUE) == 429_496_730, "bounded large balance");
require(VaultRules.progressPercent(0) == 0, "initial progress");
require(VaultRules.progressPercent(600) == 50, "half progress");
require(VaultRules.progressPercent(1_200) == 100, "complete progress");
}
private static void require(boolean condition, String contract) {
if (!condition) throw new IllegalStateException("Invalid vault contract: " + contract);
}
}
+73 -8
View File
@@ -1815,7 +1815,7 @@ tasks.register("verifyWorkspace") {
|| terramixMigration.compatibility?.new_registry_ids != 100
|| terramixMigration.compatibility?.worldgen_changed != true
|| terramixMigration.compatibility?.save_migration_required != false
|| anotherWorldManifest?.custom?.sanctuary26?.data_version != 1
|| anotherWorldManifest?.custom?.sanctuary26?.data_version != 2
|| anotherWorldManifest?.custom?.sanctuary26?.network_protocol != 1
|| sanctuaryManifest?.custom?.sanctuary26?.data_version < 9
) {
@@ -3428,7 +3428,7 @@ tasks.register("verifyProgressivePauseMenuRelease") {
"sanctuary/src/main/resources/assets/sanctuary/lang/${locale}.json"))]
}
if (rootProject.pack_version != "26.2.0-alpha.201"
|| rootProject.sanctuary_version != "0.0.0-alpha.116"
|| rootProject.sanctuary_version != "0.0.0-alpha.117"
|| rootProject.onlyfun_version != "0.0.0-alpha.19"
|| release.pack_version != rootProject.pack_version || index.versionId != rootProject.pack_version
|| migration.source?.modules != [sanctuary: "0.0.0-alpha.108", onlyfun: "0.0.0-alpha.17"]
@@ -3478,7 +3478,7 @@ tasks.register("verifyMirrorLavenderDrawerRelease") {
"redstoner/src/main/java/fr/koka99cab/sanctuary26/redstoner/registry/RedStonerRegistries.java").text
def drawerRecipe = file("redstoner/src/main/resources/data/redstoner/recipe/drawer.json")
if (rootProject.pack_version != "26.2.0-alpha.201"
|| rootProject.anotherworld_version != "0.0.0-alpha.49"
|| rootProject.anotherworld_version != "0.0.0-alpha.50"
|| rootProject.redstoner_version != "0.0.0-alpha.10"
|| release.pack_version != rootProject.pack_version || index.versionId != rootProject.pack_version
|| migration.source?.pack_version != "26.2.0-alpha.191"
@@ -3586,6 +3586,7 @@ project(":itsalive") {
project(":anotherworld") {
dependencies {
implementation project(":ambiance")
implementation project(":sanctuary")
}
}
@@ -4124,7 +4125,7 @@ tasks.register("verifyShopPricingLayoutRelease") {
def index = new JsonSlurper().parse(file("pack/prism/modrinth.index.json"))
if (rootProject.pack_version != "26.2.0-alpha.201"
|| rootProject.onlyfun_version != "0.0.0-alpha.19"
|| rootProject.sanctuary_version != "0.0.0-alpha.116"
|| rootProject.sanctuary_version != "0.0.0-alpha.117"
|| release.pack_version != rootProject.pack_version || index.versionId != rootProject.pack_version
|| migration.source?.pack_version != "26.2.0-alpha.192"
|| migration.target?.pack_version != "26.2.0-alpha.193"
@@ -4218,7 +4219,7 @@ tasks.register("verifyShopCsvBossGatesRelease") {
def offerCatalog = file("sanctuary/src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/ShopOfferCatalog.java").text
if (rootProject.pack_version != "26.2.0-alpha.201"
|| rootProject.onlyfun_version != "0.0.0-alpha.19"
|| rootProject.sanctuary_version != "0.0.0-alpha.116"
|| rootProject.sanctuary_version != "0.0.0-alpha.117"
|| release.pack_version != rootProject.pack_version || index.versionId != rootProject.pack_version
|| migration.source?.pack_version != "26.2.0-alpha.194"
|| migration.source?.modules != [onlyfun: "0.0.0-alpha.18", sanctuary: "0.0.0-alpha.110"]
@@ -4310,7 +4311,7 @@ tasks.register("verifyQuestRequestsCauldronBatchesRelease") {
def sanctuaryManifest = new JsonSlurper().parse(file("sanctuary/src/main/resources/fabric.mod.json"))
if (rootProject.pack_version != "26.2.0-alpha.201"
|| rootProject.itsalive_version != "0.0.0-alpha.30"
|| rootProject.sanctuary_version != "0.0.0-alpha.116"
|| rootProject.sanctuary_version != "0.0.0-alpha.117"
|| migration.source?.pack_version != "26.2.0-alpha.196"
|| migration.target?.pack_version != "26.2.0-alpha.197"
|| migration.target?.modules != [itsalive: "0.0.0-alpha.29", sanctuary: "0.0.0-alpha.113"]
@@ -4410,7 +4411,7 @@ tasks.register("verifyQuestRequestContractsRelease") {
def sanctuaryManifest = new JsonSlurper().parse(file("sanctuary/src/main/resources/fabric.mod.json"))
if (rootProject.pack_version != "26.2.0-alpha.201"
|| rootProject.itsalive_version != "0.0.0-alpha.30"
|| rootProject.sanctuary_version != "0.0.0-alpha.116"
|| rootProject.sanctuary_version != "0.0.0-alpha.117"
|| migration.source?.pack_version != "26.2.0-alpha.198"
|| migration.source?.modules?.sanctuary != "0.0.0-alpha.114"
|| migration.target?.pack_version != "26.2.0-alpha.199"
@@ -4530,7 +4531,7 @@ tasks.register("verifyQuestRequestEscrowRelease") {
def packwizIndex = file("pack/packwiz/index.toml").text
def sanctuaryManifest = new JsonSlurper().parse(file("sanctuary/src/main/resources/fabric.mod.json"))
if (rootProject.pack_version != "26.2.0-alpha.201"
|| rootProject.sanctuary_version != "0.0.0-alpha.116"
|| rootProject.sanctuary_version != "0.0.0-alpha.117"
|| migration.source?.pack_version != "26.2.0-alpha.200"
|| migration.source?.modules?.sanctuary != "0.0.0-alpha.115"
|| migration.target?.pack_version != "26.2.0-alpha.201"
@@ -4558,6 +4559,70 @@ tasks.named("verifyWorkspace") {
dependsOn tasks.named("verifyQuestRequestEscrowRelease")
}
tasks.register("verifySafeVaultFeature") {
group = "verification"
description = "Checks the unreleased 3x3 player safe, titanium drill and Shop currency-provider contract."
dependsOn ":anotherworld:generateAnotherWorldResources"
inputs.file(file("pack/migrations/anotherworld-safe-vault-data-v2.json"))
inputs.file(file("anotherworld/src/main/resources/fabric.mod.json"))
inputs.file(file("sanctuary/src/main/java/fr/koka99cab/sanctuary26/sanctuary/api/inventory/SanctuaryCurrencyStorage.java"))
inputs.files(fileTree("anotherworld/src/main/java/fr/koka99cab/sanctuary26/anotherworld/vault") { include "*.java" })
inputs.files(fileTree("anotherworld/src/main/resources/assets/anotherworld/textures/block/safe_vault") { include "*.png" })
inputs.file(file("anotherworld/src/main/resources/assets/anotherworld/textures/item/safe_block.png"))
inputs.file(file("anotherworld/src/main/resources/assets/anotherworld/textures/item/titanium_drill.png"))
doLast {
def migration = new JsonSlurper().parse(file("pack/migrations/anotherworld-safe-vault-data-v2.json"))
def manifest = new JsonSlurper().parse(file("anotherworld/src/main/resources/fabric.mod.json"))
def rules = file("anotherworld/src/main/java/fr/koka99cab/sanctuary26/anotherworld/vault/VaultRules.java").text
def data = file("anotherworld/src/main/java/fr/koka99cab/sanctuary26/anotherworld/vault/VaultData.java").text
def currencyApi = file("sanctuary/src/main/java/fr/koka99cab/sanctuary26/sanctuary/api/inventory/SanctuaryCurrencyStorage.java").text
def generated = file("anotherworld/build/generated/resources")
def safeRecipe = new JsonSlurper().parse(new File(generated, "data/anotherworld/recipe/safe_block.json"))
def drillRecipe = new JsonSlurper().parse(new File(generated, "data/anotherworld/recipe/titanium_drill.json"))
def requiredTextures = [
"block/safe_vault/bottom.png": [48, 48], "block/safe_vault/front.png": [48, 48],
"block/safe_vault/side.png": [48, 48], "block/safe_vault/top.png": [48, 48],
"item/safe_block.png": [16, 16], "item/titanium_drill.png": [16, 16]
]
def invalidTextures = requiredTextures.findAll { path, size ->
def image = javax.imageio.ImageIO.read(file("anotherworld/src/main/resources/assets/anotherworld/textures/${path}"))
image == null || image.width != size[0] || image.height != size[1]
}.keySet()
if (rootProject.anotherworld_version != "0.0.0-alpha.50"
|| rootProject.sanctuary_version != "0.0.0-alpha.117"
|| migration.source?.modules != [anotherworld: "0.0.0-alpha.49", sanctuary: "0.0.0-alpha.116"]
|| migration.target?.modules != [anotherworld: "0.0.0-alpha.50", sanctuary: "0.0.0-alpha.117"]
|| migration.safe_vault?.footprint != "3x3_horizontal"
|| migration.safe_vault?.blocks_required != 9
|| migration.safe_vault?.accepted_items != ["anotherworld:ruby", "anotherworld:sapphire", "minecraft:emerald"]
|| migration.safe_vault?.shop_access_when_structure_unloaded != true
|| migration.raid?.continuous_use_ticks != 1200
|| migration.raid?.loot_percent != 20
|| migration.raid?.protection_ticks_after_success != 1728000
|| migration.compatibility?.anotherworld_source_data_version != 1
|| migration.compatibility?.anotherworld_target_data_version != 2
|| migration.compatibility?.anotherworld_network_protocol != 1
|| migration.compatibility?.sanctuary_network_protocol != 21
|| manifest.depends?.sanctuary != ">=0.0.0-alpha.117"
|| manifest.custom?.sanctuary26?.data_version != 2
|| !file("build.gradle").text.contains('implementation project(":sanctuary")')
|| !currencyApi.contains("public interface Provider")
|| !currencyApi.contains("countAdditional") || !currencyApi.contains("removeAdditional")
|| !rules.contains("STRUCTURE_WIDTH = 3") || !rules.contains("RAID_DURATION_TICKS = 60 * 20")
|| !rules.contains("RAID_LOOT_PERCENT = 20") || !rules.contains("24L * 60L * 60L * 20L")
|| !data.contains('SAVE_KEY = "safe_vaults"') || !data.contains("DATA_VERSION = 1")
|| safeRecipe.pattern != ["GGG", "GCG", "GGG"]
|| drillRecipe.pattern != ["TTT", "RPR", "FDF"]
|| !invalidTextures.isEmpty()) {
throw new GradleException("The safe-vault feature contract is incomplete: textures=${invalidTextures}")
}
}
}
tasks.named("verifyWorkspace") {
dependsOn tasks.named("verifySafeVaultFeature")
}
tasks.named("check") {
dependsOn tasks.named("verifyWorkspace")
dependsOn tasks.named("verifyTransport")
+2 -2
View File
@@ -16,7 +16,7 @@ ambiance_version=0.0.0-alpha.12
ambiance_lifecycle=active
redstoner_version=0.0.0-alpha.10
redstoner_lifecycle=active
anotherworld_version=0.0.0-alpha.49
anotherworld_version=0.0.0-alpha.50
anotherworld_lifecycle=active
itsalive_version=0.0.0-alpha.30
itsalive_lifecycle=active
@@ -28,7 +28,7 @@ iliketomoveit_version=0.0.0-alpha.13
iliketomoveit_lifecycle=active
onlyfun_version=0.0.0-alpha.19
onlyfun_lifecycle=active
sanctuary_version=0.0.0-alpha.116
sanctuary_version=0.0.0-alpha.117
sanctuary_lifecycle=active
pack_version=26.2.0-alpha.201
maven_group=fr.koka99cab.sanctuary26
@@ -0,0 +1,76 @@
{
"source": {
"pack_version": "26.2.0-alpha.201",
"modules": {
"anotherworld": "0.0.0-alpha.49",
"sanctuary": "0.0.0-alpha.116"
}
},
"target": {
"pack_version": "26.2.0-alpha.201",
"modules": {
"anotherworld": "0.0.0-alpha.50",
"sanctuary": "0.0.0-alpha.117"
}
},
"safe_vault": {
"owner": "anotherworld",
"shop_currency_owner": "sanctuary",
"footprint": "3x3_horizontal",
"blocks_required": 9,
"single_owner_required": true,
"maximum_active_vaults_per_player": 1,
"storage_slots": 27,
"accepted_items": [
"anotherworld:ruby",
"anotherworld:sapphire",
"minecraft:emerald"
],
"shop_access_when_structure_unloaded": true,
"storage_provider_api": "SanctuaryCurrencyStorage",
"save_key": "anotherworld_safe_vaults",
"save_data_version": 1
},
"raid": {
"tool": "anotherworld:titanium_drill",
"continuous_use_ticks": 1200,
"owner_must_be_online": true,
"loot_percent": 20,
"drill_consumed_on_success": true,
"protection_ticks_after_success": 1728000,
"server_authoritative": true
},
"recipes": {
"safe_block": {
"pattern": ["GGG", "GCG", "GGG"],
"ingredients": {
"G": "minecraft:gold_block",
"C": "minecraft:chest"
}
},
"titanium_drill": {
"pattern": ["TTT", "RPR", "FDF"],
"ingredients": {
"T": "anotherworld:titanium_ingot",
"R": "minecraft:redstone",
"P": "minecraft:piston",
"F": "minecraft:iron_block",
"D": "minecraft:diamond_pickaxe"
}
}
},
"compatibility": {
"anotherworld_source_data_version": 1,
"anotherworld_target_data_version": 2,
"anotherworld_network_protocol": 1,
"sanctuary_data_version": 11,
"sanctuary_network_protocol": 21,
"new_registry_ids": [
"anotherworld:safe_block",
"anotherworld:safe_vault",
"anotherworld:titanium_drill"
],
"existing_world_reset_required": false,
"pack_release_updated": false
}
}
+8 -8
View File
@@ -2893,7 +2893,7 @@ tasks.register("verifyProgressivePauseMenu") {
"pack/migrations/26.2.0-alpha.190-progressive-pause-menu-to-alpha.191.json"))
def pauseMenu = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/mixin/client/PauseScreenMixin.java").text
def costs = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/progression/SanctuaryProgressionCosts.java").text
if (project.version.toString() != "0.0.0-alpha.116"
if (project.version.toString() != "0.0.0-alpha.117"
|| migration.target?.pack_version != "26.2.0-alpha.191"
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.109"
|| migration.pause_menu?.progression_full_width != true
@@ -2931,7 +2931,7 @@ tasks.register("verifyShopPricingLayout") {
"pack/migrations/26.2.0-alpha.192-shop-pricing-layout-to-alpha.193.json"))
def screen = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/client/SanctuaryShopScreen.java").text
def progression = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/ShopProgression.java").text
if (project.version.toString() != "0.0.0-alpha.116"
if (project.version.toString() != "0.0.0-alpha.117"
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.110"
|| migration.shop_layout?.locked_offer_buttons != 6
|| migration.shop_layout?.button_slots != [4, 5, 6, 7, 8, 9]
@@ -2962,7 +2962,7 @@ tasks.register("verifyShopCsvBossGates") {
"pack/migrations/26.2.0-alpha.194-shop-csv-boss-gates-to-alpha.195.json"))
def provider = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/ShopCatalogProvider.java").text
def catalog = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/shop/ShopOfferCatalog.java").text
if (project.version.toString() != "0.0.0-alpha.116"
if (project.version.toString() != "0.0.0-alpha.117"
|| migration.target?.pack_version != "26.2.0-alpha.195"
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.111"
|| migration.compatibility?.sanctuary_data_version != 11
@@ -2993,7 +2993,7 @@ tasks.register("verifyDeliveryBoxOrientation") {
def blockstate = new JsonSlurper().parse(
file("src/main/resources/assets/sanctuary/blockstates/delivery_box.json"))
def expectedVariants = ["facing=north", "facing=east", "facing=south", "facing=west"].toSet()
if (project.version.toString() != "0.0.0-alpha.116"
if (project.version.toString() != "0.0.0-alpha.117"
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.112"
|| migration.mailbox?.id != "sanctuary:delivery_box"
|| migration.mailbox?.horizontal_facing != true
@@ -3021,7 +3021,7 @@ tasks.register("verifyInventoryShiftClick") {
def mixin = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/mixin/AbstractContainerMenuMixin.java").text
def screen = file("src/main/java/fr/koka99cab/sanctuary26/sanctuary/mixin/client/AbstractContainerScreenMixin.java").text
def gui = file("INVENTORY_GUI.md").text
if (project.version.toString() != "0.0.0-alpha.116"
if (project.version.toString() != "0.0.0-alpha.117"
|| !transfer.contains("shouldAppendOverflow")
|| !transfer.contains("isVanillaStorageRange")
|| !transfer.contains("hotbarStart")
@@ -3067,7 +3067,7 @@ tasks.register("verifyQuestRequests") {
new JsonSlurper().parse(file("src/main/resources/data/sanctuary/loot_table/blocks/${path}.json"))
.pools[0].entries[0].name
}
if (project.version.toString() != "0.0.0-alpha.116"
if (project.version.toString() != "0.0.0-alpha.117"
|| migration.target?.modules?.sanctuary != "0.0.0-alpha.113"
|| migration.quest_requests?.save_key != "quest_requests"
|| migration.quest_requests?.data_version != 1
@@ -3125,7 +3125,7 @@ tasks.register("verifyQuestRequestContracts") {
def locales = ["fr_fr", "en_us", "ru_ru"].collectEntries { locale ->
[(locale): new JsonSlurper().parse(file("src/main/resources/assets/sanctuary/lang/${locale}.json"))]
}
if (project.version.toString() != "0.0.0-alpha.116"
if (project.version.toString() != "0.0.0-alpha.117"
|| migration.source?.pack_version != "26.2.0-alpha.198"
|| migration.source?.modules?.sanctuary != "0.0.0-alpha.114"
|| migration.target?.pack_version != "26.2.0-alpha.199"
@@ -3194,7 +3194,7 @@ tasks.register("verifyQuestRequestEscrow") {
def locales = ["fr_fr", "en_us", "ru_ru"].collectEntries { locale ->
[(locale): new JsonSlurper().parse(file("src/main/resources/assets/sanctuary/lang/${locale}.json"))]
}
if (project.version.toString() != "0.0.0-alpha.116"
if (project.version.toString() != "0.0.0-alpha.117"
|| migration.source?.pack_version != "26.2.0-alpha.200"
|| migration.source?.modules?.sanctuary != "0.0.0-alpha.115"
|| migration.target?.pack_version != "26.2.0-alpha.201"
@@ -0,0 +1,61 @@
package fr.koka99cab.sanctuary26.sanctuary.api.inventory;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.Item;
/**
* Public extension point for player-owned currency stores outside the Sanctuary inventory.
*
* <p>Providers keep ownership of their data and must validate every mutation on the server.
* Sanctuary only aggregates their balances for Shop and Black Market transactions.</p>
*/
public final class SanctuaryCurrencyStorage {
private static final Map<Identifier, Provider> PROVIDERS = new LinkedHashMap<>();
private SanctuaryCurrencyStorage() {
}
public static synchronized void register(Identifier id, Provider provider) {
Objects.requireNonNull(id, "id");
Objects.requireNonNull(provider, "provider");
if (PROVIDERS.putIfAbsent(id, provider) != null) {
throw new IllegalStateException("Currency storage provider already registered: " + id);
}
}
public static int countAdditional(ServerPlayer player, Item item) {
if (player == null || item == null) return 0;
long count = 0L;
for (Provider provider : snapshot()) {
count += Math.max(0, provider.count(player, item));
if (count >= Integer.MAX_VALUE) return Integer.MAX_VALUE;
}
return (int) count;
}
public static int removeAdditional(ServerPlayer player, Item item, int amount) {
if (player == null || item == null || amount <= 0) return 0;
int remaining = amount;
for (Provider provider : snapshot()) {
if (remaining <= 0) break;
int removed = Math.clamp(provider.remove(player, item, remaining), 0, remaining);
remaining -= removed;
}
return amount - remaining;
}
private static synchronized java.util.List<Provider> snapshot() {
return java.util.List.copyOf(PROVIDERS.values());
}
public interface Provider {
int count(ServerPlayer player, Item item);
/** Returns the exact number removed, between zero and {@code amount}. */
int remove(ServerPlayer player, Item item, int amount);
}
}
@@ -2,6 +2,7 @@ package fr.koka99cab.sanctuary26.sanctuary.shop;
import fr.koka99cab.sanctuary26.sanctuary.SanctuaryMod;
import fr.koka99cab.sanctuary26.sanctuary.api.inventory.SanctuaryPlayerInventoryView;
import fr.koka99cab.sanctuary26.sanctuary.api.inventory.SanctuaryCurrencyStorage;
import fr.koka99cab.sanctuary26.sanctuary.network.BlackMarketCreatePayload;
import fr.koka99cab.sanctuary26.sanctuary.network.BlackMarketEditorPayload;
import fr.koka99cab.sanctuary26.sanctuary.gameplay.SanctuaryOverflowAccess;
@@ -354,7 +355,7 @@ public final class BlackMarketService {
private static int countCurrency(ServerPlayer player, Item item) { return countPlayerItem(player, item); }
static int countPlayerItem(ServerPlayer player, Item item) {
if (item == null) return 0;
long count = 0L;
long count = SanctuaryCurrencyStorage.countAdditional(player, item);
for (ItemStack stack : currencyStacks(player)) {
if (stack.is(item)) count += stack.getCount();
}
@@ -372,6 +373,7 @@ public final class BlackMarketService {
}
player.getInventory().setChanged();
SanctuaryOverflowAccess.of(player).setChanged();
if (remaining > 0) SanctuaryCurrencyStorage.removeAdditional(player, item, remaining);
}
/**