I was just messing around and came up with this without using an event handler
got:
Caused by: java.lang.InstantiationException: mint.mods.levelupevent
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@Mod(modid = "exptest", name = "exptest", version = "1.0.0")
public class levelupevent extends EntityPlayer {
private GameProfile field_146106_i;
public levelupevent(World p_i45324_1_, GameProfile p_i45324_2_)
{
super(p_i45324_1_, p_i45324_2_);
this.entityUniqueID = func_146094_a(p_i45324_2_);
this.field_146106_i = p_i45324_2_;
this.inventoryContainer = new ContainerPlayer(this.inventory, !p_i45324_1_.isRemote, this);
this.openContainer = this.inventoryContainer;
this.yOffset = 1.62F;
ChunkCoordinates chunkcoordinates = p_i45324_1_.getSpawnPoint();
this.setLocationAndAngles((double)chunkcoordinates.posX + 0.5D, (double)(chunkcoordinates.posY + 1), (double)chunkcoordinates.posZ + 0.5D, 0.0F, 0.0F);
this.field_70741_aB = 180.0F;
this.fireResistance = 20;
this.eyeHeight = this.getDefaultEyeHeight();
}
public void addExperience(int p_71023_1_)
{
this.addScore(p_71023_1_);
int j = Integer.MAX_VALUE - this.experienceTotal;
if (p_71023_1_ > j)
{
p_71023_1_ = j;
}
this.experience += (float)p_71023_1_ / (float)this.xpBarCap();
for (this.experienceTotal += p_71023_1_; this.experience >= 1.0F; this.experience /= (float)this.xpBarCap())
{
this.experience = (this.experience - 1.0F) * (float)this.xpBarCap();
this.addExperienceLevel(5);
}
}
public int xpBarCap()
{
return this.experienceLevel >= 30 ? 1 + (this.experienceLevel - 30) * 1 : (this.experienceLevel >= 15 ? 1 + (this.experienceLevel - 1) * 1 : 1);
}
@Override
public void addChatMessage(IChatComponent p_145747_1_) {
// TODO Auto-generated method stub
}
@Override
public boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_) {
// TODO Auto-generated method stub
return false;
}
@Override
public ChunkCoordinates getPlayerCoordinates() {
// TODO Auto-generated method stub
return null;
}
}