diff options
author | Maximusbarcz <maxim.baranek@gmail.com> | 2023-01-20 23:06:47 +0100 |
---|---|---|
committer | Maximusbarcz <maxim.baranek@gmail.com> | 2023-01-20 23:06:47 +0100 |
commit | adaecef7df47ccdbfbda6f438c28696ff1ce8822 (patch) | |
tree | 46397c9d175ca67a69b7033189fec26dd6c6b4ae /src/main/java/dev/mayaqq/ygasi/abilities/mercenary | |
parent | 531bb27e7eb07e08e1e423d0cf01c297fef890f6 (diff) | |
download | ygasi-adaecef7df47ccdbfbda6f438c28696ff1ce8822.tar.gz ygasi-adaecef7df47ccdbfbda6f438c28696ff1ce8822.tar.bz2 ygasi-adaecef7df47ccdbfbda6f438c28696ff1ce8822.zip |
I redid all the advancements and also started work on the second Offence2 ability
Diffstat (limited to 'src/main/java/dev/mayaqq/ygasi/abilities/mercenary')
9 files changed, 72 insertions, 36 deletions
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"); } } } |