forked from PaperMC/Paper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
178 additions
and
247 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
99 changes: 0 additions & 99 deletions
99
patches/removed/1.17/0288-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
117 changes: 0 additions & 117 deletions
117
patches/removed/1.17/0362-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Phoenix616 <[email protected]> | ||
Date: Tue, 18 Sep 2018 23:53:23 +0100 | ||
Subject: [PATCH] PreSpawnerSpawnEvent | ||
|
||
This adds a separate event before an entity is spawned by a spawner | ||
which contains the location of the spawner too similarly to how the | ||
SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for | ||
spawners. | ||
|
||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java | ||
index c741f8e4a4b67d1bfed2d1bac36856c5688bb161..9228c0bc797fb95c8ac949bdc568eadafee84a80 100644 | ||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java | ||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java | ||
@@ -138,11 +138,11 @@ public abstract class BaseSpawner { | ||
|
||
org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); | ||
if (type != null) { | ||
- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; | ||
- event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( | ||
+ com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event; | ||
+ event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent( | ||
net.minecraft.server.MCUtil.toLocation(world, d0, d1, d2), | ||
type, | ||
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER | ||
+ net.minecraft.server.MCUtil.toLocation(world, pos) | ||
); | ||
if (!event.callEvent()) { | ||
flag = true; |
92 changes: 92 additions & 0 deletions
92
patches/server/0684-Synchronize-PalettedContainer-instead-of-ReentrantLoc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Aikar <[email protected]> | ||
Date: Fri, 29 May 2020 20:29:02 -0400 | ||
Subject: [PATCH] Synchronize PalettedContainer instead of ReentrantLock | ||
|
||
Mojang has flaws in their logic about chunks being concurrently | ||
wrote to. So we constantly see crashes around multiple threads writing. | ||
|
||
Additionally, java has optimized synchronization so well that its | ||
in many times faster than trying to manage read wrote locks for low | ||
contention situations. | ||
|
||
And this is extremely a low contention situation. | ||
|
||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java | ||
index 5ac948b5b82f3144cdf402af440251cb8c7369d7..d8b7a7d9aa3ef47aa4e222c6ca85e83ce21f2444 100644 | ||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java | ||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java | ||
@@ -36,16 +36,18 @@ public class PalettedContainer<T> implements PaletteResize<T> { | ||
private final DebugBuffer<Pair<Thread, StackTraceElement[]>> traces = null; | ||
|
||
public void acquire() { | ||
+ /* // Paper start - disable this - use proper synchronization | ||
if (this.traces != null) { | ||
Thread thread = Thread.currentThread(); | ||
this.traces.push(Pair.of(thread, thread.getStackTrace())); | ||
} | ||
|
||
ThreadingDetector.checkAndLock(this.lock, this.traces, "PalettedContainer"); | ||
+ */ // Paper end | ||
} | ||
|
||
public void release() { | ||
- this.lock.release(); | ||
+ //this.lock.release(); // Paper - disable this | ||
} | ||
|
||
public PalettedContainer(Palette<T> fallbackPalette, IdMapper<T> idList, Function<CompoundTag, T> elementDeserializer, Function<T, CompoundTag> elementSerializer, T defaultElement) { | ||
@@ -96,7 +98,7 @@ public class PalettedContainer<T> implements PaletteResize<T> { | ||
return this.palette.idFor(objectAdded); | ||
} | ||
|
||
- public T getAndSet(int x, int y, int z, T value) { | ||
+ public synchronized T getAndSet(int x, int y, int z, T value) { // Paper - synchronize | ||
Object var6; | ||
try { | ||
this.acquire(); | ||
@@ -120,7 +122,7 @@ public class PalettedContainer<T> implements PaletteResize<T> { | ||
return (T)(object == null ? this.defaultValue : object); | ||
} | ||
|
||
- public void set(int i, int j, int k, T object) { | ||
+ public synchronized void set(int i, int j, int k, T object) { // Paper - synchronize | ||
try { | ||
this.acquire(); | ||
this.set(getIndex(i, j, k), object); | ||
@@ -144,7 +146,7 @@ public class PalettedContainer<T> implements PaletteResize<T> { | ||
return (T)(object == null ? this.defaultValue : object); | ||
} | ||
|
||
- public void read(FriendlyByteBuf buf) { | ||
+ public synchronized void read(FriendlyByteBuf buf) { // Paper - synchronize | ||
try { | ||
this.acquire(); | ||
int i = buf.readByte(); | ||
@@ -161,7 +163,7 @@ public class PalettedContainer<T> implements PaletteResize<T> { | ||
} | ||
|
||
public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER | ||
- public void write(FriendlyByteBuf buf) { | ||
+ public synchronized void write(FriendlyByteBuf buf) { // Paper - synchronize | ||
try { | ||
this.acquire(); | ||
buf.writeByte(this.bits); | ||
@@ -173,7 +175,7 @@ public class PalettedContainer<T> implements PaletteResize<T> { | ||
|
||
} | ||
|
||
- public void read(ListTag paletteNbt, long[] data) { | ||
+ public synchronized void read(ListTag paletteNbt, long[] data) { // Paper - synchronize | ||
try { | ||
this.acquire(); | ||
int i = Math.max(4, Mth.ceillog2(paletteNbt.size())); | ||
@@ -206,7 +208,7 @@ public class PalettedContainer<T> implements PaletteResize<T> { | ||
|
||
} | ||
|
||
- public void write(CompoundTag nbt, String paletteKey, String dataKey) { | ||
+ public synchronized void write(CompoundTag nbt, String paletteKey, String dataKey) { // Paper - synchronize | ||
try { | ||
this.acquire(); | ||
HashMapPalette<T> hashMapPalette = new HashMapPalette<>(this.registry, this.bits, this.dummyPaletteResize, this.reader, this.writer); |
Oops, something went wrong.