Upstream merge

By: md_5 <git@md-5.net>
This commit is contained in:
Spigot
2014-04-24 16:27:12 +10:00
parent a8030addd9
commit b56d35552d
78 changed files with 483 additions and 218 deletions

View File

@@ -1,4 +1,4 @@
From 401298e7004254ee150ea7bcd6263eaf68cd6fc1 Mon Sep 17 00:00:00 2001
From c622cf3a0fddf3113bcf8bf27d99339fff13e400 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 15:10:48 +1100
Subject: [PATCH] mc-dev imports
@@ -1328,6 +1328,123 @@ index 0000000..33cfdb2
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java
new file mode 100644
index 0000000..f20c69e
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemSkull.java
@@ -0,0 +1,111 @@
+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"};
+ public static final String[] a = new String[] { "skeleton", "wither", "zombie", "steve", "creeper"};
+
+ public ItemSkull() {
+ this.a(CreativeModeTab.c);
+ this.setMaxDurability(0);
+ this.a(true);
+ }
+
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
+ if (l == 0) {
+ return false;
+ } else if (!world.getType(i, j, k).getMaterial().isBuildable()) {
+ return false;
+ } else {
+ if (l == 1) {
+ ++j;
+ }
+
+ if (l == 2) {
+ --k;
+ }
+
+ if (l == 3) {
+ ++k;
+ }
+
+ if (l == 4) {
+ --i;
+ }
+
+ if (l == 5) {
+ ++i;
+ }
+
+ if (!world.isStatic) {
+ world.setTypeAndData(i, j, k, Blocks.SKULL, l, 2);
+ int i1 = 0;
+
+ if (l == 1) {
+ i1 = MathHelper.floor((double) (entityhuman.yaw * 16.0F / 360.0F) + 0.5D) & 15;
+ }
+
+ TileEntity tileentity = world.getTileEntity(i, j, k);
+
+ if (tileentity != null && tileentity instanceof TileEntitySkull) {
+ 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).setRotation(i1);
+ ((BlockSkull) Blocks.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity);
+ }
+
+ --itemstack.count;
+ }
+
+ return true;
+ }
+ }
+
+ public int filterData(int i) {
+ return i;
+ }
+
+ public String a(ItemStack itemstack) {
+ int i = itemstack.getData();
+
+ if (i < 0 || i >= b.length) {
+ i = 0;
+ }
+
+ return super.getName() + "." + b[i];
+ }
+
+ public String n(ItemStack 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);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java
new file mode 100644
index 0000000..02206f5
@@ -3103,6 +3220,178 @@ index 0000000..678aa91
+ return watchableobject.d = flag;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java
new file mode 100644
index 0000000..63c5af6
--- /dev/null
+++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java
@@ -0,0 +1,166 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class WorldGenForestTree extends WorldGenTreeAbstract {
+
+ public WorldGenForestTree(boolean flag) {
+ super(flag);
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ int l = random.nextInt(3) + random.nextInt(2) + 6;
+ boolean flag = true;
+
+ if (j >= 1 && j + l + 1 <= 256) {
+ int i1;
+ int j1;
+
+ for (int k1 = j; k1 <= j + 1 + l; ++k1) {
+ byte b0 = 1;
+
+ if (k1 == j) {
+ b0 = 0;
+ }
+
+ if (k1 >= j + 1 + l - 2) {
+ b0 = 2;
+ }
+
+ for (i1 = i - b0; i1 <= i + b0 && flag; ++i1) {
+ for (j1 = k - b0; j1 <= k + b0 && flag; ++j1) {
+ if (k1 >= 0 && k1 < 256) {
+ Block block = world.getType(i1, k1, j1);
+
+ if (!this.a(block)) {
+ flag = false;
+ }
+ } else {
+ flag = false;
+ }
+ }
+ }
+ }
+
+ if (!flag) {
+ return false;
+ } else {
+ Block block1 = world.getType(i, j - 1, k);
+
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
+ this.setType(world, i + 1, j - 1, k, Blocks.DIRT);
+ this.setType(world, i + 1, j - 1, k + 1, Blocks.DIRT);
+ this.setType(world, i, j - 1, k + 1, Blocks.DIRT);
+ int l1 = random.nextInt(4);
+
+ i1 = l - random.nextInt(4);
+ j1 = 2 - random.nextInt(3);
+ int i2 = i;
+ int j2 = k;
+ int k2 = 0;
+
+ int l2;
+ int i3;
+
+ for (l2 = 0; l2 < l; ++l2) {
+ i3 = j + l2;
+ if (l2 >= i1 && j1 > 0) {
+ i2 += Direction.a[l1];
+ j2 += Direction.b[l1];
+ --j1;
+ }
+
+ Block block2 = world.getType(i2, i3, j2);
+
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i2, i3, j2, Blocks.LOG2, 1);
+ this.setTypeAndData(world, i2 + 1, i3, j2, Blocks.LOG2, 1);
+ this.setTypeAndData(world, i2, i3, j2 + 1, Blocks.LOG2, 1);
+ this.setTypeAndData(world, i2 + 1, i3, j2 + 1, Blocks.LOG2, 1);
+ k2 = i3;
+ }
+ }
+
+ for (l2 = -2; l2 <= 0; ++l2) {
+ for (i3 = -2; i3 <= 0; ++i3) {
+ byte b1 = -1;
+
+ this.a(world, i2 + l2, k2 + b1, j2 + i3);
+ this.a(world, 1 + i2 - l2, k2 + b1, j2 + i3);
+ this.a(world, i2 + l2, k2 + b1, 1 + j2 - i3);
+ this.a(world, 1 + i2 - l2, k2 + b1, 1 + j2 - i3);
+ if ((l2 > -2 || i3 > -1) && (l2 != -1 || i3 != -2)) {
+ byte b2 = 1;
+
+ this.a(world, i2 + l2, k2 + b2, j2 + i3);
+ this.a(world, 1 + i2 - l2, k2 + b2, j2 + i3);
+ this.a(world, i2 + l2, k2 + b2, 1 + j2 - i3);
+ this.a(world, 1 + i2 - l2, k2 + b2, 1 + j2 - i3);
+ }
+ }
+ }
+
+ if (random.nextBoolean()) {
+ this.a(world, i2, k2 + 2, j2);
+ this.a(world, i2 + 1, k2 + 2, j2);
+ this.a(world, i2 + 1, k2 + 2, j2 + 1);
+ this.a(world, i2, k2 + 2, j2 + 1);
+ }
+
+ for (l2 = -3; l2 <= 4; ++l2) {
+ for (i3 = -3; i3 <= 4; ++i3) {
+ if ((l2 != -3 || i3 != -3) && (l2 != -3 || i3 != 4) && (l2 != 4 || i3 != -3) && (l2 != 4 || i3 != 4) && (Math.abs(l2) < 3 || Math.abs(i3) < 3)) {
+ this.a(world, i2 + l2, k2, j2 + i3);
+ }
+ }
+ }
+
+ for (l2 = -1; l2 <= 2; ++l2) {
+ for (i3 = -1; i3 <= 2; ++i3) {
+ if ((l2 < 0 || l2 > 1 || i3 < 0 || i3 > 1) && random.nextInt(3) <= 0) {
+ int j3 = random.nextInt(3) + 2;
+
+ int k3;
+
+ for (k3 = 0; k3 < j3; ++k3) {
+ this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1);
+ }
+
+ int l3;
+
+ for (k3 = -1; k3 <= 1; ++k3) {
+ for (l3 = -1; l3 <= 1; ++l3) {
+ this.a(world, i2 + l2 + k3, k2 - 0, j2 + i3 + l3);
+ }
+ }
+
+ for (k3 = -2; k3 <= 2; ++k3) {
+ for (l3 = -2; l3 <= 2; ++l3) {
+ if (Math.abs(k3) != 2 || Math.abs(l3) != 2) {
+ this.a(world, i2 + l2 + k3, k2 - 1, j2 + i3 + l3);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+
+ private void a(World world, int i, int j, int k) {
+ Block block = world.getType(i, j, k);
+
+ if (block.getMaterial() == Material.AIR) {
+ this.setTypeAndData(world, i, j, k, Blocks.LEAVES2, 1);
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
new file mode 100644
index 0000000..c0db754