Skip to content

Commit

Permalink
fix: capability data on clone event
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed May 5, 2022
1 parent b2d0cd2 commit d9152b5
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import com.sekwah.narutomod.abilities.NarutoAbilities;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.CapabilityToken;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
Expand Down Expand Up @@ -66,6 +64,7 @@ public static void onPlayerUpdate(TickEvent.PlayerTickEvent event) {

@SubscribeEvent
public static void playerClone(PlayerEvent.Clone event) {
event.getOriginal().reviveCaps();
event.getOriginal().getCapability(NINJA_DATA).ifPresent(original -> {
event.getPlayer().getCapability(NINJA_DATA).ifPresent(future -> {
future.deserializeNBT(original.serializeNBT());
Expand Down

0 comments on commit d9152b5

Please sign in to comment.