Skip to content

Commit f226be2

Browse files
committed
MC-302446: Fix respawn_radius
1 parent ae07809 commit f226be2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

shreddedpaper-server/minecraft-patches/sources/net/minecraft/server/level/PlayerSpawnFinder.java.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@
99
import net.minecraft.CrashReport;
1010
import net.minecraft.CrashReportCategory;
1111
import net.minecraft.ReportedException;
12+
@@ -70,9 +_,9 @@
13+
private void scheduleNext() {
14+
int i = this.nextCandidateIndex++;
15+
if (i < this.candidateCount) {
16+
- int i1 = (this.offset + this.coprime * i) % this.candidateCount;
17+
- int i2 = i1 % (this.radius * 2 + 1);
18+
- int i3 = i1 / (this.radius * 2 + 1);
19+
+ long i1 = ((this.offset + this.coprime * i) % this.candidateCount) * ((this.radius * 2L + 1L) * (this.radius * 2L + 1L) / this.candidateCount); // ShreddedPaper - fix respawn_radius (MC-302446)
20+
+ int i2 = (int) (i1 % (this.radius * 2L + 1L)); // ShreddedPaper - fix respawn_radius (MC-302446)
21+
+ int i3 = (int) (i1 / (this.radius * 2L + 1L)); // ShreddedPaper - fix respawn_radius (MC-302446)
22+
int i4 = this.spawnSuggestion.getX() + i2 - this.radius;
23+
int i5 = this.spawnSuggestion.getZ() + i3 - this.radius;
24+
this.scheduleCandidate(
1225
@@ -146,7 +_,7 @@
1326
crashReportCategory.setDetail("Progress", () -> index + " out of " + this.candidateCount);
1427
this.finishedFuture.completeExceptionally(new ReportedException(crashReport));

0 commit comments

Comments
 (0)