SPIGOT-1525: Fix worldborder set.

This commit is contained in:
md_5 2016-03-01 11:20:42 +11:00
parent 5eceede8a1
commit f5d92d6b12

View file

@ -75,15 +75,18 @@
this.u = Lists.newArrayList(new IWorldAccess[] { this.t}); this.u = Lists.newArrayList(new IWorldAccess[] { this.t});
this.L = Calendar.getInstance(); this.L = Calendar.getInstance();
this.scoreboard = new Scoreboard(); this.scoreboard = new Scoreboard();
@@ -69,6 +128,7 @@ @@ -69,6 +128,10 @@
this.worldProvider = worldprovider; this.worldProvider = worldprovider;
this.isClientSide = flag; this.isClientSide = flag;
this.N = worldprovider.getWorldBorder(); this.N = worldprovider.getWorldBorder();
+ this.getServer().addWorld(this.world); // CraftBukkit + // CraftBukkit start
+ this.N.world = (WorldServer) this;
+ this.getServer().addWorld(this.world);
+ // CraftBukkit end
} }
public World b() { public World b() {
@@ -197,6 +257,27 @@ @@ -197,6 +260,27 @@
} }
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
@ -111,7 +114,7 @@
if (!this.isValidLocation(blockposition)) { if (!this.isValidLocation(blockposition)) {
return false; return false;
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { } else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
@@ -204,9 +285,23 @@ @@ -204,9 +288,23 @@
} else { } else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition); Chunk chunk = this.getChunkAtWorldCoords(blockposition);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
@ -135,7 +138,7 @@
return false; return false;
} else { } else {
if (iblockdata.c() != iblockdata1.c() || iblockdata.d() != iblockdata1.d()) { if (iblockdata.c() != iblockdata1.c() || iblockdata.d() != iblockdata1.d()) {
@@ -215,6 +310,7 @@ @@ -215,6 +313,7 @@
this.methodProfiler.b(); this.methodProfiler.b();
} }
@ -143,7 +146,7 @@
if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && chunk.isReady()) { if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && chunk.isReady()) {
this.notify(blockposition, iblockdata1, iblockdata, i); this.notify(blockposition, iblockdata1, iblockdata, i);
} }
@@ -225,12 +321,35 @@ @@ -225,12 +324,35 @@
this.updateAdjacentComparators(blockposition, block); this.updateAdjacentComparators(blockposition, block);
} }
} }
@ -179,7 +182,7 @@
public boolean setAir(BlockPosition blockposition) { public boolean setAir(BlockPosition blockposition) {
return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
} }
@@ -264,6 +383,11 @@ @@ -264,6 +386,11 @@
public void update(BlockPosition blockposition, Block block) { public void update(BlockPosition blockposition, Block block) {
if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) { if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
@ -191,7 +194,7 @@
this.applyPhysics(blockposition, block); this.applyPhysics(blockposition, block);
} }
@@ -339,6 +463,17 @@ @@ -339,6 +466,17 @@
IBlockData iblockdata = this.getType(blockposition); IBlockData iblockdata = this.getType(blockposition);
try { try {
@ -209,7 +212,7 @@
iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block); iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block);
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
@@ -520,6 +655,17 @@ @@ -520,6 +658,17 @@
} }
public IBlockData getType(BlockPosition blockposition) { public IBlockData getType(BlockPosition blockposition) {
@ -227,7 +230,7 @@
if (!this.isValidLocation(blockposition)) { if (!this.isValidLocation(blockposition)) {
return Blocks.AIR.getBlockData(); return Blocks.AIR.getBlockData();
} else { } else {
@@ -715,6 +861,13 @@ @@ -715,6 +864,13 @@
} }
public boolean addEntity(Entity entity) { public boolean addEntity(Entity entity) {
@ -241,7 +244,7 @@
int i = MathHelper.floor(entity.locX / 16.0D); int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = entity.attachedToPlayer; boolean flag = entity.attachedToPlayer;
@@ -723,6 +876,34 @@ @@ -723,6 +879,34 @@
flag = true; flag = true;
} }
@ -276,7 +279,7 @@
if (!flag && !this.isChunkLoaded(i, j, false)) { if (!flag && !this.isChunkLoaded(i, j, false)) {
return false; return false;
} else { } else {
@@ -745,6 +926,7 @@ @@ -745,6 +929,7 @@
((IWorldAccess) this.u.get(i)).a(entity); ((IWorldAccess) this.u.get(i)).a(entity);
} }
@ -284,7 +287,7 @@
} }
protected void c(Entity entity) { protected void c(Entity entity) {
@@ -787,7 +969,15 @@ @@ -787,7 +972,15 @@
this.getChunkAt(i, j).b(entity); this.getChunkAt(i, j).b(entity);
} }
@ -301,7 +304,7 @@
this.c(entity); this.c(entity);
} }
@@ -1039,6 +1229,11 @@ @@ -1039,6 +1232,11 @@
for (i = 0; i < this.j.size(); ++i) { for (i = 0; i < this.j.size(); ++i) {
entity = (Entity) this.j.get(i); entity = (Entity) this.j.get(i);
@ -313,7 +316,7 @@
try { try {
++entity.ticksLived; ++entity.ticksLived;
@@ -1087,8 +1282,10 @@ @@ -1087,8 +1285,10 @@
CrashReportSystemDetails crashreportsystemdetails1; CrashReportSystemDetails crashreportsystemdetails1;
CrashReport crashreport1; CrashReport crashreport1;
@ -326,7 +329,7 @@
Entity entity1 = entity.by(); Entity entity1 = entity.by();
if (entity1 != null) { if (entity1 != null) {
@@ -1121,7 +1318,7 @@ @@ -1121,7 +1321,7 @@
this.getChunkAt(j, l).b(entity); this.getChunkAt(j, l).b(entity);
} }
@ -335,7 +338,7 @@
this.c(entity); this.c(entity);
} }
@@ -1130,6 +1327,13 @@ @@ -1130,6 +1330,13 @@
this.methodProfiler.c("blockEntities"); this.methodProfiler.c("blockEntities");
this.M = true; this.M = true;
@ -349,7 +352,7 @@
Iterator iterator = this.tileEntityListTick.iterator(); Iterator iterator = this.tileEntityListTick.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1162,11 +1366,13 @@ @@ -1162,11 +1369,13 @@
} }
this.M = false; this.M = false;
@ -363,7 +366,7 @@
this.methodProfiler.c("pendingBlockEntities"); this.methodProfiler.c("pendingBlockEntities");
if (!this.b.isEmpty()) { if (!this.b.isEmpty()) {
@@ -1174,9 +1380,11 @@ @@ -1174,9 +1383,11 @@
TileEntity tileentity1 = (TileEntity) this.b.get(i1); TileEntity tileentity1 = (TileEntity) this.b.get(i1);
if (!tileentity1.x()) { if (!tileentity1.x()) {
@ -375,7 +378,7 @@
if (this.isLoaded(tileentity1.getPosition())) { if (this.isLoaded(tileentity1.getPosition())) {
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition()); Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
@@ -1231,7 +1439,10 @@ @@ -1231,7 +1442,10 @@
int j = MathHelper.floor(entity.locZ); int j = MathHelper.floor(entity.locZ);
byte b0 = 32; byte b0 = 32;
@ -387,7 +390,7 @@
entity.M = entity.locX; entity.M = entity.locX;
entity.N = entity.locY; entity.N = entity.locY;
entity.O = entity.locZ; entity.O = entity.locZ;
@@ -1570,10 +1781,18 @@ @@ -1570,10 +1784,18 @@
} }
} }
@ -406,7 +409,7 @@
TileEntity tileentity = null; TileEntity tileentity = null;
int i; int i;
TileEntity tileentity1; TileEntity tileentity1;
@@ -1608,6 +1827,14 @@ @@ -1608,6 +1830,14 @@
public void setTileEntity(BlockPosition blockposition, TileEntity tileentity) { public void setTileEntity(BlockPosition blockposition, TileEntity tileentity) {
if (tileentity != null && !tileentity.x()) { if (tileentity != null && !tileentity.x()) {
@ -421,7 +424,7 @@
if (this.M) { if (this.M) {
tileentity.a(blockposition); tileentity.a(blockposition);
Iterator iterator = this.b.iterator(); Iterator iterator = this.b.iterator();
@@ -1762,6 +1989,14 @@ @@ -1762,6 +1992,14 @@
} }
this.o = MathHelper.a(this.o, 0.0F, 1.0F); this.o = MathHelper.a(this.o, 0.0F, 1.0F);
@ -436,7 +439,7 @@
} }
} }
} }
@@ -1893,7 +2128,10 @@ @@ -1893,7 +2131,10 @@
} }
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@ -448,7 +451,7 @@
return false; return false;
} else { } else {
int i = 0; int i = 0;
@@ -2058,7 +2296,7 @@ @@ -2058,7 +2299,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -457,7 +460,7 @@
arraylist.add(entity); arraylist.add(entity);
} }
} }
@@ -2073,7 +2311,7 @@ @@ -2073,7 +2314,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -466,7 +469,7 @@
arraylist.add(entity); arraylist.add(entity);
} }
} }
@@ -2121,7 +2359,7 @@ @@ -2121,7 +2362,7 @@
} }
} }
@ -475,7 +478,7 @@
} }
public Entity getEntity(int i) { public Entity getEntity(int i) {
@@ -2141,8 +2379,17 @@ @@ -2141,8 +2382,17 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -495,7 +498,7 @@
++i; ++i;
} }
} }
@@ -2151,12 +2398,18 @@ @@ -2151,12 +2401,18 @@
} }
public void a(Collection<Entity> collection) { public void a(Collection<Entity> collection) {
@ -515,7 +518,7 @@
this.b(entity); this.b(entity);
} }
@@ -2170,7 +2423,13 @@ @@ -2170,7 +2426,13 @@
IBlockData iblockdata = this.getType(blockposition); IBlockData iblockdata = this.getType(blockposition);
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(this, blockposition); AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(this, blockposition);
@ -530,7 +533,7 @@
} }
public int K() { public int K() {
@@ -2270,6 +2529,11 @@ @@ -2270,6 +2532,11 @@
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@ -542,7 +545,7 @@
if ((IEntitySelector.d.apply(entityhuman1) || !flag) && (IEntitySelector.e.apply(entityhuman1) || flag)) { if ((IEntitySelector.d.apply(entityhuman1) || !flag) && (IEntitySelector.e.apply(entityhuman1) || flag)) {
double d5 = entityhuman1.e(d0, d1, d2); double d5 = entityhuman1.e(d0, d1, d2);
@@ -2433,6 +2697,16 @@ @@ -2433,6 +2700,16 @@
public void everyoneSleeping() {} public void everyoneSleeping() {}
@ -559,7 +562,7 @@
public float h(float f) { public float h(float f) {
return (this.p + (this.q - this.p) * f) * this.j(f); return (this.p + (this.q - this.p) * f) * this.j(f);
} }
@@ -2648,7 +2922,7 @@ @@ -2648,7 +2925,7 @@
int l = j * 16 + 8 - blockposition.getZ(); int l = j * 16 + 8 - blockposition.getZ();
short short0 = 128; short short0 = 128;