diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-13 17:33:27 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-15 13:28:59 -0500 |
commit | 83d29e461c85733f0113b6eb19db6e3b42da2949 (patch) | |
tree | b3063a1c28f478ab368d5ba3413a842def68c28f /src/main/java/net/minecraft/server/Chunk.java | |
parent | ba6e4c38cfa98ad291974195cc46d70a4f138ac1 (diff) | |
download | craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.gz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.lz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.xz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.zip |
Update CraftBukkit to Minecraft 1.5
Diffstat (limited to 'src/main/java/net/minecraft/server/Chunk.java')
-rw-r--r-- | src/main/java/net/minecraft/server/Chunk.java | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index 93c343e1..ce5c73b7 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -159,7 +159,7 @@ public class Chunk { if (chunksection != null) { chunksection.c(j, i1 & 15, k, l); - this.world.o((this.x << 4) + j, i1, (this.z << 4) + k); + this.world.p((this.x << 4) + j, i1, (this.z << 4) + k); } } @@ -262,7 +262,7 @@ public class Chunk { } if (i1 != l) { - this.world.g(i + this.x * 16, k + this.z * 16, i1, l); + this.world.e(i + this.x * 16, k + this.z * 16, i1, l); this.heightMap[k << 4 | i] = i1; int j1 = this.x * 16 + i; int k1 = this.z * 16 + k; @@ -277,7 +277,7 @@ public class Chunk { chunksection = this.sections[l1 >> 4]; if (chunksection != null) { chunksection.c(i, l1 & 15, k, 15); - this.world.o((this.x << 4) + i, l1, (this.z << 4) + k); + this.world.p((this.x << 4) + i, l1, (this.z << 4) + k); } } } else { @@ -285,7 +285,7 @@ public class Chunk { chunksection = this.sections[l1 >> 4]; if (chunksection != null) { chunksection.c(i, l1 & 15, k, 0); - this.world.o((this.x << 4) + i, l1, (this.z << 4) + k); + this.world.p((this.x << 4) + i, l1, (this.z << 4) + k); } } } @@ -361,10 +361,6 @@ public class Chunk { } } - public boolean a(int i, int j, int k, int l) { - return this.a(i, j, k, l, 0); - } - public boolean a(int i, int j, int k, int l, int i1) { int j1 = k << 4 | i; @@ -387,7 +383,7 @@ public class Chunk { return false; } - chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !world.worldProvider.f); + chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.f); flag = j >= k1; } @@ -395,15 +391,15 @@ public class Chunk { int k2 = this.z * 16 + k; if (l1 != 0 && !this.world.isStatic) { - Block.byId[l1].h(this.world, j2, j, k2, i2); + Block.byId[l1].l(this.world, j2, j, k2, i2); } chunksection.a(i, j & 15, k, l); if (l1 != 0) { if (!this.world.isStatic) { Block.byId[l1].remove(this.world, j2, j, k2, l1, i2); - } else if (Block.byId[l1] instanceof BlockContainer && l1 != l) { - this.world.r(j2, j, k2); + } else if (Block.byId[l1] instanceof IContainer && l1 != l) { + this.world.s(j2, j, k2); } } @@ -433,7 +429,7 @@ public class Chunk { Block.byId[l].onPlace(this.world, j2, j, k2); } - if (Block.byId[l] instanceof BlockContainer) { + if (Block.byId[l] instanceof IContainer) { // CraftBukkit start - don't create tile entity if placement failed if (this.getTypeId(i, j, k) != l) { return false; @@ -442,18 +438,18 @@ public class Chunk { tileentity = this.e(i, j, k); if (tileentity == null) { - tileentity = ((BlockContainer) Block.byId[l]).a(this.world); + tileentity = ((IContainer) Block.byId[l]).b(this.world); this.world.setTileEntity(j2, j, k2, tileentity); } if (tileentity != null) { - tileentity.h(); + tileentity.i(); } } - } else if (l1 > 0 && Block.byId[l1] instanceof BlockContainer) { + } else if (l1 > 0 && Block.byId[l1] instanceof IContainer) { tileentity = this.e(i, j, k); if (tileentity != null) { - tileentity.h(); + tileentity.i(); } } @@ -478,11 +474,11 @@ public class Chunk { chunksection.b(i, j & 15, k, l); int j1 = chunksection.a(i, j & 15, k); - if (j1 > 0 && Block.byId[j1] instanceof BlockContainer) { + if (j1 > 0 && Block.byId[j1] instanceof IContainer) { TileEntity tileentity = this.e(i, j, k); if (tileentity != null) { - tileentity.h(); + tileentity.i(); tileentity.p = l; } } @@ -502,7 +498,7 @@ public class Chunk { ChunkSection chunksection = this.sections[j >> 4]; if (chunksection == null) { - chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !world.worldProvider.f); + chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.f); this.initLighting(); } @@ -562,15 +558,15 @@ public class Chunk { k = this.entitySlices.length - 1; } - entity.ah = true; - entity.ai = this.x; - entity.aj = k; - entity.ak = this.z; + entity.ai = true; + entity.aj = this.x; + entity.ak = k; + entity.al = this.z; this.entitySlices[k].add(entity); } public void b(Entity entity) { - this.a(entity, entity.aj); + this.a(entity, entity.ak); } public void a(Entity entity, int i) { @@ -596,12 +592,12 @@ public class Chunk { if (tileentity == null) { int l = this.getTypeId(i, j, k); - if (l <= 0 || !Block.byId[l].u()) { + if (l <= 0 || !Block.byId[l].t()) { return null; } if (tileentity == null) { - tileentity = ((BlockContainer) Block.byId[l]).a(this.world); + tileentity = ((IContainer) Block.byId[l]).b(this.world); this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity); } @@ -634,7 +630,11 @@ public class Chunk { tileentity.x = this.x * 16 + i; tileentity.y = j; tileentity.z = this.z * 16 + k; - if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) { + if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof IContainer) { + if (this.tileEntities.containsKey(chunkposition)) { + ((TileEntity) this.tileEntities.get(chunkposition)).w_(); + } + tileentity.s(); this.tileEntities.put(chunkposition, tileentity); // CraftBukkit start @@ -700,16 +700,18 @@ public class Chunk { this.l = true; } - public void a(Entity entity, AxisAlignedBB axisalignedbb, List list) { + public void a(Entity entity, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) { int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D); if (i < 0) { i = 0; + j = Math.max(i, j); } if (j >= this.entitySlices.length) { j = this.entitySlices.length - 1; + i = Math.min(i, j); } for (int k = i; k <= j; ++k) { @@ -718,14 +720,14 @@ public class Chunk { for (int l = 0; l < list1.size(); ++l) { Entity entity1 = (Entity) list1.get(l); - if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) { + if (entity1 != entity && entity1.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) { list.add(entity1); - Entity[] aentity = entity1.ao(); + Entity[] aentity = entity1.an(); if (aentity != null) { for (int i1 = 0; i1 < aentity.length; ++i1) { entity1 = aentity[i1]; - if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) { + if (entity1 != entity && entity1.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) { list.add(entity1); } } @@ -766,7 +768,7 @@ public class Chunk { public boolean a(boolean flag) { if (flag) { - if (this.m && this.world.getTime() != this.n) { + if (this.m && this.world.getTime() != this.n || this.l) { return true; } } else if (this.m && this.world.getTime() >= this.n + 600L) { @@ -906,30 +908,30 @@ public class Chunk { if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].a(k, k1, l) == 0) { if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) { - this.world.z(i1, l1 - 1, j1); + this.world.A(i1, l1 - 1, j1); } if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) { - this.world.z(i1, l1 + 1, j1); + this.world.A(i1, l1 + 1, j1); } if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) { - this.world.z(i1 - 1, l1, j1); + this.world.A(i1 - 1, l1, j1); } if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) { - this.world.z(i1 + 1, l1, j1); + this.world.A(i1 + 1, l1, j1); } if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) { - this.world.z(i1, l1, j1 - 1); + this.world.A(i1, l1, j1 - 1); } if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) { - this.world.z(i1, l1, j1 + 1); + this.world.A(i1, l1, j1 + 1); } - this.world.z(i1, l1, j1); + this.world.A(i1, l1, j1); } } } |