From 0675be2ef6a8c930adf3478a81e6230110ac5491 Mon Sep 17 00:00:00 2001 From: Caltinor <62700786+Caltinor@users.noreply.github.com> Date: Sun, 5 Nov 2023 07:26:51 -0500 Subject: [PATCH] fireworks don't spam on respawn #405 --- src/main/java/harmonised/pmmo/events/EventHandler.java | 5 ++++- .../harmonised/pmmo/features/fireworks/FireworkHandler.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/harmonised/pmmo/events/EventHandler.java b/src/main/java/harmonised/pmmo/events/EventHandler.java index 4efa3f20..2b0e4b50 100644 --- a/src/main/java/harmonised/pmmo/events/EventHandler.java +++ b/src/main/java/harmonised/pmmo/events/EventHandler.java @@ -1,5 +1,6 @@ package harmonised.pmmo.events; +import harmonised.pmmo.api.APIUtils; import harmonised.pmmo.api.enums.EventType; import harmonised.pmmo.api.events.EnchantEvent; import harmonised.pmmo.api.events.FurnaceBurnEvent; @@ -8,6 +9,7 @@ import harmonised.pmmo.events.impl.*; import harmonised.pmmo.features.party.PartyUtils; import harmonised.pmmo.util.Reference; +import harmonised.pmmo.util.TagBuilder; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; @@ -76,7 +78,8 @@ public static void onGamemodeChange(PlayerChangeGameModeEvent event) { @SubscribeEvent public static void onRespawn(PlayerRespawnEvent event) { Core core = Core.get(event.getEntity().level()); - core.getPerkRegistry().executePerk(EventType.SKILL_UP, event.getEntity(), new CompoundTag()); + core.getPerkRegistry().executePerk(EventType.SKILL_UP, event.getEntity(), + TagBuilder.start().withString(APIUtils.SKILLNAME, "respawn").build()); } @SubscribeEvent(priority=EventPriority.LOWEST) public static void onSleep(SleepFinishedTimeEvent event) { diff --git a/src/main/java/harmonised/pmmo/features/fireworks/FireworkHandler.java b/src/main/java/harmonised/pmmo/features/fireworks/FireworkHandler.java index fe137c41..0f5d10da 100644 --- a/src/main/java/harmonised/pmmo/features/fireworks/FireworkHandler.java +++ b/src/main/java/harmonised/pmmo/features/fireworks/FireworkHandler.java @@ -21,7 +21,7 @@ public class FireworkHandler { public static final String FIREWORK_SKILL = "firework_skill"; public static final Perk FIREWORK = Perk.begin() - .addDefaults(TagBuilder.start().withString(APIUtils.SKILLNAME, "none").build()) + .addDefaults(TagBuilder.start().withString(FIREWORK_SKILL, "none").build()) .setStart((player, nbt) -> { BlockPos pos = player.blockPosition(); spawnRocket(player.level(), new Vec3(pos.getX(), pos.getY(), pos.getZ()), nbt.getString(FIREWORK_SKILL));