diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-02-21 21:31:16 +0000 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-02-21 21:31:16 +0000 |
| commit | 420faddca46e70e3a70def168fb4e452ef193b0d (patch) | |
| tree | 247e334012e4bf9e4fa6d42718bf601ce6bd42d9 /java/darkknight/jewelrycraft/util/PlayerUtils.java | |
| parent | 3f4c717de5ebc9b942d65ae45ac87c43bdf8a31b (diff) | |
Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :)
Diffstat (limited to 'java/darkknight/jewelrycraft/util/PlayerUtils.java')
| -rw-r--r-- | java/darkknight/jewelrycraft/util/PlayerUtils.java | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/java/darkknight/jewelrycraft/util/PlayerUtils.java b/java/darkknight/jewelrycraft/util/PlayerUtils.java index 1135860..159ea98 100644 --- a/java/darkknight/jewelrycraft/util/PlayerUtils.java +++ b/java/darkknight/jewelrycraft/util/PlayerUtils.java @@ -2,42 +2,34 @@ package darkknight.jewelrycraft.util; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.integrated.IntegratedServer; -import cpw.mods.fml.common.FMLCommonHandler; /** * 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) { - NBTTagCompound tag = player.getEntityData(); - NBTTagCompound persistTag = null; - if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) - { - persistTag = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - } - else - { + 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 - { + if (persistTag.hasKey(modName)) modTag = persistTag.getCompoundTag(modName); + else{ modTag = new NBTTagCompound(); persistTag.setTag(modName, modTag); } - return modTag; } }
\ No newline at end of file |
