Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
SPIGOT-3829: Apply some speed limits to all entities
Dieser Commit ist enthalten in:
Ursprung
bacaf9274b
Commit
1bb523c4e4
@ -372,7 +372,7 @@
|
|||||||
|
|
||||||
this.locX = nbttaglist.f(0);
|
this.locX = nbttaglist.f(0);
|
||||||
this.locY = nbttaglist.f(1);
|
this.locY = nbttaglist.f(1);
|
||||||
@@ -1397,6 +1619,58 @@
|
@@ -1397,6 +1619,57 @@
|
||||||
this.setPosition(this.locX, this.locY, this.locZ);
|
this.setPosition(this.locX, this.locY, this.locZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,20 +388,19 @@
|
|||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start - Exempt Vehicles from notch's sanity check
|
+ // CraftBukkit start
|
||||||
+ if (!(getBukkitEntity() instanceof Vehicle)) {
|
+ double limit = getBukkitEntity() instanceof Vehicle ? 100.0D : 10.0D;
|
||||||
+ if (Math.abs(this.motX) > 10.0D) {
|
+ if (Math.abs(this.motX) > limit) {
|
||||||
+ this.motX = 0.0D;
|
+ this.motX = 0.0D;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (Math.abs(this.motY) > 10.0D) {
|
+ if (Math.abs(this.motY) > limit) {
|
||||||
+ this.motY = 0.0D;
|
+ this.motY = 0.0D;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (Math.abs(this.motZ) > 10.0D) {
|
+ if (Math.abs(this.motZ) > limit) {
|
||||||
+ this.motZ = 0.0D;
|
+ this.motZ = 0.0D;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start - Reset world
|
+ // CraftBukkit start - Reset world
|
||||||
@ -431,7 +430,7 @@
|
|||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||||
@@ -1464,6 +1738,12 @@
|
@@ -1464,6 +1737,12 @@
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -444,7 +443,7 @@
|
|||||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
|
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
|
||||||
|
|
||||||
entityitem.q();
|
entityitem.q();
|
||||||
@@ -1589,6 +1869,24 @@
|
@@ -1589,6 +1868,24 @@
|
||||||
if (entity.bJ() != this) {
|
if (entity.bJ() != this) {
|
||||||
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||||
} else {
|
} else {
|
||||||
@ -469,7 +468,7 @@
|
|||||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bE() instanceof EntityHuman)) {
|
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bE() instanceof EntityHuman)) {
|
||||||
this.passengers.add(0, entity);
|
this.passengers.add(0, entity);
|
||||||
} else {
|
} else {
|
||||||
@@ -1602,6 +1900,22 @@
|
@@ -1602,6 +1899,22 @@
|
||||||
if (entity.bJ() == this) {
|
if (entity.bJ() == this) {
|
||||||
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
||||||
} else {
|
} else {
|
||||||
@ -492,7 +491,7 @@
|
|||||||
this.passengers.remove(entity);
|
this.passengers.remove(entity);
|
||||||
entity.j = 60;
|
entity.j = 60;
|
||||||
}
|
}
|
||||||
@@ -1741,14 +2055,49 @@
|
@@ -1741,14 +2054,49 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirTicks(int i) {
|
public void setAirTicks(int i) {
|
||||||
@ -545,7 +544,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1893,19 +2242,76 @@
|
@@ -1893,19 +2241,76 @@
|
||||||
if (!this.world.isClientSide && !this.dead) {
|
if (!this.world.isClientSide && !this.dead) {
|
||||||
this.world.methodProfiler.a("changeDimension");
|
this.world.methodProfiler.a("changeDimension");
|
||||||
MinecraftServer minecraftserver = this.C_();
|
MinecraftServer minecraftserver = this.C_();
|
||||||
@ -625,7 +624,7 @@
|
|||||||
BlockPosition blockposition;
|
BlockPosition blockposition;
|
||||||
|
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
@@ -1934,12 +2340,18 @@
|
@@ -1934,12 +2339,18 @@
|
||||||
blockposition = new BlockPosition(this);
|
blockposition = new BlockPosition(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,7 +644,7 @@
|
|||||||
if (j == 1 && i == 1) {
|
if (j == 1 && i == 1) {
|
||||||
BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn());
|
BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn());
|
||||||
|
|
||||||
@@ -1947,6 +2359,7 @@
|
@@ -1947,6 +2358,7 @@
|
||||||
} else {
|
} else {
|
||||||
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
|
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
|
||||||
}
|
}
|
||||||
@ -653,7 +652,7 @@
|
|||||||
|
|
||||||
boolean flag = entity.attachedToPlayer;
|
boolean flag = entity.attachedToPlayer;
|
||||||
|
|
||||||
@@ -1954,13 +2367,21 @@
|
@@ -1954,13 +2366,21 @@
|
||||||
worldserver1.addEntity(entity);
|
worldserver1.addEntity(entity);
|
||||||
entity.attachedToPlayer = flag;
|
entity.attachedToPlayer = flag;
|
||||||
worldserver1.entityJoinedWorld(entity, false);
|
worldserver1.entityJoinedWorld(entity, false);
|
||||||
@ -676,7 +675,7 @@
|
|||||||
return entity;
|
return entity;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@@ -2064,6 +2485,11 @@
|
@@ -2064,6 +2484,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustomName(String s) {
|
public void setCustomName(String s) {
|
||||||
@ -688,7 +687,7 @@
|
|||||||
this.datawatcher.set(Entity.aB, s);
|
this.datawatcher.set(Entity.aB, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2121,7 +2547,26 @@
|
@@ -2121,7 +2546,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(AxisAlignedBB axisalignedbb) {
|
public void a(AxisAlignedBB axisalignedbb) {
|
||||||
@ -716,7 +715,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getHeadHeight() {
|
public float getHeadHeight() {
|
||||||
@@ -2295,7 +2740,7 @@
|
@@ -2295,7 +2739,7 @@
|
||||||
for (Iterator iterator = this.bF().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
|
for (Iterator iterator = this.bF().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
|
||||||
entity = (Entity) iterator.next();
|
entity = (Entity) iterator.next();
|
||||||
if (oclass.isAssignableFrom(entity.getClass())) {
|
if (oclass.isAssignableFrom(entity.getClass())) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren