-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerDataHandlerExtension
More file actions
26 lines (20 loc) · 1013 Bytes
/
PlayerDataHandlerExtension
File metadata and controls
26 lines (20 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package limerence.AdditionalTraits.api.data;
import codersafterdark.reskillable.api.data.PlayerData;
import codersafterdark.reskillable.api.data.PlayerDataHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
public class PlayerDataHandlerExtension extends PlayerDataHandler {
//Creates ClassCastException at runtime. I understand why (somewhat) but dont see a way to avoid it.
public static class EventHandler extends PlayerDataHandler.EventHandler {
@SubscribeEvent
public static void onRespawn(PlayerRespawnEvent event) {
System.out.println("Handler RESPAWN 1");
PlayerDataExtension data = (PlayerDataExtension) PlayerDataHandlerExtension.get((EntityPlayer) event.player);
if (data != null) {
data.respawn(event);
System.out.println("Handler RESPAWN 2");
}
}
}
}