Upstream Paper

This commit is contained in:
Sotr
2019-03-18 19:06:16 +08:00
parent 956e1fe461
commit cc8cb0bb4c
4 changed files with 8 additions and 28 deletions

View File

@@ -5,12 +5,12 @@ import javax.annotation.Nullable;
public class AxisAlignedBB {
public final double minX; public double getMinX() { return this.minX; } // Paper - OBFHELPER
public final double minY; public double getMinY() { return this.minY; } // Paper - OBFHELPER
public final double minZ; public double getMinZ() { return this.minZ; } // Paper - OBFHELPER
public final double maxX; public double getMaxX() { return this.maxX; } // Paper - OBFHELPER
public final double maxY; public double getMaxY() { return this.maxY; } // Paper - OBFHELPER
public final double maxZ; public double getMaxZ() { return this.maxZ; } // Paper - OBFHELPER
public final double minX;
public final double minY;
public final double minZ;
public final double maxX;
public final double maxY;
public final double maxZ;
public AxisAlignedBB(double d0, double d1, double d2, double d3, double d4, double d5) {
this.minX = Math.min(d0, d3);

View File

@@ -1675,12 +1675,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (spawnedViaMobSpawner) {
nbttagcompound.setBoolean("Paper.FromMobSpawner", true);
}
// Paper start - MC-2025 fix - Save entity AABB and load it, floating point issues recalculating AABB can result in wobble
AxisAlignedBB boundingBox = this.getBoundingBox();
nbttagcompound.set("Paper.AAAB", this.createList(
boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMinZ(),
boundingBox.getMaxX(), boundingBox.getMaxY(), boundingBox.getMaxZ()
));
// Paper end
return nbttagcompound;
} catch (Throwable throwable) {
@@ -1770,16 +1764,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (this.aD()) {
this.setPosition(this.locX, this.locY, this.locZ);
}
// Paper start - MC-2025 fix - Save entity AABB and load it, floating point issues recalculating AABB can result in wobble
// Placement is important, always after the setPosition call above
if (nbttagcompound.hasKey("Paper.AABB")) {
NBTTagList savedBB = nbttagcompound.getList("Paper.AABB", 6);
this.setBoundingBox(new AxisAlignedBB(
savedBB.getDoubleAt(0), savedBB.getDoubleAt(1), savedBB.getDoubleAt(2),
savedBB.getDoubleAt(3), savedBB.getDoubleAt(4), savedBB.getDoubleAt(5)
));
}
// Paper end
// CraftBukkit start
if (this instanceof EntityLiving) {
@@ -2857,7 +2841,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.boundingBox;
}
public void setBoundingBox(AxisAlignedBB axisAlignedBB) { this.a(axisAlignedBB); } // Paper - OBFHELPER
public void a(AxisAlignedBB axisalignedbb) {
// CraftBukkit start - block invalid bounding boxes
double minX = axisalignedbb.minX,

View File

@@ -1329,6 +1329,7 @@ public abstract class PlayerList {
}
public void setHasWhitelist(boolean flag) {
new com.destroystokyo.paper.event.server.WhitelistToggleEvent(flag).callEvent();
this.whitelist.setEnabled(flag); // Paper
}

View File

@@ -131,11 +131,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
TileEntity tile = getTileEntityFromWorld();
if (isApplicable(tile)) {
// Paper start
if (!snapshotDisabled) {
applyTo(tileEntityClass.cast(tile));
}
// Paper end
applyTo(tileEntityClass.cast(tile));
tile.update();
}
}