Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.halestormxv.Main.handler;
- import com.halestormxv.entity.goldspirits.EntityAries;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.world.World;
- import net.minecraftforge.common.IExtendedEntityProperties;
- public class ExtendedPlayer implements IExtendedEntityProperties {
- public final static String PLAYER_HAS_CONTRACT = "Has Contract With Spirit";
- public static boolean aquariusActive, taurusActive, cancerActive, virgoActive, sagittariusActive, leoActive,
- ariesActive, scorpioActive, geminiActive, capricornActive, piscesActive, libraActive;
- private final EntityPlayer player;
- //public static boolean[] summonedState = new boolean[]{aquariusActive, taurusActive, cancerActive, virgoActive, sagittariusActive, leoActive, ariesActive, scorpioActive, geminiActive, capricornActive, piscesActive, libraActive};
- public ExtendedPlayer(EntityPlayer player)
- {
- this.player = player;
- //All players default to no contract
- this.aquariusActive = false;
- this.taurusActive = false;
- this.cancerActive = false;
- this.virgoActive = false;
- this.sagittariusActive = false;
- this.leoActive = false;
- this.ariesActive = false;
- this.scorpioActive = false;
- this.geminiActive = false;
- this.capricornActive = false;
- this.piscesActive = false;
- this.libraActive = false;
- }
- public static final void register(EntityPlayer player)
- {
- player.registerExtendedProperties(ExtendedPlayer.PLAYER_HAS_CONTRACT, new ExtendedPlayer(player));
- }
- public static final ExtendedPlayer get(EntityPlayer player)
- {
- return (ExtendedPlayer) player.getExtendedProperties(PLAYER_HAS_CONTRACT);
- }
- // Save any custom data that needs saving here
- @Override
- public void saveNBTData(NBTTagCompound compound)
- {
- // We need to create a new tag compound that will save everything for our Extended Properties
- NBTTagCompound properties = new NBTTagCompound();
- // We only have 2 variables currently; save them both to the new tag
- properties.setBoolean("aquariusActive", false);
- properties.setBoolean("taurusActive", false);
- properties.setBoolean("cancerActive", false);
- properties.setBoolean("virgoActive", false);
- properties.setBoolean("sagittariusActive", false);
- properties.setBoolean("leoActive", false);
- properties.setBoolean("ariesActive", false);
- properties.setBoolean("scorpioActive", false);
- properties.setBoolean("geminiActive", false);
- properties.setBoolean("capricornActive", false);
- properties.setBoolean("piscesActive", false);
- properties.setBoolean("libraActive", false);
- // Now add our custom tag to the player's tag with a unique name (our property's name)
- // This will allow you to save multiple types of properties and distinguish between them
- // If you only have one type, it isn't as important, but it will still avoid conflicts between
- // your tag names and vanilla tag names. For instance, if you add some "Items" tag,
- // that will conflict with vanilla. Not good. So just use a unique tag name.
- for(int i = 0; i < 12; i++)
- {
- compound.setTag(PLAYER_HAS_CONTRACT, properties);
- }
- }
- // Load whatever data you saved
- @Override
- public void loadNBTData(NBTTagCompound compound)
- {
- // Here we fetch the unique tag compound we set for this class of Extended Properties
- NBTTagCompound properties = (NBTTagCompound) compound.getTag(PLAYER_HAS_CONTRACT);
- // Get our data from the custom tag compound
- this.aquariusActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.taurusActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.cancerActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.virgoActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.sagittariusActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.leoActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.ariesActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.scorpioActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.geminiActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.capricornActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.piscesActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- this.libraActive = properties.getBoolean(PLAYER_HAS_CONTRACT);
- }
- /*
- I personally have yet to find a use for this method. If you know of any,
- please let me know and I'll add it in!
- */
- @Override
- public void init(Entity entity, World world)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment