2013-12-01 05:13:58 +01:00
|
|
|
From 5df0962615a66779058f3ca87ea05ac17be54059 Mon Sep 17 00:00:00 2001
|
2013-04-10 06:06:41 +02:00
|
|
|
From: md_5 <md_5@live.com.au>
|
2013-12-01 05:13:58 +01:00
|
|
|
Date: Sun, 1 Dec 2013 15:10:48 +1100
|
2013-04-10 06:06:41 +02:00
|
|
|
Subject: [PATCH] mc-dev imports
|
2013-01-15 02:18:40 +01:00
|
|
|
|
|
|
|
|
2013-10-09 09:20:20 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockBrewingStand.java b/src/main/java/net/minecraft/server/BlockBrewingStand.java
|
|
|
|
new file mode 100644
|
2013-12-01 05:13:58 +01:00
|
|
|
index 0000000..3287d77
|
2013-10-09 09:20:20 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockBrewingStand.java
|
|
|
|
@@ -0,0 +1,109 @@
|
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Random;
|
|
|
|
+
|
|
|
|
+public class BlockBrewingStand extends BlockContainer {
|
|
|
|
+
|
|
|
|
+ private Random a = new Random();
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public BlockBrewingStand() {
|
|
|
|
+ super(Material.ORE);
|
2013-10-09 09:20:20 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean c() {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public int b() {
|
2013-10-09 09:20:20 +02:00
|
|
|
+ return 25;
|
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public TileEntity a(World world, int i) {
|
2013-10-09 09:20:20 +02:00
|
|
|
+ return new TileEntityBrewingStand();
|
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public boolean d() {
|
2013-10-09 09:20:20 +02:00
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
|
|
|
|
+ this.a(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F);
|
|
|
|
+ super.a(world, i, j, k, axisalignedbb, list, entity);
|
|
|
|
+ this.g();
|
|
|
|
+ super.a(world, i, j, k, axisalignedbb, list, entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void g() {
|
|
|
|
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
|
|
|
+ if (world.isStatic) {
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand) world.getTileEntity(i, j, k);
|
|
|
|
+
|
|
|
|
+ if (tileentitybrewingstand != null) {
|
|
|
|
+ entityhuman.openBrewingStand(tileentitybrewingstand);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
|
|
|
|
+ if (itemstack.hasName()) {
|
|
|
|
+ ((TileEntityBrewingStand) world.getTileEntity(i, j, k)).a(itemstack.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public void remove(World world, int i, int j, int k, Block block, int l) {
|
2013-10-09 09:20:20 +02:00
|
|
|
+ TileEntity tileentity = world.getTileEntity(i, j, k);
|
|
|
|
+
|
|
|
|
+ if (tileentity instanceof TileEntityBrewingStand) {
|
|
|
|
+ TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand) tileentity;
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ for (int i1 = 0; i1 < tileentitybrewingstand.getSize(); ++i1) {
|
|
|
|
+ ItemStack itemstack = tileentitybrewingstand.getItem(i1);
|
2013-10-09 09:20:20 +02:00
|
|
|
+
|
|
|
|
+ if (itemstack != null) {
|
|
|
|
+ float f = this.a.nextFloat() * 0.8F + 0.1F;
|
|
|
|
+ float f1 = this.a.nextFloat() * 0.8F + 0.1F;
|
|
|
|
+ float f2 = this.a.nextFloat() * 0.8F + 0.1F;
|
|
|
|
+
|
|
|
|
+ while (itemstack.count > 0) {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ int j1 = this.a.nextInt(21) + 10;
|
2013-10-09 09:20:20 +02:00
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ if (j1 > itemstack.count) {
|
|
|
|
+ j1 = itemstack.count;
|
2013-10-09 09:20:20 +02:00
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ itemstack.count -= j1;
|
|
|
|
+ EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getData()));
|
2013-10-09 09:20:20 +02:00
|
|
|
+ float f3 = 0.05F;
|
|
|
|
+
|
|
|
|
+ entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
|
|
|
|
+ entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
|
|
|
|
+ entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
|
|
|
|
+ world.addEntity(entityitem);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ super.remove(world, i, j, k, block, l);
|
2013-10-09 09:20:20 +02:00
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public Item getDropType(int i, Random random, int j) {
|
|
|
|
+ return Items.BREWING_STAND;
|
2013-10-09 09:20:20 +02:00
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public boolean M() {
|
2013-10-09 09:20:20 +02:00
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public int g(World world, int i, int j, int k, int l) {
|
2013-10-09 09:20:20 +02:00
|
|
|
+ return Container.b((IInventory) world.getTileEntity(i, j, k));
|
|
|
|
+ }
|
|
|
|
+}
|
2013-09-16 02:54:11 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
|
|
|
|
new file mode 100644
|
2013-12-01 05:13:58 +01:00
|
|
|
index 0000000..6d5090b
|
2013-09-16 02:54:11 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
|
|
|
|
@@ -0,0 +1,80 @@
|
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+import java.util.Random;
|
|
|
|
+
|
|
|
|
+public class BlockTNT extends Block {
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public BlockTNT() {
|
|
|
|
+ super(Material.TNT);
|
2013-09-16 02:54:11 +02:00
|
|
|
+ this.a(CreativeModeTab.d);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void onPlace(World world, int i, int j, int k) {
|
|
|
|
+ super.onPlace(world, i, j, k);
|
|
|
|
+ if (world.isBlockIndirectlyPowered(i, j, k)) {
|
|
|
|
+ this.postBreak(world, i, j, k, 1);
|
|
|
|
+ world.setAir(i, j, k);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public void doPhysics(World world, int i, int j, int k, Block block) {
|
2013-09-16 02:54:11 +02:00
|
|
|
+ if (world.isBlockIndirectlyPowered(i, j, k)) {
|
|
|
|
+ this.postBreak(world, i, j, k, 1);
|
|
|
|
+ world.setAir(i, j, k);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int a(Random random) {
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void wasExploded(World world, int i, int j, int k, Explosion explosion) {
|
|
|
|
+ if (!world.isStatic) {
|
|
|
|
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), explosion.c());
|
|
|
|
+
|
|
|
|
+ entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8;
|
|
|
|
+ world.addEntity(entitytntprimed);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void postBreak(World world, int i, int j, int k, int l) {
|
|
|
|
+ this.a(world, i, j, k, l, (EntityLiving) null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void a(World world, int i, int j, int k, int l, EntityLiving entityliving) {
|
|
|
|
+ if (!world.isStatic) {
|
|
|
|
+ if ((l & 1) == 1) {
|
|
|
|
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), entityliving);
|
|
|
|
+
|
|
|
|
+ world.addEntity(entitytntprimed);
|
2013-12-01 05:13:58 +01:00
|
|
|
+ world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
|
2013-09-16 02:54:11 +02:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ if (entityhuman.bD() != null && entityhuman.bD().getItem() == Items.FLINT_AND_STEEL) {
|
2013-09-16 02:54:11 +02:00
|
|
|
+ this.a(world, i, j, k, 1, entityhuman);
|
|
|
|
+ world.setAir(i, j, k);
|
2013-12-01 05:13:58 +01:00
|
|
|
+ entityhuman.bD().damage(1, entityhuman);
|
2013-09-16 02:54:11 +02:00
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void a(World world, int i, int j, int k, Entity entity) {
|
|
|
|
+ if (entity instanceof EntityArrow && !world.isStatic) {
|
|
|
|
+ EntityArrow entityarrow = (EntityArrow) entity;
|
|
|
|
+
|
|
|
|
+ if (entityarrow.isBurning()) {
|
|
|
|
+ this.a(world, i, j, k, 1, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
|
|
|
|
+ world.setAir(i, j, k);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean a(Explosion explosion) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+}
|
2013-05-06 06:41:11 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java
|
|
|
|
new file mode 100644
|
2013-12-01 05:13:58 +01:00
|
|
|
index 0000000..06934a1
|
2013-05-06 06:41:11 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/net/minecraft/server/NextTickListEntry.java
|
2013-12-01 05:13:58 +01:00
|
|
|
@@ -0,0 +1,60 @@
|
2013-05-06 06:41:11 +02:00
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+public class NextTickListEntry implements Comparable {
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ private static long f;
|
|
|
|
+ private final Block g;
|
2013-05-06 06:41:11 +02:00
|
|
|
+ public int a;
|
|
|
|
+ public int b;
|
|
|
|
+ public int c;
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public long d;
|
|
|
|
+ public int e;
|
2013-05-06 06:41:11 +02:00
|
|
|
+ private long h;
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ public NextTickListEntry(int i, int j, int k, Block block) {
|
|
|
|
+ this.h = (long) (f++);
|
2013-05-06 06:41:11 +02:00
|
|
|
+ this.a = i;
|
|
|
|
+ this.b = j;
|
|
|
|
+ this.c = k;
|
2013-12-01 05:13:58 +01:00
|
|
|
+ this.g = block;
|
2013-05-06 06:41:11 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean equals(Object object) {
|
|
|
|
+ if (!(object instanceof NextTickListEntry)) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ NextTickListEntry nextticklistentry = (NextTickListEntry) object;
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ return this.a == nextticklistentry.a && this.b == nextticklistentry.b && this.c == nextticklistentry.c && Block.a(this.g, nextticklistentry.g);
|
2013-05-06 06:41:11 +02:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int hashCode() {
|
|
|
|
+ return (this.a * 1024 * 1024 + this.c * 1024 + this.b) * 256;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public NextTickListEntry a(long i) {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ this.d = i;
|
2013-05-06 06:41:11 +02:00
|
|
|
+ return this;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void a(int i) {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ this.e = i;
|
2013-05-06 06:41:11 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int compareTo(NextTickListEntry nextticklistentry) {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ return this.d < nextticklistentry.d ? -1 : (this.d > nextticklistentry.d ? 1 : (this.e != nextticklistentry.e ? this.e - nextticklistentry.e : (this.h < nextticklistentry.h ? -1 : (this.h > nextticklistentry.h ? 1 : 0))));
|
2013-05-06 06:41:11 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String toString() {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ return Block.b(this.g) + ": (" + this.a + ", " + this.b + ", " + this.c + "), " + this.d + ", " + this.e + ", " + this.h;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Block a() {
|
|
|
|
+ return this.g;
|
2013-05-06 06:41:11 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int compareTo(Object object) {
|
|
|
|
+ return this.compareTo((NextTickListEntry) object);
|
|
|
|
+ }
|
|
|
|
+}
|
2013-04-10 06:06:41 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..5d75a54
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/net/minecraft/server/NibbleArray.java
|
|
|
|
@@ -0,0 +1,40 @@
|
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+public class NibbleArray {
|
|
|
|
+
|
|
|
|
+ public final byte[] a;
|
|
|
|
+ private final int b;
|
|
|
|
+ private final int c;
|
|
|
|
+
|
|
|
|
+ public NibbleArray(int i, int j) {
|
|
|
|
+ this.a = new byte[i >> 1];
|
|
|
|
+ this.b = j;
|
|
|
|
+ this.c = j + 4;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public NibbleArray(byte[] abyte, int i) {
|
|
|
|
+ this.a = abyte;
|
|
|
|
+ this.b = i;
|
|
|
|
+ this.c = i + 4;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int a(int i, int j, int k) {
|
|
|
|
+ int l = j << this.c | k << this.b | i;
|
|
|
|
+ int i1 = l >> 1;
|
|
|
|
+ int j1 = l & 1;
|
|
|
|
+
|
|
|
|
+ return j1 == 0 ? this.a[i1] & 15 : this.a[i1] >> 4 & 15;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void a(int i, int j, int k, int l) {
|
|
|
|
+ int i1 = j << this.c | k << this.b | i;
|
|
|
|
+ int j1 = i1 >> 1;
|
|
|
|
+ int k1 = i1 & 1;
|
|
|
|
+
|
|
|
|
+ if (k1 == 0) {
|
|
|
|
+ this.a[j1] = (byte) (this.a[j1] & 240 | l & 15);
|
|
|
|
+ } else {
|
|
|
|
+ this.a[j1] = (byte) (this.a[j1] & 15 | (l & 15) << 4);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
2013-01-15 02:18:40 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/OldChunkLoader.java b/src/main/java/net/minecraft/server/OldChunkLoader.java
|
|
|
|
new file mode 100644
|
2013-12-01 05:13:58 +01:00
|
|
|
index 0000000..fcb9912
|
2013-01-15 02:18:40 +01:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/net/minecraft/server/OldChunkLoader.java
|
|
|
|
@@ -0,0 +1,120 @@
|
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+public class OldChunkLoader {
|
|
|
|
+
|
|
|
|
+ public static OldChunk a(NBTTagCompound nbttagcompound) {
|
|
|
|
+ int i = nbttagcompound.getInt("xPos");
|
|
|
|
+ int j = nbttagcompound.getInt("zPos");
|
|
|
|
+ OldChunk oldchunk = new OldChunk(i, j);
|
|
|
|
+
|
|
|
|
+ oldchunk.g = nbttagcompound.getByteArray("Blocks");
|
|
|
|
+ oldchunk.f = new OldNibbleArray(nbttagcompound.getByteArray("Data"), 7);
|
|
|
|
+ oldchunk.e = new OldNibbleArray(nbttagcompound.getByteArray("SkyLight"), 7);
|
|
|
|
+ oldchunk.d = new OldNibbleArray(nbttagcompound.getByteArray("BlockLight"), 7);
|
|
|
|
+ oldchunk.c = nbttagcompound.getByteArray("HeightMap");
|
|
|
|
+ oldchunk.b = nbttagcompound.getBoolean("TerrainPopulated");
|
2013-12-01 05:13:58 +01:00
|
|
|
+ oldchunk.h = nbttagcompound.getList("Entities", 10);
|
|
|
|
+ oldchunk.i = nbttagcompound.getList("TileEntities", 10);
|
|
|
|
+ oldchunk.j = nbttagcompound.getList("TileTicks", 10);
|
2013-01-15 02:18:40 +01:00
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ oldchunk.a = nbttagcompound.getLong("LastUpdate");
|
|
|
|
+ } catch (ClassCastException classcastexception) {
|
|
|
|
+ oldchunk.a = (long) nbttagcompound.getInt("LastUpdate");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return oldchunk;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void a(OldChunk oldchunk, NBTTagCompound nbttagcompound, WorldChunkManager worldchunkmanager) {
|
|
|
|
+ nbttagcompound.setInt("xPos", oldchunk.k);
|
|
|
|
+ nbttagcompound.setInt("zPos", oldchunk.l);
|
|
|
|
+ nbttagcompound.setLong("LastUpdate", oldchunk.a);
|
|
|
|
+ int[] aint = new int[oldchunk.c.length];
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < oldchunk.c.length; ++i) {
|
|
|
|
+ aint[i] = oldchunk.c[i];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ nbttagcompound.setIntArray("HeightMap", aint);
|
|
|
|
+ nbttagcompound.setBoolean("TerrainPopulated", oldchunk.b);
|
2013-12-01 05:13:58 +01:00
|
|
|
+ NBTTagList nbttaglist = new NBTTagList();
|
2013-01-15 02:18:40 +01:00
|
|
|
+
|
|
|
|
+ int j;
|
|
|
|
+
|
|
|
|
+ for (int k = 0; k < 8; ++k) {
|
|
|
|
+ boolean flag = true;
|
|
|
|
+
|
|
|
|
+ for (j = 0; j < 16 && flag; ++j) {
|
|
|
|
+ int l = 0;
|
|
|
|
+
|
|
|
|
+ while (l < 16 && flag) {
|
|
|
|
+ int i1 = 0;
|
|
|
|
+
|
|
|
|
+ while (true) {
|
|
|
|
+ if (i1 < 16) {
|
|
|
|
+ int j1 = j << 11 | i1 << 7 | l + (k << 4);
|
|
|
|
+ byte b0 = oldchunk.g[j1];
|
|
|
|
+
|
|
|
|
+ if (b0 == 0) {
|
|
|
|
+ ++i1;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ flag = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ++l;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!flag) {
|
|
|
|
+ byte[] abyte = new byte[4096];
|
|
|
|
+ NibbleArray nibblearray = new NibbleArray(abyte.length, 4);
|
|
|
|
+ NibbleArray nibblearray1 = new NibbleArray(abyte.length, 4);
|
|
|
|
+ NibbleArray nibblearray2 = new NibbleArray(abyte.length, 4);
|
|
|
|
+
|
|
|
|
+ for (int k1 = 0; k1 < 16; ++k1) {
|
|
|
|
+ for (int l1 = 0; l1 < 16; ++l1) {
|
|
|
|
+ for (int i2 = 0; i2 < 16; ++i2) {
|
|
|
|
+ int j2 = k1 << 11 | i2 << 7 | l1 + (k << 4);
|
|
|
|
+ byte b1 = oldchunk.g[j2];
|
|
|
|
+
|
|
|
|
+ abyte[l1 << 8 | i2 << 4 | k1] = (byte) (b1 & 255);
|
|
|
|
+ nibblearray.a(k1, l1, i2, oldchunk.f.a(k1, l1 + (k << 4), i2));
|
|
|
|
+ nibblearray1.a(k1, l1, i2, oldchunk.e.a(k1, l1 + (k << 4), i2));
|
|
|
|
+ nibblearray2.a(k1, l1, i2, oldchunk.d.a(k1, l1 + (k << 4), i2));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
|
|
|
+
|
|
|
|
+ nbttagcompound1.setByte("Y", (byte) (k & 255));
|
|
|
|
+ nbttagcompound1.setByteArray("Blocks", abyte);
|
|
|
|
+ nbttagcompound1.setByteArray("Data", nibblearray.a);
|
|
|
|
+ nbttagcompound1.setByteArray("SkyLight", nibblearray1.a);
|
|
|
|
+ nbttagcompound1.setByteArray("BlockLight", nibblearray2.a);
|
|
|
|
+ nbttaglist.add(nbttagcompound1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ nbttagcompound.set("Sections", nbttaglist);
|
|
|
|
+ byte[] abyte1 = new byte[256];
|
|
|
|
+
|
|
|
|
+ for (int k2 = 0; k2 < 16; ++k2) {
|
|
|
|
+ for (j = 0; j < 16; ++j) {
|
|
|
|
+ abyte1[j << 4 | k2] = (byte) (worldchunkmanager.getBiome(oldchunk.k << 4 | k2, oldchunk.l << 4 | j).id & 255);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ nbttagcompound.setByteArray("Biomes", abyte1);
|
|
|
|
+ nbttagcompound.set("Entities", oldchunk.h);
|
|
|
|
+ nbttagcompound.set("TileEntities", oldchunk.i);
|
|
|
|
+ if (oldchunk.j != null) {
|
|
|
|
+ nbttagcompound.set("TileTicks", oldchunk.j);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
2013-04-26 12:35:16 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..900ed68
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
|
|
@@ -0,0 +1,67 @@
|
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+import java.io.DataInputStream;
|
|
|
|
+import java.io.DataOutputStream;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Iterator;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+public class RegionFileCache {
|
|
|
|
+
|
|
|
|
+ private static final Map a = new HashMap();
|
|
|
|
+
|
|
|
|
+ public static synchronized RegionFile a(File file1, int i, int j) {
|
|
|
|
+ File file2 = new File(file1, "region");
|
|
|
|
+ File file3 = new File(file2, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
|
|
|
|
+ RegionFile regionfile = (RegionFile) a.get(file3);
|
|
|
|
+
|
|
|
|
+ if (regionfile != null) {
|
|
|
|
+ return regionfile;
|
|
|
|
+ } else {
|
|
|
|
+ if (!file2.exists()) {
|
|
|
|
+ file2.mkdirs();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (a.size() >= 256) {
|
|
|
|
+ a();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ RegionFile regionfile1 = new RegionFile(file3);
|
|
|
|
+
|
|
|
|
+ a.put(file3, regionfile1);
|
|
|
|
+ return regionfile1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static synchronized void a() {
|
|
|
|
+ Iterator iterator = a.values().iterator();
|
|
|
|
+
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ RegionFile regionfile = (RegionFile) iterator.next();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ if (regionfile != null) {
|
|
|
|
+ regionfile.c();
|
|
|
|
+ }
|
|
|
|
+ } catch (IOException ioexception) {
|
|
|
|
+ ioexception.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ a.clear();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static DataInputStream c(File file1, int i, int j) {
|
|
|
|
+ RegionFile regionfile = a(file1, i, j);
|
|
|
|
+
|
|
|
|
+ return regionfile.a(i & 31, j & 31);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static DataOutputStream d(File file1, int i, int j) {
|
|
|
|
+ RegionFile regionfile = a(file1, i, j);
|
|
|
|
+
|
|
|
|
+ return regionfile.b(i & 31, j & 31);
|
|
|
|
+ }
|
|
|
|
+}
|
2013-09-21 04:33:27 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
|
|
|
|
new file mode 100644
|
2013-12-01 05:13:58 +01:00
|
|
|
index 0000000..1eb87ae
|
2013-09-21 04:33:27 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
|
2013-12-01 05:13:58 +01:00
|
|
|
@@ -0,0 +1,217 @@
|
2013-09-21 04:33:27 +02:00
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Iterator;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.Random;
|
|
|
|
+import java.util.concurrent.Callable;
|
|
|
|
+
|
|
|
|
+public abstract class StructureGenerator extends WorldGenBase {
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ private PersistentStructure e;
|
2013-09-21 04:33:27 +02:00
|
|
|
+ protected Map d = new HashMap();
|
|
|
|
+
|
|
|
|
+ public StructureGenerator() {}
|
|
|
|
+
|
|
|
|
+ public abstract String a();
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ protected final void a(World world, int i, int j, int k, int l, Block[] ablock) {
|
2013-09-21 04:33:27 +02:00
|
|
|
+ this.a(world);
|
|
|
|
+ if (!this.d.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) {
|
|
|
|
+ this.b.nextInt();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ if (this.a(i, j)) {
|
|
|
|
+ StructureStart structurestart = this.b(i, j);
|
|
|
|
+
|
|
|
|
+ this.d.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart);
|
|
|
|
+ this.a(i, j, structurestart);
|
|
|
|
+ }
|
|
|
|
+ } catch (Throwable throwable) {
|
|
|
|
+ CrashReport crashreport = CrashReport.a(throwable, "Exception preparing structure feature");
|
|
|
|
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Feature being prepared");
|
|
|
|
+
|
|
|
|
+ crashreportsystemdetails.a("Is feature chunk", (Callable) (new CrashReportIsFeatureChunk(this, i, j)));
|
|
|
|
+ crashreportsystemdetails.a("Chunk location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)}));
|
|
|
|
+ crashreportsystemdetails.a("Chunk pos hash", (Callable) (new CrashReportChunkPosHash(this, i, j)));
|
|
|
|
+ crashreportsystemdetails.a("Structure type", (Callable) (new CrashReportStructureType(this)));
|
|
|
|
+ throw new ReportedException(crashreport);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean a(World world, Random random, int i, int j) {
|
|
|
|
+ this.a(world);
|
|
|
|
+ int k = (i << 4) + 8;
|
|
|
|
+ int l = (j << 4) + 8;
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ Iterator iterator = this.d.values().iterator();
|
|
|
|
+
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ StructureStart structurestart = (StructureStart) iterator.next();
|
|
|
|
+
|
|
|
|
+ if (structurestart.d() && structurestart.a().a(k, l, k + 15, l + 15)) {
|
|
|
|
+ structurestart.a(world, random, new StructureBoundingBox(k, l, k + 15, l + 15));
|
|
|
|
+ flag = true;
|
|
|
|
+ this.a(structurestart.e(), structurestart.f(), structurestart);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return flag;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean b(int i, int j, int k) {
|
|
|
|
+ this.a(this.c);
|
|
|
|
+ return this.c(i, j, k) != null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected StructureStart c(int i, int j, int k) {
|
|
|
|
+ Iterator iterator = this.d.values().iterator();
|
|
|
|
+
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ StructureStart structurestart = (StructureStart) iterator.next();
|
|
|
|
+
|
|
|
|
+ if (structurestart.d() && structurestart.a().a(i, k, i, k)) {
|
|
|
|
+ Iterator iterator1 = structurestart.b().iterator();
|
|
|
|
+
|
|
|
|
+ while (iterator1.hasNext()) {
|
|
|
|
+ StructurePiece structurepiece = (StructurePiece) iterator1.next();
|
|
|
|
+
|
|
|
|
+ if (structurepiece.c().b(i, j, k)) {
|
|
|
|
+ return structurestart;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean d(int i, int j, int k) {
|
|
|
|
+ this.a(this.c);
|
|
|
|
+ Iterator iterator = this.d.values().iterator();
|
|
|
|
+
|
|
|
|
+ StructureStart structurestart;
|
|
|
|
+
|
|
|
|
+ do {
|
|
|
|
+ if (!iterator.hasNext()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ structurestart = (StructureStart) iterator.next();
|
|
|
|
+ } while (!structurestart.d());
|
|
|
|
+
|
|
|
|
+ return structurestart.a().a(i, k, i, k);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public ChunkPosition getNearestGeneratedFeature(World world, int i, int j, int k) {
|
|
|
|
+ this.c = world;
|
|
|
|
+ this.a(world);
|
|
|
|
+ this.b.setSeed(world.getSeed());
|
|
|
|
+ long l = this.b.nextLong();
|
|
|
|
+ long i1 = this.b.nextLong();
|
|
|
|
+ long j1 = (long) (i >> 4) * l;
|
|
|
|
+ long k1 = (long) (k >> 4) * i1;
|
|
|
|
+
|
|
|
|
+ this.b.setSeed(j1 ^ k1 ^ world.getSeed());
|
2013-12-01 05:13:58 +01:00
|
|
|
+ this.a(world, i >> 4, k >> 4, 0, 0, (Block[]) null);
|
2013-09-21 04:33:27 +02:00
|
|
|
+ double d0 = Double.MAX_VALUE;
|
|
|
|
+ ChunkPosition chunkposition = null;
|
|
|
|
+ Iterator iterator = this.d.values().iterator();
|
|
|
|
+
|
|
|
|
+ ChunkPosition chunkposition1;
|
|
|
|
+ int l1;
|
|
|
|
+ int i2;
|
|
|
|
+ double d1;
|
|
|
|
+ int j2;
|
|
|
|
+
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ StructureStart structurestart = (StructureStart) iterator.next();
|
|
|
|
+
|
|
|
|
+ if (structurestart.d()) {
|
|
|
|
+ StructurePiece structurepiece = (StructurePiece) structurestart.b().get(0);
|
|
|
|
+
|
|
|
|
+ chunkposition1 = structurepiece.a();
|
|
|
|
+ i2 = chunkposition1.x - i;
|
|
|
|
+ l1 = chunkposition1.y - j;
|
|
|
|
+ j2 = chunkposition1.z - k;
|
|
|
|
+ d1 = (double) (i2 * i2 + l1 * l1 + j2 * j2);
|
|
|
|
+ if (d1 < d0) {
|
|
|
|
+ d0 = d1;
|
|
|
|
+ chunkposition = chunkposition1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (chunkposition != null) {
|
|
|
|
+ return chunkposition;
|
|
|
|
+ } else {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ List list = this.o_();
|
2013-09-21 04:33:27 +02:00
|
|
|
+
|
|
|
|
+ if (list != null) {
|
|
|
|
+ ChunkPosition chunkposition2 = null;
|
|
|
|
+ Iterator iterator1 = list.iterator();
|
|
|
|
+
|
|
|
|
+ while (iterator1.hasNext()) {
|
|
|
|
+ chunkposition1 = (ChunkPosition) iterator1.next();
|
|
|
|
+ i2 = chunkposition1.x - i;
|
|
|
|
+ l1 = chunkposition1.y - j;
|
|
|
|
+ j2 = chunkposition1.z - k;
|
|
|
|
+ d1 = (double) (i2 * i2 + l1 * l1 + j2 * j2);
|
|
|
|
+ if (d1 < d0) {
|
|
|
|
+ d0 = d1;
|
|
|
|
+ chunkposition2 = chunkposition1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return chunkposition2;
|
|
|
|
+ } else {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2013-12-01 05:13:58 +01:00
|
|
|
+ protected List o_() {
|
2013-09-21 04:33:27 +02:00
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void a(World world) {
|
|
|
|
+ if (this.e == null) {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a());
|
2013-09-21 04:33:27 +02:00
|
|
|
+ if (this.e == null) {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ this.e = new PersistentStructure(this.a());
|
|
|
|
+ world.a(this.a(), (PersistentBase) this.e);
|
2013-09-21 04:33:27 +02:00
|
|
|
+ } else {
|
|
|
|
+ NBTTagCompound nbttagcompound = this.e.a();
|
|
|
|
+ Iterator iterator = nbttagcompound.c().iterator();
|
|
|
|
+
|
|
|
|
+ while (iterator.hasNext()) {
|
2013-12-01 05:13:58 +01:00
|
|
|
+ String s = (String) iterator.next();
|
|
|
|
+ NBTBase nbtbase = nbttagcompound.get(s);
|
2013-09-21 04:33:27 +02:00
|
|
|
+
|
|
|
|
+ if (nbtbase.getTypeId() == 10) {
|
|
|
|
+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbtbase;
|
|
|
|
+
|
|
|
|
+ if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ")) {
|
|
|
|
+ int i = nbttagcompound1.getInt("ChunkX");
|
|
|
|
+ int j = nbttagcompound1.getInt("ChunkZ");
|
|
|
|
+ StructureStart structurestart = WorldGenFactory.a(nbttagcompound1, world);
|
|
|
|
+
|
|
|
|
+ this.d.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void a(int i, int j, StructureStart structurestart) {
|
|
|
|
+ this.e.a(structurestart.a(i, j), i, j);
|
|
|
|
+ this.e.c();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected abstract boolean a(int i, int j);
|
|
|
|
+
|
|
|
|
+ protected abstract StructureStart b(int i, int j);
|
|
|
|
+}
|
2013-01-15 02:18:40 +01:00
|
|
|
--
|
2013-12-01 05:13:58 +01:00
|
|
|
1.8.3.2
|
2013-01-15 02:18:40 +01:00
|
|
|
|