Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tutorial.generic;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.nbt.NBTTagList;
- import net.minecraft.world.World;
- import net.minecraftforge.common.IExtendedEntityProperties;
- public final class PlayerInformation implements IExtendedEntityProperties {
- public int currentXP;
- private final EntityPlayer player;
- public PlayerInformation(EntityPlayer player) {
- this.player = player;
- }
- public static final String IDENTIFIER = "minepg_playerinfo";
- public static PlayerInformation forPlayer(Entity player) {
- return (PlayerInformation) player.getExtendedProperties(IDENTIFIER);
- }
- @Override
- public void saveNBTData(NBTTagCompound compound) {
- compound.setInteger("currentXP", currentXP);
- System.out.println("NBT Saved");
- }
- @Override
- public void loadNBTData(NBTTagCompound compound) {
- this.currentXP = compound.getInteger("currentXP");
- System.out.println("NBT Loaded");
- }
- public void addXP(int ammount){
- this.currentXP += ammount;
- }
- public int getXP(){
- return this.currentXP;
- }
- @Override
- public void init(Entity entity, World world) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement