patches and remap fixes
This commit is contained in:
parent
00be0b7b30
commit
c4ef2add48
9 changed files with 139 additions and 105 deletions
|
@ -1,50 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
||||
Date: Mon, 10 May 2021 16:59:05 +0100
|
||||
Subject: [PATCH] Add PufferFishStateChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
|
||||
index 76fc6bdc67a1bd4d0f9f654b9b912f6bc59ac1da..f576e602f2fce87cdebc194b474dced64952178b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
|
||||
@@ -95,25 +95,39 @@ public class Pufferfish extends AbstractFish {
|
||||
public void tick() {
|
||||
if (!this.level.isClientSide && this.isAlive() && this.isEffectiveAi()) {
|
||||
if (this.inflateCounter > 0) {
|
||||
+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
|
||||
if (this.getPuffState() == 0) {
|
||||
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent
|
||||
this.playSound(SoundEvents.PUFFER_FISH_BLOW_UP, this.getSoundVolume(), this.getVoicePitch());
|
||||
this.setPuffState(1);
|
||||
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
|
||||
} else if (this.inflateCounter > 40 && this.getPuffState() == 1) {
|
||||
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 2).callEvent()) { // Paper - Add PufferFishStateChangeEvent
|
||||
this.playSound(SoundEvents.PUFFER_FISH_BLOW_UP, this.getSoundVolume(), this.getVoicePitch());
|
||||
this.setPuffState(2);
|
||||
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
|
||||
}
|
||||
|
||||
+ if (increase) { // Paper - Add PufferFishStateChangeEvent
|
||||
++this.inflateCounter;
|
||||
+ } // Paper - Add PufferFishStateChangeEvent
|
||||
} else if (this.getPuffState() != 0) {
|
||||
+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
|
||||
if (this.deflateTimer > 60 && this.getPuffState() == 2) {
|
||||
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent
|
||||
this.playSound(SoundEvents.PUFFER_FISH_BLOW_OUT, this.getSoundVolume(), this.getVoicePitch());
|
||||
this.setPuffState(1);
|
||||
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
|
||||
} else if (this.deflateTimer > 100 && this.getPuffState() == 1) {
|
||||
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 0).callEvent()) { // Paper - Add PufferFishStateChangeEvent
|
||||
this.playSound(SoundEvents.PUFFER_FISH_BLOW_OUT, this.getSoundVolume(), this.getVoicePitch());
|
||||
this.setPuffState(0);
|
||||
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
|
||||
}
|
||||
|
||||
+ if (increase) { // Paper - Add PufferFishStateChangeEvent
|
||||
++this.deflateTimer;
|
||||
+ } // Paper - Add PufferFishStateChangeEvent
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 20 May 2021 22:16:37 -0700
|
||||
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
|
||||
--- 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;
|
||||
|
||||
public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
|
||||
+ private static ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper
|
||||
+
|
||||
public final Fluid content;
|
||||
|
||||
public BucketItem(Fluid fluid, Item.Properties settings) {
|
||||
@@ -122,6 +124,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
}
|
||||
|
||||
public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
|
||||
+ // Paper start
|
||||
+ if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) {
|
||||
+ ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent;
|
||||
+ itemLeftInHandAfterPlayerBucketEmptyEvent = null;
|
||||
+ return itemInHand;
|
||||
+ }
|
||||
+ // Paper end
|
||||
return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
|
||||
}
|
||||
|
||||
@@ -154,6 +163,9 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
||||
return false;
|
||||
}
|
||||
+ // Paper start
|
||||
+ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack());
|
||||
+ // Paper end
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (!flag1) {
|
|
@ -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);
|
|
@ -1,40 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: GioSDA <gsdambrosio@gmail.com>
|
||||
Date: Wed, 10 Mar 2021 10:06:45 -0800
|
||||
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
|
||||
--- 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 {
|
||||
private void mapItemFrameCursorLimit() {
|
||||
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
|
||||
}
|
||||
+
|
||||
+ public boolean fixItemsMergingThroughWalls;
|
||||
+ private void fixItemsMergingThroughWalls() {
|
||||
+ 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
|
||||
--- 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 {
|
||||
ItemEntity entityitem = (ItemEntity) iterator.next();
|
||||
|
||||
if (entityitem.isMergable()) {
|
||||
+ // Paper Start - Fix items merging through walls
|
||||
+ if (this.level.paperConfig.fixItemsMergingThroughWalls) {
|
||||
+ net.minecraft.world.level.ClipContext rayTrace = new net.minecraft.world.level.ClipContext(this.position(), entityitem.position(),
|
||||
+ net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, this);
|
||||
+ net.minecraft.world.phys.BlockHitResult rayTraceResult = level.clip(rayTrace);
|
||||
+ if (rayTraceResult.getType() == net.minecraft.world.phys.HitResult.Type.BLOCK) continue;
|
||||
+ }
|
||||
+ // Paper End
|
||||
this.tryToMerge(entityitem);
|
||||
if (this.isRemoved()) {
|
||||
break;
|
|
@ -1,32 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Wed, 26 May 2021 17:09:07 -0400
|
||||
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
|
||||
--- 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);
|
||||
- }).forEach(BellBlockEntity::glow);
|
||||
+ }).forEach(entity -> glow(entity, pos)); // Paper - pass BlockPos
|
||||
}
|
||||
|
||||
private static void showBellParticles(Level world, BlockPos pos, List<LivingEntity> hearingEntities) {
|
||||
@@ -170,7 +170,11 @@ public class BellBlockEntity extends BlockEntity {
|
||||
return entity.isAlive() && !entity.isRemoved() && pos.closerThan(entity.position(), 48.0D) && entity.getType().is(EntityTypeTags.RAIDERS);
|
||||
}
|
||||
|
||||
- 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) {
|
||||
+ 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));
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue