diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-24 15:50:07 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-24 15:50:07 -0400 |
| commit | 4f7ad220df0438b6f3382110577b53f29da46453 (patch) | |
| tree | 07d5e7c812721753cdbe3df7226dad5dc3802c29 /src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java | |
| parent | 01c8701b68986ccfa83e902515716838d6829311 (diff) | |
Update of all changes
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java')
| -rwxr-xr-x[-rw-r--r--] | src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java b/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java index f1655c0..c981555 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java +++ b/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java @@ -7,32 +7,37 @@ import net.minecraft.nbt.NBTTagCompound; /** * Code taken from OpenBlocks */ -public class PlayerUtils -{ - /** - * Returns the NBTTag of the player - * - * @param player the player - * @param modName the mod name - * @return appropriate NBTTag - */ - public static NBTTagCompound getModPlayerPersistTag(EntityPlayer player, String modName) - { - if (player.worldObj.isRemote && ScreenHandler.tagCache != null) return ScreenHandler.tagCache; - - NBTTagCompound tag = player.getEntityData(); - NBTTagCompound persistTag = null; - if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) persistTag = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - else{ - persistTag = new NBTTagCompound(); - tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag); - } - NBTTagCompound modTag = null; - if (persistTag.hasKey(modName)) modTag = persistTag.getCompoundTag(modName); - else{ - modTag = new NBTTagCompound(); - persistTag.setTag(modName, modTag); - } - return modTag; - } +public class PlayerUtils { + /** + * Returns the NBTTag of the player + * + * @param player + * the player + * @param modName + * the mod name + * @return appropriate NBTTag + */ + public static NBTTagCompound + getModPlayerPersistTag(EntityPlayer player, String modName) { + if (player.worldObj.isRemote && ScreenHandler.tagCache != null) + return ScreenHandler.tagCache; + + NBTTagCompound tag = player.getEntityData(); + NBTTagCompound persistTag = null; + if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) + persistTag = + tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); + else { + persistTag = new NBTTagCompound(); + tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag); + } + NBTTagCompound modTag = null; + if (persistTag.hasKey(modName)) + modTag = persistTag.getCompoundTag(modName); + else { + modTag = new NBTTagCompound(); + persistTag.setTag(modName, modTag); + } + return modTag; + } }
\ No newline at end of file |
