Added isGUIOpen() function, and setPosition function with a dimensionId parameter to ScriptPlayer.

This commit is contained in:
luisc committed 2021-11-16 10:41:04 -06:00
1 parent 27b88c1fce
commit 0d807b36d9
13 files changed
+84 -17

No files matched your search

@@ -39,10 +39,12 @@ public class PlayerData implements IExtendedEntityProperties{
public String playername = "";
public String uuid = "";
private EntityNPCInterface activeCompanion = null;
public int companionID = 0;
public boolean isGUIOpen = false;
@Override
public void saveNBTData(NBTTagCompound compound) {
PlayerDataController.instance.savePlayerData(this);
@@ -86,6 +88,7 @@ public class PlayerData implements IExtendedEntityProperties{
player.worldObj.spawnEntityInWorld(npc);
}
}
isGUIOpen = data.getBoolean("isGUIOpen");
}
public NBTTagCompound getNBT() {
if(player != null){
@@ -105,6 +108,7 @@ public class PlayerData implements IExtendedEntityProperties{
compound.setString("PlayerName", playername);
compound.setString("UUID", uuid);
compound.setInteger("PlayerCompanionId", companionID);
compound.setBoolean("isGUIOpen",isGUIOpen);
if(hasCompanion()){
NBTTagCompound nbt = new NBTTagCompound();
@@ -118,7 +122,17 @@ public class PlayerData implements IExtendedEntityProperties{
public void init(Entity entity, World world) {
}
public void setGUIOpen(boolean bool) {
isGUIOpen = bool;
saveNBTData(null);
}
public boolean getGUIOpen() {
loadNBTData(null);
return isGUIOpen;
}
public boolean hasCompanion(){
return activeCompanion != null && !activeCompanion.isDead;
}