diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2014-04-10 20:04:38 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-04-11 22:28:35 -0500 |
commit | 8f771c737850130534b0fade70494f7ce3cbc8fd (patch) | |
tree | e4180121cdaf4f15b325aa059469b44975fca8a4 /src/main/java/net/minecraft/server/ItemSkull.java | |
parent | 0df7555cecff17ffab68b8280dcf8471b10f020c (diff) | |
download | craftbukkit-8f771c737850130534b0fade70494f7ce3cbc8fd.tar craftbukkit-8f771c737850130534b0fade70494f7ce3cbc8fd.tar.gz craftbukkit-8f771c737850130534b0fade70494f7ce3cbc8fd.tar.lz craftbukkit-8f771c737850130534b0fade70494f7ce3cbc8fd.tar.xz craftbukkit-8f771c737850130534b0fade70494f7ce3cbc8fd.zip |
Update CraftBukkit to Minecraft 1.7.8
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemSkull.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemSkull.java | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java index 6b2bf9bb..dd7e5ccf 100644 --- a/src/main/java/net/minecraft/server/ItemSkull.java +++ b/src/main/java/net/minecraft/server/ItemSkull.java @@ -1,5 +1,9 @@ package net.minecraft.server; +import java.util.UUID; + +import net.minecraft.util.com.mojang.authlib.GameProfile; + public class ItemSkull extends Item { private static final String[] b = new String[] { "skeleton", "wither", "zombie", "char", "creeper"}; @@ -38,11 +42,7 @@ public class ItemSkull extends Item { ++i; } - if (!entityhuman.a(i, j, k, l, itemstack)) { - return false; - } else if (!Blocks.SKULL.canPlace(world, i, j, k)) { - return false; - } else { + if (!world.isStatic) { // CraftBukkit start - Handle in ItemBlock // world.setTypeAndData(i, j, k, Blocks.SKULL, l, 2); if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Blocks.SKULL, l, clickedX, clickedY, clickedZ)) { @@ -59,20 +59,32 @@ public class ItemSkull extends Item { TileEntity tileentity = world.getTileEntity(i, j, k); if (tileentity != null && tileentity instanceof TileEntitySkull) { - String s = ""; - - if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("SkullOwner", 8)) { - s = itemstack.getTag().getString("SkullOwner"); + if (itemstack.getData() == 3) { + GameProfile gameprofile = null; + + if (itemstack.hasTag()) { + NBTTagCompound nbttagcompound = itemstack.getTag(); + + if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) { + gameprofile = GameProfileSerializer.a(nbttagcompound.getCompound("SkullOwner")); + } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { + gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); + } + } + + ((TileEntitySkull) tileentity).setGameProfile(gameprofile); + } else { + ((TileEntitySkull) tileentity).setSkullType(itemstack.getData()); } - ((TileEntitySkull) tileentity).setSkullType(itemstack.getData(), s); ((TileEntitySkull) tileentity).setRotation(i1); ((BlockSkull) Blocks.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity); } --itemstack.count; - return true; } + + return true; } } @@ -91,6 +103,16 @@ public class ItemSkull extends Item { } public String n(ItemStack itemstack) { - return itemstack.getData() == 3 && itemstack.hasTag() && itemstack.getTag().hasKeyOfType("SkullOwner", 8) ? LocaleI18n.get("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}) : super.n(itemstack); + if (itemstack.getData() == 3 && itemstack.hasTag()) { + if (itemstack.getTag().hasKeyOfType("SkullOwner", 10)) { + return LocaleI18n.get("item.skull.player.name", new Object[] { GameProfileSerializer.a(itemstack.getTag().getCompound("SkullOwner")).getName()}); + } + + if (itemstack.getTag().hasKeyOfType("SkullOwner", 8)) { + return LocaleI18n.get("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}); + } + } + + return super.n(itemstack); } } |