patches and remap fixes
This commit is contained in:
parent
00be0b7b30
commit
c4ef2add48
|
@ -305,3 +305,39 @@ index 0f7950458dc2dfac51ed0d56f1790395f0b03bc2..fa4544541b9c5f163b633596e73a5197
|
|||
public static class BiomeBuilder {
|
||||
@Nullable
|
||||
private Biome.Precipitation precipitation;
|
||||
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 3f9929ac29f23068d233f164fbe6a562aba5a1b5..d030baca9dd3c34d14653094c139d853c67ac332 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -275,10 +275,6 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
}
|
||||
|
||||
static record Configuration<T>(Palette.Factory factory, int bits) {
|
||||
- Configuration(Palette.Factory factory, int i) {
|
||||
- this.factory = factory;
|
||||
- this.bits = i;
|
||||
- }
|
||||
|
||||
public PalettedContainer.Data<T> createData(IdMap<T> idList, PaletteResize<T> listener, int size) {
|
||||
BitStorage bitStorage = (BitStorage)(this.bits == 0 ? new ZeroBitStorage(size) : new SimpleBitStorage(this.bits, size));
|
||||
@@ -293,9 +289,6 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
}
|
||||
|
||||
static record Data<T>(PalettedContainer.Configuration<T> configuration, BitStorage storage, Palette<T> palette) {
|
||||
- final BitStorage storage;
|
||||
- final Palette<T> palette;
|
||||
-
|
||||
public void copyFrom(Palette<T> palette, BitStorage storage) {
|
||||
for(int i = 0; i < storage.getSize(); ++i) {
|
||||
T object = palette.valueFor(storage.get(i));
|
||||
@@ -316,10 +309,6 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
}
|
||||
|
||||
static record DiscData<T>(List<T> paletteEntries, Optional<LongStream> storage) {
|
||||
- DiscData(List<T> list, Optional<LongStream> optional) {
|
||||
- this.paletteEntries = list;
|
||||
- this.storage = optional;
|
||||
- }
|
||||
}
|
||||
|
||||
public abstract static class Strategy {
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Fix PlayerBucketEmptyEvent result itemstack
|
|||
Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
index 650b59b69eb12112bc71e5ff164767e3118e1c2a..69c992ef0c526adf35907de7726832605187beb6 100644
|
||||
index 5406acd65d4e1146f3bd7340ff9a1954a5c39ddb..b5a5c56fbb66c17dd2e2d1f4d69d2b1826cd4951 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
@@ -41,6 +41,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||
@@ -39,6 +39,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||
|
||||
public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
|
||||
|
@ -18,7 +18,7 @@ index 650b59b69eb12112bc71e5ff164767e3118e1c2a..69c992ef0c526adf35907de772683260
|
|||
public final Fluid content;
|
||||
|
||||
public BucketItem(Fluid fluid, Item.Properties settings) {
|
||||
@@ -122,6 +124,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
@@ -120,6 +122,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
}
|
||||
|
||||
public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
|
||||
|
@ -32,7 +32,7 @@ index 650b59b69eb12112bc71e5ff164767e3118e1c2a..69c992ef0c526adf35907de772683260
|
|||
return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
|
||||
}
|
||||
|
||||
@@ -154,6 +163,9 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
@@ -152,6 +161,9 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
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 d030baca9dd3c34d14653094c139d853c67ac332..bd003e980ac0fe8c4e4b5df5b4002ae3ada39862 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -35,15 +35,15 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer");
|
||||
|
||||
public void acquire() {
|
||||
- this.threadingDetector.checkAndLock();
|
||||
+ // this.threadingDetector.checkAndLock(); // Paper - disable this - use proper synchronization
|
||||
}
|
||||
|
||||
public void release() {
|
||||
- this.threadingDetector.checkAndUnlock();
|
||||
+ // this.threadingDetector.checkAndUnlock(); // Paper - disable this
|
||||
}
|
||||
|
||||
public static <T> Codec<PalettedContainer<T>> codec(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy provider, T object) {
|
||||
- return RecordCodecBuilder.create((instance) -> {
|
||||
+ return RecordCodecBuilder.<DiscData<T>>create((instance) -> { // Paper - decompile fixes
|
||||
return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(object)).listOf().fieldOf("palette").forGetter(PalettedContainer.DiscData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainer.DiscData::storage)).apply(instance, PalettedContainer.DiscData::new);
|
||||
}).comapFlatMap((serialized) -> {
|
||||
return read(idList, provider, serialized);
|
||||
@@ -85,7 +85,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
return data2.palette.idFor(object);
|
||||
}
|
||||
|
||||
- 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
|
||||
this.acquire();
|
||||
|
||||
Object var5;
|
||||
@@ -108,7 +108,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
return this.data.palette.valueFor(j);
|
||||
}
|
||||
|
||||
- public void set(int x, int y, int z, T value) {
|
||||
+ public synchronized void set(int x, int y, int z, T value) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
try {
|
||||
@@ -142,7 +142,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
});
|
||||
}
|
||||
|
||||
- public void read(FriendlyByteBuf buf) {
|
||||
+ public synchronized void read(FriendlyByteBuf buf) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
try {
|
||||
@@ -157,7 +157,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
|
||||
}
|
||||
|
||||
- public void write(FriendlyByteBuf buf) {
|
||||
+ public synchronized void write(FriendlyByteBuf buf) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
try {
|
||||
@@ -168,7 +168,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
|
||||
}
|
||||
|
||||
- private static <T> DataResult<PalettedContainer<T>> read(IdMap<T> idList, PalettedContainer.Strategy provider, PalettedContainer.DiscData<T> serialized) {
|
||||
+ private static synchronized <T> DataResult<PalettedContainer<T>> read(IdMap<T> idList, PalettedContainer.Strategy provider, PalettedContainer.DiscData<T> serialized) { // Paper - synchronize
|
||||
List<T> list = serialized.paletteEntries();
|
||||
int i = provider.size();
|
||||
int j = provider.calculateBitsForSerialization(idList, list.size());
|
||||
@@ -207,7 +207,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
return DataResult.success(new PalettedContainer<>(idList, provider, configuration, bitStorage, list));
|
||||
}
|
||||
|
||||
- private PalettedContainer.DiscData<T> write(IdMap<T> idList, PalettedContainer.Strategy provider) {
|
||||
+ private synchronized PalettedContainer.DiscData<T> write(IdMap<T> idList, PalettedContainer.Strategy provider) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
PalettedContainer.DiscData var12;
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add option to fix items merging through walls
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 88e6919e7c850727100a5739ed3ac332bc004b40..d8ed734450a14ffeed6d7a42eed238645b0cb380 100644
|
||||
index cc04fe5b0275ef5466fad2ca84f2273d274baadd..06878b0a9b57e3024179edea70e763a7893fbb95 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -863,5 +863,10 @@ public class PaperWorldConfig {
|
||||
@@ -772,4 +772,9 @@ public class PaperWorldConfig {
|
||||
private void mapItemFrameCursorLimit() {
|
||||
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
|
||||
}
|
||||
|
@ -18,12 +18,11 @@ index 88e6919e7c850727100a5739ed3ac332bc004b40..d8ed734450a14ffeed6d7a42eed23864
|
|||
+ fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
|
||||
+ }
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index e0c13a112c95eed9867d4608e18dc797b0c9c9cf..158719d46c96bb733a00e08c8285f41a48406abf 100644
|
||||
index 5a6534904e977b5ffbd55d05c4b65f02b3995910..7897b3324bc8d5a33cd3cd144b9fae9ffdc9241e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -241,6 +241,14 @@ public class ItemEntity extends Entity {
|
||||
@@ -240,6 +240,14 @@ public class ItemEntity extends Entity {
|
||||
ItemEntity entityitem = (ItemEntity) iterator.next();
|
||||
|
||||
if (entityitem.isMergable()) {
|
|
@ -5,13 +5,13 @@ Subject: [PATCH] Add BellRevealRaiderEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
index a71bf0802d04217dd11086901b7148957d32ca89..b4a5da7e2baecc856c75283cc776398042d17108 100644
|
||||
index b06e911acb825883c93da73358fa81653e8a0d4a..41e139c750dd3aadb7692e362e2d83f43799c905 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
@@ -138,7 +138,7 @@ public class BellBlockEntity extends BlockEntity {
|
||||
private static void makeRaidersGlow(Level world, BlockPos pos, List<LivingEntity> hearingEntities) {
|
||||
hearingEntities.stream().filter((livingEntity) -> {
|
||||
return isRaiderWithinRange(pos, livingEntity);
|
||||
hearingEntities.stream().filter((entity) -> {
|
||||
return isRaiderWithinRange(pos, entity);
|
||||
- }).forEach(BellBlockEntity::glow);
|
||||
+ }).forEach(entity -> glow(entity, pos)); // Paper - pass BlockPos
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ index a71bf0802d04217dd11086901b7148957d32ca89..b4a5da7e2baecc856c75283cc7763980
|
|||
- private static void glow(LivingEntity entity) {
|
||||
+ // Paper start
|
||||
+ private static void glow(LivingEntity entity) { glow(entity, null); }
|
||||
+ private static void glow(LivingEntity entity, BlockPos pos) {
|
||||
+ private static void glow(LivingEntity entity, @javax.annotation.Nullable BlockPos pos) {
|
||||
+ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level.getWorld().getBlockAt(net.minecraft.server.MCUtil.toLocation(entity.level, pos)), entity.getBukkitEntity()).callEvent()) return;
|
||||
+ // Paper end
|
||||
entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60));
|
|
@ -1,92 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
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 ac51089aae57a5f1d2411367ff177e058702894c..554474d4b2e57d8a005b3c3b9b23f32a62243058 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -37,16 +37,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
|
||||
}
|
||||
|
||||
// Paper start - Anti-Xray - Add preset values
|
||||
@@ -129,7 +131,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();
|
||||
@@ -153,7 +155,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);
|
||||
@@ -177,7 +179,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();
|
||||
@@ -201,7 +203,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
|
||||
// Paper start - Anti-Xray - Add chunk packet info
|
||||
@Deprecated public void write(FriendlyByteBuf buf) { write(buf, null, 0); } // Notice for updates: Please make sure this method isn't used anywhere
|
||||
- public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY) {
|
||||
+ public synchronized void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY) { // Paper - synchronize
|
||||
// Paper end
|
||||
try {
|
||||
this.acquire();
|
||||
@@ -226,7 +228,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();
|
||||
// Paper - Anti-Xray - TODO: Should this.presetValues.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)?
|
||||
@@ -261,7 +263,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);
|
Loading…
Reference in New Issue