Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Moved changes we did to WorldServer back down to World.
Dieser Commit ist enthalten in:
Ursprung
421d1c1c1f
Commit
2497a61044
@ -434,6 +434,16 @@ public class World implements IBlockAccess {
|
||||
Block block = Block.byId[this.getTypeId(i, j, k)];
|
||||
|
||||
if (block != null) {
|
||||
// CraftBukkit start
|
||||
if (world != null) {
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i, j, k), l);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit stop
|
||||
|
||||
block.b(this, i, j, k, l);
|
||||
}
|
||||
}
|
||||
@ -1623,7 +1633,18 @@ public class World implements IBlockAccess {
|
||||
axisalignedbb = null;
|
||||
}
|
||||
|
||||
return axisalignedbb != null && !this.a(axisalignedbb) ? false : (block != Block.WATER && block != Block.STATIONARY_WATER && block != Block.LAVA && block != Block.STATIONARY_LAVA && block != Block.FIRE && block != Block.SNOW ? i > 0 && block == null && block1.a(this, j, k, l) : true);
|
||||
// Craftbukkit start - We dont want to allow the user to override the bounding box check
|
||||
boolean defaultReturn = axisalignedbb != null && !this.a(axisalignedbb) ? false : (block != Block.WATER && block != Block.STATIONARY_WATER && block != Block.LAVA && block != Block.STATIONARY_LAVA && block != Block.FIRE && block != Block.SNOW ? i > 0 && block == null && block1.a(this, j, k, l) : true);
|
||||
|
||||
if (!defaultReturn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(Type.BLOCK_CANBUILD, getWorld().getBlockAt(j, k, l), i1, defaultReturn);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
return event.isBuildable();
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public PathEntity a(Entity entity, Entity entity1, float f) {
|
||||
|
@ -125,63 +125,4 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
super.c(i, j, k, l, i1);
|
||||
this.D.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1));
|
||||
}
|
||||
|
||||
// XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED!
|
||||
// XXX: done because it calls private k()
|
||||
@Override
|
||||
public void h(int i, int j, int k, int l) {
|
||||
this.l(i - 1, j, k, l);
|
||||
this.l(i + 1, j, k, l);
|
||||
this.l(i, j - 1, k, l);
|
||||
this.l(i, j + 1, k, l);
|
||||
this.l(i, j, k - 1, l);
|
||||
this.l(i, j, k + 1, l);
|
||||
}
|
||||
|
||||
// XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED!
|
||||
private void l(int i, int j, int k, int l) {
|
||||
if (!this.i && !this.isStatic) {
|
||||
Block block = Block.byId[this.getTypeId(i, j, k)];
|
||||
|
||||
if (block != null) {
|
||||
// CraftBukkit start
|
||||
if (world != null) {
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i, j, k), l);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit stop
|
||||
|
||||
block.b(this, i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: the following method is straight from the World.java with tweaks as noted. KEEP THEM UPDATED!
|
||||
@Override
|
||||
public boolean a(int i, int j, int k, int l, boolean flag) {
|
||||
int i1 = this.getTypeId(j, k, l);
|
||||
Block block = Block.byId[i1];
|
||||
Block block1 = Block.byId[i];
|
||||
AxisAlignedBB axisalignedbb = block1.d(this, j, k, l);
|
||||
|
||||
if (flag) {
|
||||
axisalignedbb = null;
|
||||
}
|
||||
|
||||
// Craftbukkit start - We dont want to allow the user to override the bounding box check
|
||||
boolean defaultReturn = axisalignedbb != null && !this.a(axisalignedbb) ? false : (block != Block.WATER && block != Block.STATIONARY_WATER && block != Block.LAVA && block != Block.STATIONARY_LAVA && block != Block.FIRE && block != Block.SNOW ? i > 0 && block == null && block1.a(this, j, k, l) : true);
|
||||
|
||||
if (!defaultReturn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(Type.BLOCK_CANBUILD, getWorld().getBlockAt(j, k, l), i1, defaultReturn);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
return event.isBuildable();
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren