diff options
62 files changed, 331 insertions, 175 deletions
diff --git a/build.gradle b/build.gradle index 82b1470..0f72939 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,8 @@ repositories { maven { url 'https://maven.nucleoid.xyz' } maven { url = "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" } maven { url 'https://jitpack.io' } + maven { url "https://maven.shedaniel.me/" } + maven { url "https://maven.terraformersmc.com/releases/" } } dependencies { @@ -34,9 +36,13 @@ dependencies { modImplementation include("eu.pb4:polymer-core:${project.polymer_version}") modImplementation include("eu.pb4:polymer-resource-pack:${project.polymer_version}") modImplementation include("fr.catcore:server-translations-api:${project.sta_version}") - modImplementation ("com.github.DaFuqs:Revelationary:${project.revelationary_version}") + modImplementation("com.github.DaFuqs:Revelationary:${project.revelationary_version}") + modApi("me.shedaniel.cloth:cloth-config-fabric:9.0.94") { + exclude(group: "net.fabricmc.fabric-api") + } + modApi("com.terraformersmc:modmenu:5.0.2") - //runtime only for development + //runtime only for development modRuntimeOnly("me.djtheredstoner:DevAuth-fabric:1.1.0") } diff --git a/src/main/generated/data/minecraft/advancements/ygasi/druidry.json b/src/main/generated/data/ygasi/advancements/druidry/druidry.json index fa73a5e..6a7f771 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/druidry.json +++ b/src/main/generated/data/ygasi/advancements/druidry/druidry.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/root", + "parent": "ygasi:root", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/root" + "advancement_identifier": "ygasi:root" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/nature1.json b/src/main/generated/data/ygasi/advancements/druidry/nature1.json index 46f1aa7..699fafc 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/nature1.json +++ b/src/main/generated/data/ygasi/advancements/druidry/nature1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/druidry", + "parent": "ygasi:druidry/druidry", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/druidry" + "advancement_identifier": "ygasi:druidry/druidry" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/nature2.json b/src/main/generated/data/ygasi/advancements/druidry/nature2.json index f70c0a3..a4d4d99 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/nature2.json +++ b/src/main/generated/data/ygasi/advancements/druidry/nature2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/nature1", + "parent": "ygasi:druidry/nature1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/nature1" + "advancement_identifier": "ygasi:druidry/nature1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/nature3.json b/src/main/generated/data/ygasi/advancements/druidry/nature3.json index f198e1e..446e547 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/nature3.json +++ b/src/main/generated/data/ygasi/advancements/druidry/nature3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/nature2", + "parent": "ygasi:druidry/nature2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/nature2" + "advancement_identifier": "ygasi:druidry/nature2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/necromancy1.json b/src/main/generated/data/ygasi/advancements/druidry/necromancy1.json index d8afc8f..9b7e65b 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/necromancy1.json +++ b/src/main/generated/data/ygasi/advancements/druidry/necromancy1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/druidry", + "parent": "ygasi:druidry/druidry", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/druidry" + "advancement_identifier": "ygasi:druidry/druidry" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/necromancy2.json b/src/main/generated/data/ygasi/advancements/druidry/necromancy2.json index 7840604..07417af 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/necromancy2.json +++ b/src/main/generated/data/ygasi/advancements/druidry/necromancy2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/necromancy1", + "parent": "ygasi:druidry/necromancy1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/necromancy1" + "advancement_identifier": "ygasi:druidry/necromancy1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/necromancy3.json b/src/main/generated/data/ygasi/advancements/druidry/necromancy3.json index 39295bf..b87d156 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/necromancy3.json +++ b/src/main/generated/data/ygasi/advancements/druidry/necromancy3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/necromancy2", + "parent": "ygasi:druidry/necromancy2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/necromancy2" + "advancement_identifier": "ygasi:druidry/necromancy2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/protean1.json b/src/main/generated/data/ygasi/advancements/druidry/protean1.json index 0ff6471..9f8d0aa 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/protean1.json +++ b/src/main/generated/data/ygasi/advancements/druidry/protean1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/druidry", + "parent": "ygasi:druidry/druidry", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/druidry" + "advancement_identifier": "ygasi:druidry/druidry" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/protean2.json b/src/main/generated/data/ygasi/advancements/druidry/protean2.json index eb99cac..c374b55 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/protean2.json +++ b/src/main/generated/data/ygasi/advancements/druidry/protean2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/protean1", + "parent": "ygasi:druidry/protean1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/protean1" + "advancement_identifier": "ygasi:druidry/protean1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/protean3.json b/src/main/generated/data/ygasi/advancements/druidry/protean3.json index a4b7054..c3dea82 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/protean3.json +++ b/src/main/generated/data/ygasi/advancements/druidry/protean3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/protean2", + "parent": "ygasi:druidry/protean2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/protean2" + "advancement_identifier": "ygasi:druidry/protean2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/extra.json b/src/main/generated/data/ygasi/advancements/extra/extra.json index c4ae6f2..87942dc 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/extra.json +++ b/src/main/generated/data/ygasi/advancements/extra/extra.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/root", + "parent": "ygasi:root", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/root" + "advancement_identifier": "ygasi:root" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/defence1.json b/src/main/generated/data/ygasi/advancements/mercenary/defence1.json index bdfcdc0..4a2b6fd 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/defence1.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/defence1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/mercenary", + "parent": "ygasi:mercenary/mercenary", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/mercenary" + "advancement_identifier": "ygasi:mercenary/mercenary" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/defence2.json b/src/main/generated/data/ygasi/advancements/mercenary/defence2.json index d6e66a0..a2a3f6f 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/defence2.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/defence2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/defence1", + "parent": "ygasi:mercenary/defence1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/defence1" + "advancement_identifier": "ygasi:mercenary/defence1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/defence3.json b/src/main/generated/data/ygasi/advancements/mercenary/defence3.json index 5567889..698eb53 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/defence3.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/defence3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/defence2", + "parent": "ygasi:mercenary/defence2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/defence2" + "advancement_identifier": "ygasi:mercenary/defence2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/mercenary.json b/src/main/generated/data/ygasi/advancements/mercenary/mercenary.json index 85339ae..8950609 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/mercenary.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/mercenary.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/root", + "parent": "ygasi:root", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/root" + "advancement_identifier": "ygasi:root" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/ninja1.json b/src/main/generated/data/ygasi/advancements/mercenary/ninja1.json index eaf63a0..dbc4ae4 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/ninja1.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/ninja1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/mercenary", + "parent": "ygasi:mercenary/mercenary", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/mercenary" + "advancement_identifier": "ygasi:mercenary/mercenary" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/ninja2.json b/src/main/generated/data/ygasi/advancements/mercenary/ninja2.json index a3d229b..d9e8469 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/ninja2.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/ninja2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/ninja1", + "parent": "ygasi:mercenary/ninja1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/ninja1" + "advancement_identifier": "ygasi:mercenary/ninja1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/ninja3.json b/src/main/generated/data/ygasi/advancements/mercenary/ninja3.json index f3435ce..97d5fd7 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/ninja3.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/ninja3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/ninja2", + "parent": "ygasi:mercenary/ninja2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/ninja2" + "advancement_identifier": "ygasi:mercenary/ninja2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/offence1.json b/src/main/generated/data/ygasi/advancements/mercenary/offence1.json index ede1593..5c1298e 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/offence1.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/offence1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/mercenary", + "parent": "ygasi:mercenary/mercenary", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/mercenary" + "advancement_identifier": "ygasi:mercenary/mercenary" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/offence2.json b/src/main/generated/data/ygasi/advancements/mercenary/offence2.json index 7d3a72e..659d52b 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/offence2.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/offence2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/offence1", + "parent": "ygasi:mercenary/offence1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/offence1" + "advancement_identifier": "ygasi:mercenary/offence1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/offence3.json b/src/main/generated/data/ygasi/advancements/mercenary/offence3.json index b70eeae..c8ff8cd 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/offence3.json +++ b/src/main/generated/data/ygasi/advancements/mercenary/offence3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/offence2", + "parent": "ygasi:mercenary/offence2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/offence2" + "advancement_identifier": "ygasi:mercenary/offence2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/root.json b/src/main/generated/data/ygasi/advancements/root.json index c23d33c..8527500 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/root.json +++ b/src/main/generated/data/ygasi/advancements/root.json @@ -15,7 +15,7 @@ "icon": { "item": "minecraft:diamond" }, - "show_toast": false, + "show_toast": true, "title": { "translate": "advancements.ygasi.root.title" } diff --git a/src/main/generated/data/minecraft/advancements/ygasi/element1.json b/src/main/generated/data/ygasi/advancements/wizardry/element1.json index 199af31..1e9e039 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/element1.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/element1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/wizardry", + "parent": "ygasi:wizardry/wizardry", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/wizardry" + "advancement_identifier": "ygasi:wizardry/wizardry" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/element2.json b/src/main/generated/data/ygasi/advancements/wizardry/element2.json index 54e758f..fc1f021 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/element2.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/element2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/element1", + "parent": "ygasi:wizardry/element1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/element1" + "advancement_identifier": "ygasi:wizardry/element1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/element3.json b/src/main/generated/data/ygasi/advancements/wizardry/element3.json index 8bd713f..1ce2a04 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/element3.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/element3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/element2", + "parent": "ygasi:wizardry/element2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/element2" + "advancement_identifier": "ygasi:wizardry/element2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/fight1.json b/src/main/generated/data/ygasi/advancements/wizardry/fight1.json index 08879a8..27d4d87 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/fight1.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/fight1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/wizardry", + "parent": "ygasi:wizardry/wizardry", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/wizardry" + "advancement_identifier": "ygasi:wizardry/wizardry" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/fight2.json b/src/main/generated/data/ygasi/advancements/wizardry/fight2.json index ad7f6d8..b241ba2 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/fight2.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/fight2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/fight1", + "parent": "ygasi:wizardry/fight1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/fight1" + "advancement_identifier": "ygasi:wizardry/fight1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/fight3.json b/src/main/generated/data/ygasi/advancements/wizardry/fight3.json index e8360a1..6ce8c5a 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/fight3.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/fight3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/fight2", + "parent": "ygasi:wizardry/fight2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/fight2" + "advancement_identifier": "ygasi:wizardry/fight2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/force1.json b/src/main/generated/data/ygasi/advancements/wizardry/force1.json index 5e88eff..06d23af 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/force1.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/force1.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/wizardry", + "parent": "ygasi:wizardry/wizardry", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/wizardry" + "advancement_identifier": "ygasi:wizardry/wizardry" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/force2.json b/src/main/generated/data/ygasi/advancements/wizardry/force2.json index e8bb729..9533e8b 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/force2.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/force2.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/force1", + "parent": "ygasi:wizardry/force1", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/force1" + "advancement_identifier": "ygasi:wizardry/force1" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/force3.json b/src/main/generated/data/ygasi/advancements/wizardry/force3.json index f95f569..414323f 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/force3.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/force3.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/force2", + "parent": "ygasi:wizardry/force2", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/force2" + "advancement_identifier": "ygasi:wizardry/force2" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/generated/data/minecraft/advancements/ygasi/wizardry.json b/src/main/generated/data/ygasi/advancements/wizardry/wizardry.json index e28c0e2..39417bd 100644 --- a/src/main/generated/data/minecraft/advancements/ygasi/wizardry.json +++ b/src/main/generated/data/ygasi/advancements/wizardry/wizardry.json @@ -1,9 +1,9 @@ { - "parent": "minecraft:ygasi/root", + "parent": "ygasi:root", "criteria": { "gotten_previous": { "conditions": { - "advancement_identifier": "minecraft:ygasi/root" + "advancement_identifier": "ygasi:root" }, "trigger": "revelationary:advancement_gotten" }, diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence1.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence1.java index 22ec265..05708d3 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence1.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence1.java @@ -6,13 +6,13 @@ import net.minecraft.util.Identifier; public class Defence1 { public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/defence1")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/defence1"), "unlocked_defence1"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/defence1")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/defence1"), "unlocked_defence1"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/defence1")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/defence1"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/defence1")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/defence1"); } } } diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence2.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence2.java index 3a47e89..56996fa 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence2.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence2.java @@ -6,13 +6,13 @@ import net.minecraft.util.Identifier; public class Defence2 { public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/defence2")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/defence2"), "unlocked_defence2"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/defence2")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/defence2"), "unlocked_defence2"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/defence2")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/defence2"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/defence2")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/defence2"); } } } diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence3.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence3.java index 39241aa..4f16549 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence3.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Defence3.java @@ -6,13 +6,13 @@ import net.minecraft.util.Identifier; public class Defence3 { public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/defence3")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/defence3"), "unlocked_defence3"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/defence3")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/defence3"), "unlocked_defence3"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/defence3")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/defence3"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/defence3")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/defence3"); } } } diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja1.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja1.java index 09ac5b2..c0d3664 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja1.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja1.java @@ -6,13 +6,13 @@ import net.minecraft.util.Identifier; public class Ninja1 { public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/ninja1")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/ninja1"), "unlocked_ninja1"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/ninja1")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/ninja1"), "unlocked_ninja1"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/ninja1")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/ninja1"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/ninja1")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/ninja1"); } } } diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja2.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja2.java index e673d83..308c84a 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja2.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja2.java @@ -6,13 +6,13 @@ import net.minecraft.util.Identifier; public class Ninja2 { public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/ninja2")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/ninja2"), "unlocked_ninja2"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/ninja2")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/ninja2"), "unlocked_ninja2"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/ninja2")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/ninja2"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/ninja2")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/ninja2"); } } } diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja3.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja3.java index 818da0f..037ec0d 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja3.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Ninja3.java @@ -6,13 +6,13 @@ import net.minecraft.util.Identifier; public class Ninja3 { public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/ninja3")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/ninja3"), "unlocked_ninja3"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/ninja3")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/ninja3"), "unlocked_ninja3"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/ninja3")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/ninja3"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/ninja3")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/ninja3"); } } } diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence1.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence1.java index 506fa18..135dff0 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence1.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence1.java @@ -12,13 +12,13 @@ public class Offence1 { public static Map<String, Boolean> attackList = new HashMap<>(); public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence1")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/offence1"), "unlocked_offence1"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence1")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/offence1"), "unlocked_offence1"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence1")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/offence1"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence1")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/offence1"); } } }
\ No newline at end of file diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence2.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence2.java index 9b99592..19ffd49 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence2.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence2.java @@ -1,18 +1,54 @@ package dev.mayaqq.ygasi.abilities.mercenary; import dev.mayaqq.ygasi.util.AdvUtils; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityData; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnReason; +import net.minecraft.entity.decoration.ArmorStandEntity; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.server.command.SummonCommand; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.text.Text; +import net.minecraft.util.Hand; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class Offence2 { + public static Map<String, ArrayList<String>> playerSwords = new HashMap<>(); public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence2")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/offence2"), "unlocked_offence2"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence2")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/offence2"), "unlocked_offence2"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence2")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/offence2"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence2")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/offence2"); + } + } + public static void summonStand(ServerPlayerEntity player, Integer sword) { + BlockPos pos = player.getBlockPos(); + ServerWorld world = player.getWorld(); + ArmorStandEntity armorStand = new ArmorStandEntity(world, pos.getX(), pos.getY(), pos.getZ()); + armorStand.setCustomName(Text.of(armorStand.getUuidAsString())); + armorStand.setCustomNameVisible(true); + armorStand.setStackInHand(Hand.MAIN_HAND, player.getMainHandStack()); + if (playerSwords.get(player.getUuidAsString()) != null) { + playerSwords.get(player.getUuidAsString()).add(armorStand.getUuidAsString()); + } else { + ArrayList<String> swords = new ArrayList<>(); + swords.add(armorStand.getUuidAsString()); + playerSwords.put(player.getUuidAsString(), swords); } + world.spawnEntity(armorStand); } } diff --git a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence3.java b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence3.java index 86efbc6..85b4c3c 100644 --- a/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence3.java +++ b/src/main/java/dev/mayaqq/ygasi/abilities/mercenary/Offence3.java @@ -6,13 +6,13 @@ import net.minecraft.util.Identifier; public class Offence3 { public static void give(ServerPlayerEntity player) { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence3")) { - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/offence3"), "unlocked_offence3"); + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence3")) { + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "mercenary/offence3"), "unlocked_offence3"); } } public static void revoke(ServerPlayerEntity player) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence3")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/offence3"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence3")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary/offence3"); } } } diff --git a/src/main/java/dev/mayaqq/ygasi/dataGen/advancements/YgasiAdvancements.java b/src/main/java/dev/mayaqq/ygasi/dataGen/advancements/YgasiAdvancements.java index e95ce6f..6d66a7c 100644 --- a/src/main/java/dev/mayaqq/ygasi/dataGen/advancements/YgasiAdvancements.java +++ b/src/main/java/dev/mayaqq/ygasi/dataGen/advancements/YgasiAdvancements.java @@ -16,157 +16,162 @@ public class YgasiAdvancements implements Consumer<Consumer<Advancement>> { @Override public void accept(Consumer<Advancement> consumer) { + String mercenaryPath = "ygasi:mercenary/"; + String wizardryPath = "ygasi:wizardry/"; + String druidryPath = "ygasi:druidry/"; + String extraPath = "ygasi:extra/"; + //main root advancement Advancement rootAdvancement = Advancement.Builder.create().display(Items.DIAMOND, // The display icon Text.translatable("advancements.ygasi.root.title"), // The title Text.translatable("advancements.ygasi.root.description"), // The description new Identifier("textures/block/sculk_catalyst_top.png"), // Background image used AdvancementFrame.CHALLENGE, // Options: TASK, CHALLENGE, GOAL - false, // Show toast top right + true, // Show toast top right false, // Announce to chat false // Hidden in the advancement tab - ).criterion("opened_skill_menu", new ImpossibleCriterion.Conditions()).rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/root"); + ).criterion("opened_skill_menu", new ImpossibleCriterion.Conditions()).rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi:root"); //branch advancements Advancement mercenary = Advancement.Builder.create().parent(rootAdvancement) .display(Items.DIAMOND_SWORD, Text.translatable("advancements.ygasi.mercenary.title"), Text.translatable("advancements.ygasi.mercenary.description"), null, AdvancementFrame.GOAL, false, false, false) .criterion("unlocked_mercenary", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, rootAdvancement.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/mercenary"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "mercenary"); Advancement wizardry = Advancement.Builder.create().parent(rootAdvancement) .display(Items.BLAZE_ROD, Text.translatable("advancements.ygasi.wizardry.title"), Text.translatable("advancements.ygasi.wizardry.description"), null, AdvancementFrame.GOAL, false, false, false) .criterion("unlocked_wizardry", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, rootAdvancement.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/wizardry"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "wizardry"); Advancement druidry = Advancement.Builder.create().parent(rootAdvancement) .display(Items.OAK_SAPLING, Text.translatable("advancements.ygasi.druidry.title"), Text.translatable("advancements.ygasi.druidry.description"), null, AdvancementFrame.GOAL, false, false, false) .criterion("unlocked_druidry", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, rootAdvancement.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/druidry"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "druidry"); Advancement extra = Advancement.Builder.create().parent(rootAdvancement) .display(Items.EMERALD, Text.translatable("advancements.ygasi.extra.title"), Text.translatable("advancements.ygasi.extra.description"), null, AdvancementFrame.GOAL, false, false, false) .criterion("unlocked_extra", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, rootAdvancement.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/extra"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, extraPath + "extra"); //mercenary skills Advancement offence1 = Advancement.Builder.create().parent(mercenary) .display(Items.IRON_SWORD, Text.translatable("advancements.ygasi.mercenary.offence1.title"), Text.translatable("advancements.ygasi.mercenary.offence1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_offence1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, mercenary.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/offence1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "offence1"); Advancement offence2 = Advancement.Builder.create().parent(offence1) .display(Items.IRON_SWORD, Text.translatable("advancements.ygasi.mercenary.offence2.title"), Text.translatable("advancements.ygasi.mercenary.offence2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_offence2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, offence1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/offence2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "offence2"); Advancement offence3 = Advancement.Builder.create().parent(offence2) .display(Items.IRON_SWORD, Text.translatable("advancements.ygasi.mercenary.offence3.title"), Text.translatable("advancements.ygasi.mercenary.offence3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_offence3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, offence2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/offence3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "offence3"); Advancement ninja1 = Advancement.Builder.create().parent(mercenary) .display(Items.BAMBOO, Text.translatable("advancements.ygasi.mercenary.ninja1.title"), Text.translatable("advancements.ygasi.mercenary.ninja1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_ninja1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, mercenary.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/ninja1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "ninja1"); Advancement ninja2 = Advancement.Builder.create().parent(ninja1) .display(Items.BAMBOO, Text.translatable("advancements.ygasi.mercenary.ninja2.title"), Text.translatable("advancements.ygasi.mercenary.ninja2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_ninja2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, ninja1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/ninja2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "ninja2"); Advancement ninja3 = Advancement.Builder.create().parent(ninja2) .display(Items.BAMBOO, Text.translatable("advancements.ygasi.mercenary.ninja3.title"), Text.translatable("advancements.ygasi.mercenary.ninja3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_ninja3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, ninja2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/ninja3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "ninja3"); Advancement defence1 = Advancement.Builder.create().parent(mercenary) .display(Items.IRON_CHESTPLATE, Text.translatable("advancements.ygasi.mercenary.defence1.title"), Text.translatable("advancements.ygasi.mercenary.defence1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_defence1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, mercenary.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/defence1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "defence1"); Advancement defence2 = Advancement.Builder.create().parent(defence1) .display(Items.IRON_CHESTPLATE, Text.translatable("advancements.ygasi.mercenary.defence2.title"), Text.translatable("advancements.ygasi.mercenary.defence2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_defence2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, defence1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/defence2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "defence2"); Advancement defence3 = Advancement.Builder.create().parent(defence2) .display(Items.IRON_CHESTPLATE, Text.translatable("advancements.ygasi.mercenary.defence3.title"), Text.translatable("advancements.ygasi.mercenary.defence3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_defence3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, defence2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/defence3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, mercenaryPath + "defence3"); //wizardry skills Advancement fight1 = Advancement.Builder.create().parent(wizardry) .display(Items.BLAZE_POWDER, Text.translatable("advancements.ygasi.wizardry.fight1.title"), Text.translatable("advancements.ygasi.wizardry.fight1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_fight1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, wizardry.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/fight1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "fight1"); Advancement fight2 = Advancement.Builder.create().parent(fight1) .display(Items.BLAZE_POWDER, Text.translatable("advancements.ygasi.wizardry.fight2.title"), Text.translatable("advancements.ygasi.wizardry.fight2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_fight2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, fight1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/fight2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "fight2"); Advancement fight3 = Advancement.Builder.create().parent(fight2) .display(Items.BLAZE_POWDER, Text.translatable("advancements.ygasi.wizardry.fight3.title"), Text.translatable("advancements.ygasi.wizardry.fight3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_fight3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, fight2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/fight3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "fight3"); Advancement element1 = Advancement.Builder.create().parent(wizardry) .display(Items.FIRE_CHARGE, Text.translatable("advancements.ygasi.wizardry.element1.title"), Text.translatable("advancements.ygasi.wizardry.element1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_element1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, wizardry.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/element1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "element1"); Advancement element2 = Advancement.Builder.create().parent(element1) .display(Items.FIRE_CHARGE, Text.translatable("advancements.ygasi.wizardry.element2.title"), Text.translatable("advancements.ygasi.wizardry.element2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_element2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, element1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/element2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "element2"); Advancement element3 = Advancement.Builder.create().parent(element2) .display(Items.FIRE_CHARGE, Text.translatable("advancements.ygasi.wizardry.element3.title"), Text.translatable("advancements.ygasi.wizardry.element3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_element3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, element2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/element3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "element3"); Advancement force1 = Advancement.Builder.create().parent(wizardry) .display(Items.ENDER_PEARL, Text.translatable("advancements.ygasi.wizardry.force1.title"), Text.translatable("advancements.ygasi.wizardry.force1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_force1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, wizardry.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/force1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "force1"); Advancement force2 = Advancement.Builder.create().parent(force1) .display(Items.ENDER_PEARL, Text.translatable("advancements.ygasi.wizardry.force2.title"), Text.translatable("advancements.ygasi.wizardry.force2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_force2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, force1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/force2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "force2"); Advancement force3 = Advancement.Builder.create().parent(force2) .display(Items.ENDER_PEARL, Text.translatable("advancements.ygasi.wizardry.force3.title"), Text.translatable("advancements.ygasi.wizardry.force3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_force3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, force2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/force3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, wizardryPath + "force3"); //druidry skills Advancement necromancy1 = Advancement.Builder.create().parent(druidry) .display(Items.BONE, Text.translatable("advancements.ygasi.druidry.necromancy1.title"), Text.translatable("advancements.ygasi.druidry.necromancy1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_necromancy1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, druidry.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/necromancy1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "necromancy1"); Advancement necromancy2 = Advancement.Builder.create().parent(necromancy1) .display(Items.BONE, Text.translatable("advancements.ygasi.druidry.necromancy2.title"), Text.translatable("advancements.ygasi.druidry.necromancy2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_necromancy2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, necromancy1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/necromancy2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "necromancy2"); Advancement necromancy3 = Advancement.Builder.create().parent(necromancy2) .display(Items.BONE, Text.translatable("advancements.ygasi.druidry.necromancy3.title"), Text.translatable("advancements.ygasi.druidry.necromancy3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_necromancy3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, necromancy2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/necromancy3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "necromancy3"); Advancement nature1 = Advancement.Builder.create().parent(druidry) .display(Items.GRASS_BLOCK, Text.translatable("advancements.ygasi.druidry.nature1.title"), Text.translatable("advancements.ygasi.druidry.nature1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_nature1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, druidry.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/nature1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "nature1"); Advancement nature2 = Advancement.Builder.create().parent(nature1) .display(Items.GRASS_BLOCK, Text.translatable("advancements.ygasi.druidry.nature2.title"), Text.translatable("advancements.ygasi.druidry.nature2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_nature2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, nature1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/nature2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "nature2"); Advancement nature3 = Advancement.Builder.create().parent(nature2) .display(Items.GRASS_BLOCK, Text.translatable("advancements.ygasi.druidry.nature3.title"), Text.translatable("advancements.ygasi.druidry.nature3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_nature3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, nature2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/nature3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "nature3"); Advancement protean1 = Advancement.Builder.create().parent(druidry) .display(Items.SLIME_BALL, Text.translatable("advancements.ygasi.druidry.protean1.title"), Text.translatable("advancements.ygasi.druidry.protean1.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_protean1", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, druidry.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/protean1"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "protean1"); Advancement protean2 = Advancement.Builder.create().parent(protean1) .display(Items.SLIME_BALL, Text.translatable("advancements.ygasi.druidry.protean2.title"), Text.translatable("advancements.ygasi.druidry.protean2.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_protean2", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, protean1.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/protean2"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "protean2"); Advancement protean3 = Advancement.Builder.create().parent(protean2) .display(Items.SLIME_BALL, Text.translatable("advancements.ygasi.druidry.protean3.title"), Text.translatable("advancements.ygasi.druidry.protean3.description"), null, AdvancementFrame.TASK, false, false, true) .criterion("unlocked_protean3", new ImpossibleCriterion.Conditions()).criterion("gotten_previous", new AdvancementGottenCriterion.Conditions(EntityPredicate.Extended.EMPTY, protean2.getId())) - .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, "ygasi" + "/protean3"); + .rewards(AdvancementRewards.Builder.experience(1)).build(consumer, druidryPath + "protean3"); //extra diff --git a/src/main/java/dev/mayaqq/ygasi/events/ClickEvent.java b/src/main/java/dev/mayaqq/ygasi/events/ClickEvent.java new file mode 100644 index 0000000..c735fa4 --- /dev/null +++ b/src/main/java/dev/mayaqq/ygasi/events/ClickEvent.java @@ -0,0 +1,59 @@ +package dev.mayaqq.ygasi.events; + +import dev.mayaqq.ygasi.abilities.mercenary.Offence2; +import dev.mayaqq.ygasi.util.AdvUtils; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; +import net.minecraft.item.SwordItem; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.util.Identifier; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import static dev.mayaqq.ygasi.Ygasi.LOGGER; +import static dev.mayaqq.ygasi.abilities.mercenary.Offence2.playerSwords; + +public class ClickEvent { + public static Map<String, Integer> playerCharge = new HashMap<>(); + public static Map<String, Integer> swords = new HashMap<>(); + private static Integer tick = 0; + public static void onTick() { + ServerTickEvents.END_SERVER_TICK.register(server -> { + tick++; + server.getPlayerManager().getPlayerList().forEach(player -> { + if (playerSwords.get(player.getUuidAsString()) != null && player.getWorld().getEntity(UUID.fromString(playerSwords.get(player.getUuidAsString()).get(0))) != null) { + playerSwords.get(player.getUuidAsString()).forEach(uuid -> { + player.getWorld().getEntity(UUID.fromString(uuid)).setPos(player.getX(), player.getY(), player.getZ()); + }); + } + if (tick == 20) { + if (player.isSneaking() && player.getMainHandStack().getItem() instanceof SwordItem && AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence2")) { + if (swords.getOrDefault(player.getUuidAsString(), 0) >= 3) { + return; + } + if (playerCharge.getOrDefault(player.getUuidAsString(), 0) == 5) { + playerCharge.remove(player.getUuidAsString()); + + swords.put(player.getUuidAsString(), swords.getOrDefault(player.getUuidAsString(), 0) + 1); + Offence2.summonStand((ServerPlayerEntity) player, swords.get(player.getUuidAsString())); + player.playSound(SoundEvent.of(new Identifier("entity.experience_orb.pickup")), SoundCategory.PLAYERS, 1.0F, 1.0F); + LOGGER.info("Sword charge: " + swords.get(player.getUuidAsString())); + } else { + playerCharge.put(player.getUuidAsString(), playerCharge.getOrDefault(player.getUuidAsString(), 0) + 1); + player.playSound(SoundEvent.of(new Identifier("block.note_block.harp")), SoundCategory.PLAYERS, 1.0F, playerCharge.get(player.getUuidAsString()).floatValue() / 3); + LOGGER.info("Player charge: " + playerCharge.get(player.getUuidAsString())); + } + } else { + playerCharge.remove(player.getUuidAsString()); + } + } + }); + if (tick == 20) { + tick = 0; + } + }); + } +} diff --git a/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java b/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java index 97cd225..6723d01 100644 --- a/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java +++ b/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java @@ -2,8 +2,12 @@ package dev.mayaqq.ygasi.events; import dev.mayaqq.ygasi.registry.ConfigRegistry; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; +import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; +import java.util.UUID; + +import static dev.mayaqq.ygasi.abilities.mercenary.Offence2.playerSwords; import static dev.mayaqq.ygasi.registry.ItemRegistry.SKILL_BOOK; public class PlayerConnectEvent { @@ -16,4 +20,15 @@ public class PlayerConnectEvent { } }); } + public static void onPlayerDisconnect() { + ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> { + if (playerSwords.get(handler.player.getUuidAsString()) != null) { + playerSwords.get(handler.player.getUuidAsString()).forEach(uuid -> { + Entity sword = handler.player.getWorld().getEntity(UUID.fromString(uuid)); + sword.remove(Entity.RemovalReason.DISCARDED); + }); + playerSwords.remove(handler.player.getUuidAsString()); + } + }); + } }
\ No newline at end of file diff --git a/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java b/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java index 728f976..3c8e486 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/BranchGui.java @@ -57,14 +57,14 @@ public class BranchGui { //branch items //mercenary gui button - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/mercenary")) { + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/mercenary")) { gui.setSlot(11, new GuiElementBuilder() .setItem(Items.DIAMOND_SWORD) .setCustomModelData(1) .hideFlag(ItemStack.TooltipSection.MODIFIERS) .addLoreLine(Text.translatable("gui.ygasi.branch.cost", cost)) .setName(Text.translatable("gui.ygasi.branch.mercenary.title").formatted(Formatting.BOLD)) - .setCallback((index, clickType, actionType) -> save(player, "mercenary", "gui.ygasi.branch.mercenary.title")) + .setCallback((index, clickType, actionType) -> save(player, "mercenary/mercenary", "gui.ygasi.branch.mercenary.title")) ); } else { gui.setSlot(11, new GuiElementBuilder() @@ -89,7 +89,7 @@ public class BranchGui { /* //wizardry gui button - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/wizardry")) { + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "wizardry/wizardry")) { gui.setSlot(13, new GuiElementBuilder() .setItem(Items.BLAZE_ROD) .addLoreLine(Text.translatable("gui.ygasi.branch.cost", cost)) @@ -173,7 +173,7 @@ public class BranchGui { } //grant the player the root advancement of ygasi - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/root"), "opened_skill_menu"); + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "root"), "opened_skill_menu"); gui.open(); } catch (Exception e) { @@ -182,15 +182,15 @@ public class BranchGui { } //this happens when you try to unlock a branch public static void save(ServerPlayerEntity player, String branch, String branchName) { - boolean hasMercenary = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/mercenary"); - boolean hasWizadry = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/wizardry"); - boolean hasDrudiry = AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/druidry"); + boolean hasMercenary = AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/mercenary"); + boolean hasWizadry = AdvUtils.getAdvancementProgress(player, "ygasi", "wizardry/wizardry"); + boolean hasDrudiry = AdvUtils.getAdvancementProgress(player, "ygasi", "druidry/druidry"); //special category for extra branch because it's half the price if (branch.equals("extra")) { if (player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) >= ConfigRegistry.CONFIG.branchCost / 2) { //remove the spent skill points player.getStatHandler().setStat(player, Stats.CUSTOM.getOrCreateStat(SKILL_POINTS), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) - ConfigRegistry.CONFIG.branchCost / 2); - AdvUtils.grantAdvancementCriterion(player, new Identifier("minecraft", "ygasi/extra"), "unlocked_extra"); + AdvUtils.grantAdvancementCriterion(player, new Identifier("ygasi", "extra/extra"), "unlocked_extra"); player.sendMessage(Text.translatable("gui.ygasi.branch.unlock", Text.translatable(branchName)), false); ExtraGui.gui(player); } else { @@ -201,19 +201,19 @@ public class BranchGui { if (player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) >= ConfigRegistry.CONFIG.branchCost) { //grant the player the advancement of the branch they unlocked final Map<String, Class<?>> BRANCH_TO_GUI = new HashMap<>() {{ - put("mercenary", MercenaryGui.class); - put("wizardry", WizardryGui.class); - put("druidry", DruidryGui.class); + put("mercenary/mercenary", MercenaryGui.class); + put("wizardry/wizardry", WizardryGui.class); + put("druidry/druidry", DruidryGui.class); }}; - Identifier advancementId = new Identifier("minecraft", "ygasi/" + branch); + Identifier advancementId = new Identifier("ygasi", branch); Class<?> guiClass = BRANCH_TO_GUI.get(branch); if (hasMercenary || hasWizadry || hasDrudiry) { player.sendMessage(Text.translatable("gui.ygasi.branch.no.unlock"), true); player.playSound(SoundEvents.BLOCK_ANVIL_BREAK, SoundCategory.PLAYERS, 1.0F, 1.0F); player.closeHandledScreen(); } else { - AdvUtils.grantAdvancementCriterion(player, advancementId, "unlocked_" + branch); + AdvUtils.grantAdvancementCriterion(player, advancementId, "unlocked_" + branch.split("/")[0]); unlockSuccess(player, branchName); try { Method guiMethod = guiClass.getMethod("gui", ServerPlayerEntity.class); diff --git a/src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java b/src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java index bfd3e23..eecd65a 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/ConfigGui.java @@ -58,8 +58,7 @@ public class ConfigGui { .setCallback((index, clickType, actionType) -> { ConfigRegistry.CONFIG.enableSkillBook = !ConfigRegistry.CONFIG.enableSkillBook; player.playSound(SoundEvent.of(click), SoundCategory.PLAYERS, 1.0F, 1.0F); - gui.close(); - gui(player, false); + gui(player, fromBranch); }) ); diff --git a/src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java b/src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java index d9896ae..5ed24cb 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/DruidryGui.java @@ -15,7 +15,7 @@ public class DruidryGui { public static void gui(ServerPlayerEntity player) { String title = Text.translatable("gui.ygasi.branch.druidry.title").getString() + " " + Text.translatable("gui.ygasi.branch.title", player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))).getString(); try { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/druidry")) { + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "druidry/druidry")) { player.sendMessage(Text.translatable("gui.ygasi.branches.fail"), false); BranchGui.gui(player); } else { diff --git a/src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java b/src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java index 2715952..77efa0c 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/ExtraGui.java @@ -15,7 +15,7 @@ public class ExtraGui { public static void gui(ServerPlayerEntity player) { String title = Text.translatable("gui.ygasi.branch.extra.title").getString() + " " + Text.translatable("gui.ygasi.branch.title", player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))).getString(); try { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/extra")) { + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "extra/extra")) { player.sendMessage(Text.translatable("gui.ygasi.branches.fail"), false); BranchGui.gui(player); } else { diff --git a/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java b/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java index cdbb989..a190372 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/MercenaryGui.java @@ -20,7 +20,7 @@ public class MercenaryGui { public static void gui(ServerPlayerEntity player) { String title = Text.translatable("gui.ygasi.branch.mercenary.title").getString() + " " + Text.translatable("gui.ygasi.branch.title", Text.of("§3" + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)))).getString(); try { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/mercenary")) { + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/mercenary")) { player.sendMessage(Text.translatable("gui.ygasi.branches.fail"), true); BranchGui.gui(player); } else { @@ -39,8 +39,8 @@ public class MercenaryGui { gui.setSlot(49, new GuiElementBuilder() .setItem(Items.DIAMOND_BLOCK) .setName(Text.translatable("gui.ygasi.branch.mercenary.title")) - .addLoreLine(Text.translatable("gui.ygasi.branch.title", Text.of((String.valueOf(player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)))).formatted(Formatting.DARK_GRAY))) - )); + .addLoreLine(Text.translatable("gui.ygasi.branch.title", Text.of("§3" + player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))))) + ); int[] positions = {38, 19, 1, 40, 22, 4, 42, 25, 7}; String[] advancementNames = {"offence1", "offence2", "offence3", "ninja1", "ninja2", "ninja3", "defence1", "defence2", "defence3"}; @@ -63,19 +63,19 @@ public class MercenaryGui { int position = positions[i]; String advancementName = advancementNames[i]; String nameKey = nameKeys[i]; - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/" + advancementName)) { - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence1") && (advancementName.startsWith("ninja") || advancementName.startsWith("defence"))) { + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/" + advancementName)) { + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence1") && (advancementName.startsWith("ninja") || advancementName.startsWith("defence"))) { GuiCommon.setDoneItem(gui, position, Items.BARRIER, nameKey, false); GuiCommon.filler(gui, 50, false); - } else if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/ninja1") && (advancementName.startsWith("defence") || advancementName.startsWith("offence"))) { + } else if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/ninja1") && (advancementName.startsWith("defence") || advancementName.startsWith("offence"))) { GuiCommon.setDoneItem(gui, position, Items.BARRIER, nameKey, false); GuiCommon.filler(gui, 50, false); GuiCommon.filler(gui, 48, false); - } else if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/defence1") && (advancementName.startsWith("offence") || advancementName.startsWith("ninja"))) { + } else if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/defence1") && (advancementName.startsWith("offence") || advancementName.startsWith("ninja"))) { GuiCommon.setDoneItem(gui, position, Items.BARRIER, nameKey, false); GuiCommon.filler(gui, 48, false); } else { - GuiCommon.setSkillSlot(gui, player, position, items[i], nameKey, costs[i], classes[i], MercenaryGui.class); + GuiCommon.setSkillSlot(gui, player, position, items[i], nameKey, "mercenary/" + advancementName, costs[i], classes[i], MercenaryGui.class); } if (position - 9 >= 0) { GuiCommon.filler(gui, position - 9, false); diff --git a/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java b/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java index c4a60a4..b3eadbb 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/ResetGui.java @@ -1,6 +1,6 @@ package dev.mayaqq.ygasi.gui; -import dev.mayaqq.ygasi.abilities.mercenary.*; +import de.dafuqs.revelationary.api.advancements.AdvancementUtils; import dev.mayaqq.ygasi.gui.common.SkillGui; import dev.mayaqq.ygasi.registry.ConfigRegistry; import dev.mayaqq.ygasi.util.AdvUtils; @@ -39,13 +39,11 @@ public class ResetGui { .setCallback((index, clickType, actionType) -> { if (player.experienceLevel >= ConfigRegistry.CONFIG.resetCost) { reset(player); - player.closeHandledScreen(); player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 1.0F, 1.0F); player.experienceLevel -= ConfigRegistry.CONFIG.resetCost; BranchGui.gui(player); } else { player.sendMessage(Text.translatable("gui.ygasi.reset.fail"), true); - gui.close(); BranchGui.gui(player); } }) @@ -61,12 +59,12 @@ public class ResetGui { gui.open(); } public static void reset(ServerPlayerEntity player) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/root"); - if (AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/mercenary")) { - AdvUtils.revokeAllAdvancements(player, "minecraft", "ygasi/mercenary"); + if (AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/mercenary")) { + AdvUtils.revokeAllAdvancements(player, "ygasi", "mercenary"); String[] subBranches = {"mercenary.Offence", "mercenary.Ninja", "mercenary.Defence"}; resetBranch(subBranches, player); } + AdvancementUtils.reprocessAdvancementUnlocks(player, "ygasi"); player.sendMessage(Text.translatable("gui.ygasi.reset.success"), true); player.getStatHandler().setStat(player, Stats.CUSTOM.getOrCreateStat(SKILL_POINTS), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS_TOTAL))); } diff --git a/src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java b/src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java index 672f829..32bad0c 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/WizardryGui.java @@ -15,7 +15,7 @@ public class WizardryGui { public static void gui(ServerPlayerEntity player) { String title = Text.translatable("gui.ygasi.branch.wizardry.title").getString() + " " + Text.translatable("gui.ygasi.branch.title", player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS))).getString(); try { - if (!AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/wizardry")) { + if (!AdvUtils.getAdvancementProgress(player, "ygasi", "wizardry/wizardry")) { player.sendMessage(Text.translatable("gui.ygasi.branches.fail"), false); BranchGui.gui(player); } else { diff --git a/src/main/java/dev/mayaqq/ygasi/gui/common/GuiCommon.java b/src/main/java/dev/mayaqq/ygasi/gui/common/GuiCommon.java index 3f54ee6..242e794 100644 --- a/src/main/java/dev/mayaqq/ygasi/gui/common/GuiCommon.java +++ b/src/main/java/dev/mayaqq/ygasi/gui/common/GuiCommon.java @@ -39,18 +39,17 @@ public class GuiCommon { ); } } - public static void setSkillSlot(SkillGui gui, ServerPlayerEntity player, int itemIndex, Item item, String nameKey, int cost, Class<?> skillClass, Class<?> guiClass) { - String advName = nameKey.split("\\.")[3]; + public static void setSkillSlot(SkillGui gui, ServerPlayerEntity player, int itemIndex, Item item, String nameKey, String advName ,int cost, Class<?> skillClass, Class<?> guiClass) { gui.setSlot(itemIndex, new GuiElementBuilder() .setItem(item) .hideFlag(ItemStack.TooltipSection.MODIFIERS) .setName(Text.translatable(nameKey)) .addLoreLine(Text.translatable(nameKey + ".lore")) - .addLoreLine(Text.translatable("gui.ygasi.branch.cost", Text.of("§8" + cost))) + .addLoreLine(Text.translatable("gui.ygasi.branch.cost", Text.of("§3" + cost))) .setCallback((index, clickType, actionType) -> { if (player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) >= cost) { try { - if (AdvUtils.hasBeforeAdvancements(player, "minecraft", "ygasi/"+ advName)) { + if (AdvUtils.hasBeforeAdvancements(player, "ygasi", advName)) { skillClass.getMethod("give", ServerPlayerEntity.class).invoke(null, player); player.getStatHandler().setStat(player, Stats.CUSTOM.getOrCreateStat(SKILL_POINTS), player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(SKILL_POINTS)) - cost); guiClass.getMethod("gui", ServerPlayerEntity.class).invoke(null, player); diff --git a/src/main/java/dev/mayaqq/ygasi/mixin/ItemMixin.java b/src/main/java/dev/mayaqq/ygasi/mixin/ItemMixin.java new file mode 100644 index 0000000..f89d7c6 --- /dev/null +++ b/src/main/java/dev/mayaqq/ygasi/mixin/ItemMixin.java @@ -0,0 +1,27 @@ +package dev.mayaqq.ygasi.mixin; + +import dev.mayaqq.ygasi.events.ClickEvent; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.SwordItem; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import static dev.mayaqq.ygasi.Ygasi.LOGGER; + +@Mixin(Item.class) +public class ItemMixin { + @Inject(method = "use", at = @At("HEAD")) + private void injectRightClickBehavior(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) { + if (user.getMainHandStack().getItem() instanceof SwordItem && ClickEvent.swords.getOrDefault(user.getUuidAsString(), 0) >= 1) { + LOGGER.info("Player " + user.getEntityName() + " launched " + ClickEvent.swords.get(user.getUuidAsString()) + " swords!"); + ClickEvent.swords.remove(user.getUuidAsString()); + } + } +} diff --git a/src/main/java/dev/mayaqq/ygasi/mixin/PlayerEntityMixin.java b/src/main/java/dev/mayaqq/ygasi/mixin/PlayerEntityMixin.java index 5eeea63..a9687b1 100644 --- a/src/main/java/dev/mayaqq/ygasi/mixin/PlayerEntityMixin.java +++ b/src/main/java/dev/mayaqq/ygasi/mixin/PlayerEntityMixin.java @@ -22,7 +22,7 @@ public abstract class PlayerEntityMixin { public void onAttack(Entity target, CallbackInfo ci) { if (this.isPlayer()) { ServerPlayerEntity player = (ServerPlayerEntity) (Object) this; - if (!attackList.containsKey(player.getUuidAsString() + target.getUuidAsString()) && AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence1")) { + if (!attackList.containsKey(player.getUuidAsString() + target.getUuidAsString()) && AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence1")) { attackList.put(player.getUuidAsString() + target.getUuidAsString(), true); StatusEffectInstance currentEffect = player.getStatusEffect(StatusEffects.STRENGTH); int currentLevel = currentEffect != null ? currentEffect.getAmplifier() : 0; diff --git a/src/main/java/dev/mayaqq/ygasi/mixin/StatusEffectMixin.java b/src/main/java/dev/mayaqq/ygasi/mixin/StatusEffectMixin.java index e2df799..a70d16a 100644 --- a/src/main/java/dev/mayaqq/ygasi/mixin/StatusEffectMixin.java +++ b/src/main/java/dev/mayaqq/ygasi/mixin/StatusEffectMixin.java @@ -19,7 +19,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.concurrent.TimeUnit; -import static dev.mayaqq.ygasi.Ygasi.LOGGER; import static dev.mayaqq.ygasi.abilities.mercenary.Offence1.attackList; @Mixin(StatusEffect.class) @@ -29,10 +28,9 @@ public abstract class StatusEffectMixin { @Inject(method = "onRemoved", at = @At("HEAD")) public void onUpdateStatusEffect(LivingEntity entity, AttributeContainer attributes, int amplifier, CallbackInfo ci) { - LOGGER.info("onRemovedTick"); if (entity.isPlayer()) { ServerPlayerEntity player = (ServerPlayerEntity) entity; - if (this.getName() != null && this.getName().equals(StatusEffects.STRENGTH.getName()) && AdvUtils.getAdvancementProgress(player, "minecraft", "ygasi/offence1")) { + if (this.getName() != null && this.getName().equals(StatusEffects.STRENGTH.getName()) && AdvUtils.getAdvancementProgress(player, "ygasi", "mercenary/offence1")) { Multithreading.schedule(() -> { attackList.entrySet().removeIf(entry -> entry.getKey().startsWith(player.getUuidAsString())); },4, TimeUnit.SECONDS); diff --git a/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java index 19b4563..c2462e7 100644 --- a/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java +++ b/src/main/java/dev/mayaqq/ygasi/registry/ConfigRegistry.java @@ -54,7 +54,6 @@ public class ConfigRegistry { public int T1Cost = 5; public int T2Cost = 10; public int T3Cost = 15; - public int offence1DefIncrease = 1; public Config() {} } diff --git a/src/main/java/dev/mayaqq/ygasi/registry/EventRegistry.java b/src/main/java/dev/mayaqq/ygasi/registry/EventRegistry.java index ee13faf..66b6be2 100644 --- a/src/main/java/dev/mayaqq/ygasi/registry/EventRegistry.java +++ b/src/main/java/dev/mayaqq/ygasi/registry/EventRegistry.java @@ -1,9 +1,12 @@ package dev.mayaqq.ygasi.registry; +import dev.mayaqq.ygasi.events.ClickEvent; import dev.mayaqq.ygasi.events.PlayerConnectEvent; public class EventRegistry { public static void register() { PlayerConnectEvent.onPlayerConnect(); + PlayerConnectEvent.onPlayerDisconnect(); + ClickEvent.onTick(); } } diff --git a/src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java b/src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java index 708ed36..9834207 100644 --- a/src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java +++ b/src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java @@ -1,5 +1,6 @@ package dev.mayaqq.ygasi.util; +import de.dafuqs.revelationary.api.advancements.AdvancementUtils; import net.minecraft.advancement.Advancement; import net.minecraft.advancement.PlayerAdvancementTracker; import net.minecraft.server.ServerAdvancementLoader; diff --git a/src/main/resources/assets/ygasi/textures/item/skill_book.png b/src/main/resources/assets/ygasi/textures/item/skill_book.png Binary files differindex d6a20f0..1cad598 100644 --- a/src/main/resources/assets/ygasi/textures/item/skill_book.png +++ b/src/main/resources/assets/ygasi/textures/item/skill_book.png diff --git a/src/main/resources/data/ygasi/tags/items/swords.json b/src/main/resources/data/ygasi/tags/items/swords.json new file mode 100644 index 0000000..418ccea --- /dev/null +++ b/src/main/resources/data/ygasi/tags/items/swords.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:wooden_sword", + "minecraft:stone_sword", + "minecraft:iron_sword", + "minecraft:golden_sword", + "minecraft:diamond_sword", + "minecraft:netherite_sword" + ] +}
\ No newline at end of file diff --git a/src/main/resources/ygasi.mixins.json b/src/main/resources/ygasi.mixins.json index a2dba96..47bbed4 100644 --- a/src/main/resources/ygasi.mixins.json +++ b/src/main/resources/ygasi.mixins.json @@ -5,6 +5,7 @@ "compatibilityLevel": "JAVA_17", "mixins": [ "AdvancementRewardsMixin", + "ItemMixin", "PlayerEntityMixin", "StatusEffectMixin" ], |