a bunch more patches done
This commit is contained in:
parent
c3fc3de622
commit
dc12a6e9fe
41 changed files with 177 additions and 170 deletions
|
@ -0,0 +1,29 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: David Slovikosky <davidslovikosky@gmail.com>
|
||||
Date: Tue, 9 Jun 2020 00:10:03 -0700
|
||||
Subject: [PATCH] Fix missing chunks due to integer overflow
|
||||
|
||||
1.19: Either no longer needed or has to take a very different form -MM
|
||||
|
||||
This patch fixes a bug in the WorldChunkManagerTheEnd class where the distance
|
||||
from 0,0 squared overflows the maximum size of an integer. The overflow leads
|
||||
to hard chunk borders around 370,000 blocks from 0,0. After this cutoff there
|
||||
is a few hundred thousand block gap before end land resuming to generate at
|
||||
530,000 blocks from spawn. This is due to the integer flipping back and forth.
|
||||
|
||||
The fix for the issue is quite simple, casting chunk coordinates to longs
|
||||
allows the distance calculation to avoid overflow and work as intended.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
index bbb43461ad899aae2212c32a9e839c766b3b8e37..3f9127f93c9720c89b578d36a1bcdb89fc01222a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
@@ -84,7 +84,7 @@ public class TheEndBiomeSource extends BiomeSource {
|
||||
int l = j / 2;
|
||||
int m = i % 2;
|
||||
int n = j % 2;
|
||||
- float f = 100.0F - Mth.sqrt((float)(i * i + j * j)) * 8.0F;
|
||||
+ float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow
|
||||
f = Mth.clamp(f, -100.0F, 80.0F);
|
||||
|
||||
for(int o = -12; o <= 12; ++o) {
|
|
@ -0,0 +1,39 @@
|
|||
1.19: the position vectors aren't the same for all entities here. Can maybe just handle them differently
|
||||
I think only Paintings are different
|
||||
|
||||
Part of this patch was merged, see the same name
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 5e3f489964489e0facc93a823a1cb84b4c8abce7..1a4350b40d15edba998e3dee5f16cde4e9f50759 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -143,8 +143,12 @@ public class ServerEntity {
|
||||
++this.teleportDelay;
|
||||
i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F);
|
||||
j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F);
|
||||
- Vec3 vec3d = this.entity.position().subtract(ClientboundMoveEntityPacket.packetToEntity(this.xp, this.yp, this.zp));
|
||||
- boolean flag1 = vec3d.lengthSqr() >= 7.62939453125E-6D;
|
||||
+ // Paper start - reduce allocation of Vec3D here
|
||||
+ double vec3d_dx = this.entity.getX() - 2.44140625E-4D*(this.xp);
|
||||
+ double vec3d_dy = this.entity.getY() - 2.44140625E-4D*(this.yp);
|
||||
+ double vec3d_dz = this.entity.getZ() - 2.44140625E-4D*(this.zp);
|
||||
+ boolean flag1 = (vec3d_dx * vec3d_dx + vec3d_dy * vec3d_dy + vec3d_dz * vec3d_dz) >= 7.62939453125E-6D;
|
||||
+ // Paper end - reduce allocation of Vec3D here
|
||||
Packet<?> packet1 = null;
|
||||
boolean flag2 = flag1 || this.tickCount % 60 == 0;
|
||||
boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;
|
||||
@@ -161,9 +165,11 @@ public class ServerEntity {
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.tickCount > 0 || this.entity instanceof AbstractArrow) {
|
||||
- long k = ClientboundMoveEntityPacket.entityToPacket(vec3d.x);
|
||||
- long l = ClientboundMoveEntityPacket.entityToPacket(vec3d.y);
|
||||
- long i1 = ClientboundMoveEntityPacket.entityToPacket(vec3d.z);
|
||||
+ // Paper start - remove allocation of Vec3D here
|
||||
+ long k = ClientboundMoveEntityPacket.entityToPacket(vec3d_dx);
|
||||
+ long l = ClientboundMoveEntityPacket.entityToPacket(vec3d_dy);
|
||||
+ long i1 = ClientboundMoveEntityPacket.entityToPacket(vec3d_dz);
|
||||
+ // Paper end - remove allocation of Vec3D here
|
||||
boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L;
|
||||
|
||||
if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround()) {
|
Loading…
Add table
Add a link
Reference in a new issue