use of mdc.voodoocraft.capability.ICapability in project VoodooCraft by Mod-DevCafeTeam.
the class CapabilityHandler method onClonePlayer.
@SuppressWarnings("all")
@SubscribeEvent
public static void onClonePlayer(net.minecraftforge.event.entity.player.PlayerEvent.Clone event) {
//Copy capability on player death to new player
if (event.isWasDeath() && (event.getEntityPlayer() instanceof EntityPlayerMP)) {
EntityPlayerMP player = (EntityPlayerMP) event.getEntityPlayer();
for (Capability<? extends ICapability> cap : VCCapabilities.getCapabilities()) {
ICapability oldicap = event.getOriginal().getCapability(cap, null);
ICapability icap = player.getCapability(cap, null);
if (oldicap == null || icap == null)
continue;
icap.deserializeNBT(oldicap.serializeNBT());
icap.dataChanged(player);
}
}
}
Aggregations