EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
int currLevel = player.experienceLevel;
int targetLevel = Math.max(0, currLevel + levels);
PacketDrainPlayerXP packet = new PacketDrainPlayerXP(te, targetLevel, false);
PacketHandler.INSTANCE.sendToServer(packet);
} else {
PacketGivePlayerXP packet = new PacketGivePlayerXP(te, levels);
PacketHandler.INSTANCE.sendToServer(packet);