Skip to content

Commit

Permalink
fireworks don't spam on respawn #405
Browse files Browse the repository at this point in the history
  • Loading branch information
Caltinor committed Nov 5, 2023
1 parent 8a312e8 commit 0675be2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/java/harmonised/pmmo/events/EventHandler.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 0675be2

Please sign in to comment.