Update CraftBukkit to Minecraft 1.7.8

This commit is contained in:
Travis Watkins
2014-04-10 20:04:38 -05:00
parent 0df7555cec
commit 8f771c7378
50 changed files with 1875 additions and 716 deletions

View File

@@ -1,10 +1,16 @@
package net.minecraft.server;
import java.util.UUID;
import net.minecraft.util.com.google.common.collect.Iterables;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import net.minecraft.util.com.mojang.authlib.properties.Property;
public class TileEntitySkull extends TileEntity {
private int a;
private int i;
private String j = "";
private GameProfile j = null;
public TileEntitySkull() {}
@@ -12,18 +18,32 @@ public class TileEntitySkull extends TileEntity {
super.b(nbttagcompound);
nbttagcompound.setByte("SkullType", (byte) (this.a & 255));
nbttagcompound.setByte("Rot", (byte) (this.i & 255));
nbttagcompound.setString("ExtraType", this.j);
if (this.j != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
GameProfileSerializer.a(nbttagcompound1, this.j);
nbttagcompound.set("Owner", nbttagcompound1);
}
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.a = nbttagcompound.getByte("SkullType");
this.i = nbttagcompound.getByte("Rot");
if (nbttagcompound.hasKeyOfType("ExtraType", 8)) {
this.j = nbttagcompound.getString("ExtraType");
if (this.a == 3) {
if (nbttagcompound.hasKeyOfType("Owner", 10)) {
this.j = GameProfileSerializer.a(nbttagcompound.getCompound("Owner"));
} else if (nbttagcompound.hasKeyOfType("ExtraType", 8) && !UtilColor.b(nbttagcompound.getString("ExtraType"))) {
this.j = new GameProfile((UUID) null, nbttagcompound.getString("ExtraType"));
this.d();
}
}
}
public GameProfile getGameProfile() {
return this.j;
}
public Packet getUpdatePacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -31,9 +51,34 @@ public class TileEntitySkull extends TileEntity {
return new PacketPlayOutTileEntityData(this.x, this.y, this.z, 4, nbttagcompound);
}
public void setSkullType(int i, String s) {
public void setSkullType(int i) {
this.a = i;
this.j = s;
this.j = null;
}
public void setGameProfile(GameProfile gameprofile) {
this.a = 3;
this.j = gameprofile;
this.d();
}
private void d() {
if (this.j != null && !UtilColor.b(this.j.getName())) {
if (!this.j.isComplete() || !this.j.getProperties().containsKey("textures")) {
GameProfile gameprofile = MinecraftServer.getServer().getUserCache().a(this.j.getName());
if (gameprofile != null) {
Property property = (Property) Iterables.getFirst(gameprofile.getProperties().get("textures"), null);
if (property == null) {
gameprofile = MinecraftServer.getServer().av().fillProfileProperties(gameprofile, true);
}
this.j = gameprofile;
this.update();
}
}
}
}
public int getSkullType() {
@@ -49,8 +94,4 @@ public class TileEntitySkull extends TileEntity {
return this.i;
}
// CraftBukkit end
public String getExtraType() {
return this.j;
}
}