a bunch more patches

This commit is contained in:
Jake 2021-11-23 21:44:21 -08:00 committed by MiniDigger | Martin
parent 2b29fe37a2
commit 0f23d73d1a
19 changed files with 96 additions and 95 deletions

View file

@ -5,9 +5,3 @@ tiny 2 0 spigot mojang+yarn
# Originally DistanceManager, which also implements DistanceManager, so clashes since the implemented class
# is imported and not fully qualified. Easiest fix is to just change the name
c net/minecraft/server/level/PlayerChunkMap$a net/minecraft/server/level/ChunkMap$ChunkDistanceManager
# We add the getLevel method back to Hopper since mojang removed it - we need the method for hooper optimization
# We add the method with this name to match the mojmap method of the same name in BlockEntity
# Since we add the method we need to add the mapping for it so reobf works as expected
#c net/minecraft/world/level/block/entity/IHopper net/minecraft/world/level/block/entity/Hopper
# m ()Lnet/minecraft/world/level/World; getWorld getLevel

View file

@ -24,3 +24,9 @@ tiny 2 0 mojang+yarn spigot
# Paper changes type
#c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials
# f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId bw
# We add the getLevel method back to Hopper since mojang removed it - we need the method for hopper optimization
# We add the method with this name to match the mojmap method of the same name in BlockEntity
# Since we add the method we need to add the mapping for it so reobf works as expected
c net/minecraft/world/level/block/entity/Hopper net/minecraft/world/level/block/entity/IHopper
m ()Lnet/minecraft/world/level/Level; getLevel k

View file

@ -3,6 +3,8 @@ From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 02:17:54 -0600
Subject: [PATCH] Generator Settings
#NOTE: Bedrock generation has moved a bunch, needs to be redone or dropped
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d9437b3ef3919bff5d2eebd8b5e016ddb7a0e793..d3da5175ce1075511229ea52f1237898bcae9a11 100644

View file

@ -3,6 +3,8 @@ From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 24 Sep 2019 16:03:00 -0700
Subject: [PATCH] Fix MC-161754
#NOTE: the mojira issue is marked as fixed in 20w12a
Fixes https://github.com/PaperMC/Paper/issues/2580
We can use an entity valid check since this method is invoked for

View file

@ -3,6 +3,8 @@ From: Paul Sauve <paul@burngames.net>
Date: Sun, 14 Jul 2019 21:05:03 -0500
Subject: [PATCH] Do less work if we have a custom Bukkit generator
#NOTE: Doesn't look like this is needed anymore. See MinecraftServer#setInitialSpawn
If the Bukkit generator already has a spawn, use it immediately instead
of spending time generating one that we won't use

View file

@ -3,6 +3,8 @@ From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Wed, 9 Oct 2019 21:51:43 -0500
Subject: [PATCH] Fix stuck in sneak when changing worlds (MC-10657)
#NOTE: Fixed in MC 1.14.2
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a055419b381a1e244d9d88208f0fcf2e5ba6b379..3e3582742792858c2b8328676faed68ddb6da674 100644

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Show blockstate location if we failed to read it
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index aaddbaecc25af87c863fe51098eb322fd5702104..d2ff7e373476aaab0d4d08977c9d9f274fff67bf 100644
index b98d442a8c749c59aff43189c3904ff4fb4cb353..43fca7b454b50caa9acdb240dcd1b21161e078d1 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -18,6 +18,7 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft

View file

@ -17,10 +17,10 @@ This should fully solve all of the issues around it so that only natural
influences natural spawns.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 70fc301b25fb1e2271255b3d3b6facaf0cb87bad..6295242e1926ae3f03c304f3372dcca16a84bf3f 100644
index 522c2a86c916f3558a8d5b34e456f8b5fb7d9d3b..1d81b47a0d9e16902f01a563408780a58e45dffe 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -442,4 +442,15 @@ public class PaperWorldConfig {
@@ -437,4 +437,15 @@ public class PaperWorldConfig {
private void preventMovingIntoUnloadedChunks() {
preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
}
@ -37,7 +37,7 @@ index 70fc301b25fb1e2271255b3d3b6facaf0cb87bad..6295242e1926ae3f03c304f3372dcca1
}
+
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 7891ee828b030814034e6e1def7938a31fbe4fdd..461b64232c0f04e17e168f1e7f7857ee555200fc 100644
index 86cdb9ea888b85424285fc26534dc7a7ad3610ac..63deac19b4006c5d64596cd30e6641caaabc7c1d 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -85,6 +85,13 @@ public final class NaturalSpawner {
@ -52,5 +52,5 @@ index 7891ee828b030814034e6e1def7938a31fbe4fdd..461b64232c0f04e17e168f1e7f7857ee
+ }
+ // Paper end
BlockPos blockposition = entity.blockPosition();
long j = ChunkPos.asLong(SectionPos.blockToSectionCoord(blockposition.getX()), SectionPos.blockToSectionCoord(blockposition.getZ()));
chunkSource.query(ChunkPos.asLong(blockposition), (chunk) -> {

View file

@ -4,7 +4,7 @@ Date: Tue, 23 Jul 2019 20:29:20 -0500
Subject: [PATCH] Configurable projectile relative velocity
This patch adds an option "disable relative projectile velocity", which, when
nabled, will cause projectiles to ignore the shooter's current velocity,
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
@ -25,10 +25,10 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6295242e1926ae3f03c304f3372dcca16a84bf3f..d9437b3ef3919bff5d2eebd8b5e016ddb7a0e793 100644
index 1d81b47a0d9e16902f01a563408780a58e45dffe..30ac8abfd5473de3ca262d988d437b459d6a5690 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -452,5 +452,10 @@ public class PaperWorldConfig {
@@ -447,5 +447,10 @@ public class PaperWorldConfig {
log("Using improved mob spawn limits (Only Natural Spawns impact spawn limits for more natural spawns)");
}
}
@ -40,15 +40,15 @@ index 6295242e1926ae3f03c304f3372dcca16a84bf3f..d9437b3ef3919bff5d2eebd8b5e016dd
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 458a70f6e76eba707b890c78cbfd4f967eaf8a1b..6339203bda5e569d5df241dd589eb36e7233704b 100644
index 47d27f95bdd4d556f1750e7ad8493248ba63888a..15744949537430d8d8ae71ea72481126c9aff7bd 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -161,7 +161,7 @@ public abstract class Projectile extends Entity {
this.shoot((double) f5, (double) f6, (double) f7, modifierZ, modifierXYZ);
Vec3 vec3d = user.getDeltaMovement();
this.shoot((double) f5, (double) f6, (double) f7, speed, divergence);
Vec3 vec3d = shooter.getDeltaMovement();
- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, user.isOnGround() ? 0.0D : vec3d.y, vec3d.z));
+ if (!user.level.paperConfig.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, user.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z));
+ if (!shooter.level.paperConfig.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
}
// CraftBukkit start - call projectile hit event

View file

@ -5,7 +5,7 @@ Subject: [PATCH] offset item frame ticking
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index acea1c03afb5b3e522edb072fd1c3f9b5c3edccc..ca9decf85dd1af0baf0d34a48aa67cbb9f4eb586 100644
index 0ac4bd8f16fe21e519079e0f1383f4d3c482555f..2805ebfe4ffe769bcde778a1225b3101c91538d8 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -35,7 +35,7 @@ public abstract class HangingEntity extends Entity {

View file

@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it
was expired at that point, then it would be null.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7dd874c6aa1268665d4a64dfc41013c304991273..993f31b9106b5e20c62bfd405daa9fe55046840f 100644
index 2278153bd4113933a106f60f76a1d342684c272e..494b18a3dfa05b5e6ecbb9b99abf06bfe6e1d166 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -607,8 +607,10 @@ public abstract class PlayerList {
@@ -606,8 +606,10 @@ public abstract class PlayerList {
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.getRawAddress()).getAddress());

View file

@ -5,41 +5,34 @@ Subject: [PATCH] Prevent consuming the wrong itemstack
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 472b8db386dfb580734999900562d358e5ea146a..55ac5e8cad4c7eee3d8b165698200e9afcd44594 100644
index 00900427e88f8e9118df4fb2e0e98c26b9f1b7d4..077e5f4f787cdf4b8e7ba08dbc0c7bf04a6e5b93 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3554,15 +3554,18 @@ public abstract class LivingEntity extends Entity {
this.entityData.set(LivingEntity.DATA_LIVING_ENTITY_FLAGS, (byte) j);
@@ -3558,9 +3558,14 @@ public abstract class LivingEntity extends Entity {
}
- public void startUsingItem(InteractionHand hand) {
- ItemStack itemstack = this.getItemInHand(hand);
+ // Paper start -- OBFHELPER and forwarder to method with forceUpdate parameter
+ public void startUsingItem(InteractionHand hand) { this.updateActiveItem(hand, false); }
+ public void updateActiveItem(InteractionHand enumhand, boolean forceUpdate) {
+ // Paper end
+ ItemStack itemstack = this.getItemInHand(enumhand);
public void startUsingItem(InteractionHand hand) {
+ // Paper start - forwarder to method with forceUpdate parameter
+ this.startUsingItem(hand, false);
+ }
+ public void startUsingItem(InteractionHand hand, boolean forceUpdate) {
+ // Paper end
ItemStack itemstack = this.getItemInHand(hand);
- if (!itemstack.isEmpty() && !this.isUsingItem()) {
+ if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
this.useItem = itemstack;
this.useItemRemaining = itemstack.getUseDuration();
if (!this.level.isClientSide) {
this.setLivingEntityFlag(1, true);
- this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
+ this.setLivingEntityFlag(2, enumhand == InteractionHand.OFF_HAND);
}
}
@@ -3635,6 +3638,7 @@ public abstract class LivingEntity extends Entity {
@@ -3638,6 +3643,7 @@ public abstract class LivingEntity extends Entity {
this.releaseUsingItem();
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
+ this.updateActiveItem(this.getUsedItemHand(), true); // Paper
+ this.startUsingItem(this.getUsedItemHand(), true); // Paper
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
@@ -3669,8 +3673,8 @@ public abstract class LivingEntity extends Entity {
@@ -3672,8 +3678,8 @@ public abstract class LivingEntity extends Entity {
}
this.stopUsingItem();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Dont send unnecessary sign update
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ea19697d8e60a993979d61a4d0f89110fd2cc574..84dc3599cdccc29efdf15b987640f3243007639a 100644
index f4444fb23a75d0617438f6b25df7bd401ab65a26..26a15d0b49180651361f336da29a7acccca92483 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2843,6 +2843,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2856,6 +2856,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());

View file

@ -5,12 +5,12 @@ Subject: [PATCH] Add option to disable pillager patrols
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d3da5175ce1075511229ea52f1237898bcae9a11..a9ab8cbb739a72222dc7775f52ef2cfdc49fd29f 100644
index 30ac8abfd5473de3ca262d988d437b459d6a5690..16ae10870600cb2c7cd327436b13cfe7cc714a2a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -462,5 +462,10 @@ public class PaperWorldConfig {
private void generatorSettings() {
generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false);
@@ -452,5 +452,10 @@ public class PaperWorldConfig {
private void disableRelativeProjectileVelocity() {
disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false);
}
+
+ public boolean disablePillagerPatrols = false;
@ -20,10 +20,10 @@ index d3da5175ce1075511229ea52f1237898bcae9a11..a9ab8cbb739a72222dc7775f52ef2cfd
}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
index e0a376617f6b6232591942da0bc9d7b1ee58c2e7..744b58d59a5f34ed3bd6f2d4a0f876acfa6a7135 100644
index 96da518295362665270bcd5ff3031f1d9a152b1f..4fc90f8a1fa199a1af6c125ccadcb78c970671ec 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
@@ -26,6 +26,7 @@ public class PatrolSpawner implements CustomSpawner {
@@ -23,6 +23,7 @@ public class PatrolSpawner implements CustomSpawner {
@Override
public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) {

View file

@ -7,10 +7,10 @@ Fixes an AssertionError when setting the player's item in hand to null or a new
Fixes GH-2718
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 84dc3599cdccc29efdf15b987640f3243007639a..98a0034f4e19a244c22619236cd8ab76b05df1bb 100644
index 26a15d0b49180651361f336da29a7acccca92483..23f06b3a4c7471bd3081c5e9ee78707c26280bfd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1720,6 +1720,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1734,6 +1734,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
return;
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] MC-145656 Fix Follow Range Initial Target
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a9ab8cbb739a72222dc7775f52ef2cfdc49fd29f..72fc65fde0be760ef6a98d26ee7adf45c8a0242e 100644
index 16ae10870600cb2c7cd327436b13cfe7cc714a2a..2f0f74085a1196fe7a75c1be7d9263d05283165d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -467,5 +467,10 @@ public class PaperWorldConfig {
@@ -457,5 +457,10 @@ public class PaperWorldConfig {
private void pillagerSettings() {
disablePillagerPatrols = getBoolean("game-mechanics.disable-pillager-patrols", disablePillagerPatrols);
}
@ -20,11 +20,11 @@ index a9ab8cbb739a72222dc7775f52ef2cfdc49fd29f..72fc65fde0be760ef6a98d26ee7adf45
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
index 6cbd2fc4a7041f957966e5b09616e70aae63c0d4..b5bbcb9fa6de4c919e4d4fabbab483054d81574e 100644
index 76b7981b643eec2e19220c459fcf76fba97ac790..e69883f6f4631f7014be010b29c2cbb3a3d97827 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
@@ -32,6 +32,7 @@ public class NearestAttackableTargetGoal<T extends LivingEntity> extends TargetG
this.randomInterval = reciprocalChance;
@@ -33,6 +33,7 @@ public class NearestAttackableTargetGoal<T extends LivingEntity> extends TargetG
this.randomInterval = reducedTickDelay(reciprocalChance);
this.setFlags(EnumSet.of(Goal.Flag.TARGET));
this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate);
+ if (mob.level.paperConfig.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper
@ -32,10 +32,10 @@ index 6cbd2fc4a7041f957966e5b09616e70aae63c0d4..b5bbcb9fa6de4c919e4d4fabbab48305
@Override
diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
index e45434b844c98c322e1432c2382c1ccb8c3e57a7..3ee691d4caccbc1b3e0f52decb41d436ac0d08ec 100644
index 9f65f6cdbcc054bde03c42d7d3b16f65b93e5deb..a7575b5ef56af6f53448d391abb4956e130148ca 100644
--- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
+++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
@@ -75,7 +75,7 @@ public class TargetingConditions {
@@ -76,7 +76,7 @@ public class TargetingConditions {
if (this.range > 0.0D) {
double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D;
@ -44,7 +44,7 @@ index e45434b844c98c322e1432c2382c1ccb8c3e57a7..3ee691d4caccbc1b3e0f52decb41d436
double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ());
if (f > e * e) {
return false;
@@ -90,4 +90,18 @@ public class TargetingConditions {
@@ -94,4 +94,18 @@ public class TargetingConditions {
return true;
}
}

View file

@ -33,10 +33,10 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 72fc65fde0be760ef6a98d26ee7adf45c8a0242e..8108cbc492dc14e5dd5a183105e89eb0cfb378fe 100644
index 2f0f74085a1196fe7a75c1be7d9263d05283165d..2d2a3138083b2b382fdb69de423a31a8810e27ee 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -443,6 +443,45 @@ public class PaperWorldConfig {
@@ -438,6 +438,45 @@ public class PaperWorldConfig {
preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
}
@ -83,7 +83,7 @@ index 72fc65fde0be760ef6a98d26ee7adf45c8a0242e..8108cbc492dc14e5dd5a183105e89eb0
private void countAllMobsForSpawning() {
countAllMobsForSpawning = getBoolean("count-all-mobs-for-spawning", false);
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 41253d8adf85cf318fcb1cee36ac1763f440fca6..ba1514301a8b20fcc594ae5555b491e88a98e6dd 100644
index 18d442feb77f7763d8f6c411b0e5cb0aeca1f725..969401d1c4a506111ad212950bca42fdac59ad1f 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,6 +1,7 @@
@ -92,11 +92,11 @@ index 41253d8adf85cf318fcb1cee36ac1763f440fca6..ba1514301a8b20fcc594ae5555b491e8
import co.aikar.timings.Timing; // Paper
+import com.destroystokyo.paper.PaperWorldConfig; // Paper
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Iterables;
import com.google.common.collect.ComparisonChain; // Paper
@@ -24,13 +25,17 @@ import java.io.File;
import java.io.IOException;
@@ -28,13 +29,17 @@ import java.io.IOException;
import java.io.Writer;
import java.nio.file.Path;
import java.util.BitSet;
+import java.util.HashMap; // Paper
+import java.util.Collection;
@ -112,15 +112,15 @@ index 41253d8adf85cf318fcb1cee36ac1763f440fca6..ba1514301a8b20fcc594ae5555b491e8
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
@@ -836,6 +841,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -840,6 +845,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.discard();
needsRemoval = true;
}
+ checkDupeUUID(worldserver, entity); // Paper
+ checkDupeUUID(world, entity); // Paper
return !needsRemoval;
}));
// CraftBukkit end
@@ -885,6 +891,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -890,6 +896,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
@ -138,7 +138,7 @@ index 41253d8adf85cf318fcb1cee36ac1763f440fca6..ba1514301a8b20fcc594ae5555b491e8
+ && Objects.equals(other.getEncodeId(), entity.getEncodeId())
+ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < level.paperConfig.duplicateUUIDDeleteRange
+ ) {
+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ entity.discard();
+ return;
+ }
@ -146,16 +146,16 @@ index 41253d8adf85cf318fcb1cee36ac1763f440fca6..ba1514301a8b20fcc594ae5555b491e8
+ switch (mode) {
+ case SAFE_REGEN: {
+ entity.setUUID(UUID.randomUUID());
+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ break;
+ }
+ case DELETE: {
+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ entity.discard();
+ break;
+ }
+ default:
+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ break;
+ }
+ }
@ -165,7 +165,7 @@ index 41253d8adf85cf318fcb1cee36ac1763f440fca6..ba1514301a8b20fcc594ae5555b491e8
ChunkPos chunkcoordintpair = holder.getPos();
CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkRangeFuture(chunkcoordintpair, 1, (i) -> {
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 23640964305b7f2ffd54ed3044712308f03c3d42..f698723f8f7feecc749df10a316118184391f31a 100644
index 0177a0323af651adace928b22f9461326ec07bc0..e19f5b2c8f485d596a64d5d96e75fa1f4a8255b5 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -78,7 +78,22 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A

View file

@ -13,10 +13,10 @@ Subject: [PATCH] Optimize Hoppers
* Remove Streams from Item Suck In and restore restore 1.12 AABB checks which is simpler and no voxel allocations (was doing TWO Item Suck ins)
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8108cbc492dc14e5dd5a183105e89eb0cfb378fe..e8746656ac12d3498e78cb603c14d4c31abbc023 100644
index 2d2a3138083b2b382fdb69de423a31a8810e27ee..1dba00531e909214119219e928b2875676c00e75 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -511,5 +511,17 @@ public class PaperWorldConfig {
@@ -501,5 +501,17 @@ public class PaperWorldConfig {
private void entitiesTargetWithFollowRange() {
entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange);
}
@ -35,10 +35,10 @@ index 8108cbc492dc14e5dd5a183105e89eb0cfb378fe..e8746656ac12d3498e78cb603c14d4c3
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fa9d70300ab1ecb83b8a21e5a707dd7ffd7ad74b..bf08c45525cd898ad12d70bec5de3762063af2e0 100644
index 977dc521cff5b448665e00b953f4a02ecf04ee75..4661d571cd4047c6b7d76de7ba0cb34ada348d63 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1443,6 +1443,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1420,6 +1420,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
@ -65,10 +65,10 @@ index 449d2e7b18608ca36282f1a29e69457fc525307e..c738cb0433ea4a86d82372bf66e29c01
public double getLevelX() {
return this.getX();
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index c5683f76f6f11246dc5bbaa13dfc253e5e286590..5ee807be448c6bfb98ac2a16bda829926b9cf994 100644
index 9126aa0c988824ce89ffa724ae9895105184d0f1..3d6d48ce4b762091aeee3b4fdd28bd121aaf291b 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -603,11 +603,12 @@ public final class ItemStack {
@@ -604,11 +604,12 @@ public final class ItemStack {
return this.getItem().interactLivingEntity(this, user, entity, hand);
}
@ -85,10 +85,10 @@ index c5683f76f6f11246dc5bbaa13dfc253e5e286590..5ee807be448c6bfb98ac2a16bda82992
itemstack.setPopTime(this.getPopTime());
if (this.tag != null) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 1d1764766d2b4a0b7bf4078ce428bb1474f709df..38c4dac82793930777eaf0189c5534234a9162ed 100644
index 29167adb4eeb83c108445c37e01dc4035b4c4be7..066cfa2306e12a051fdeb7528e40b87e3089120c 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -63,6 +63,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
@@ -70,6 +70,7 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject {
getMinecraftKey(); // Try to load if it doesn't exists.
return tileEntityKeyString;
}
@ -96,7 +96,7 @@ index 1d1764766d2b4a0b7bf4078ce428bb1474f709df..38c4dac82793930777eaf0189c553423
// Paper end
@Nullable
@@ -145,6 +146,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
@@ -182,6 +183,7 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject {
public void setChanged() {
if (this.level != null) {
@ -120,7 +120,7 @@ index a05acf709735b40ca86f978508c63a86065fd405..71dd26ca6626631b94d53818cd06b93f
double getLevelY();
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b77f4ca92 100644
index f3bc3133b68cabda359e99b74323b94f82bc42e9..b63fcebac4d51f0d01914c76712f896e6d117f90 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -3,7 +3,6 @@ package net.minecraft.world.level.block.entity;
@ -139,7 +139,7 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.HumanEntity;
@@ -192,6 +190,159 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -191,6 +189,159 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
return false;
}
@ -297,9 +297,9 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
+ }
+ // Paper end
private static boolean a(Level world, BlockPos blockposition, BlockState iblockdata, Container iinventory, HopperBlockEntity hopper) { // CraftBukkit
private static boolean ejectItems(Level world, BlockPos blockposition, BlockState iblockdata, Container iinventory, HopperBlockEntity hopper) { // CraftBukkit
Container iinventory1 = HopperBlockEntity.getAttachedContainer(world, blockposition, iblockdata);
@@ -204,6 +355,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -203,6 +354,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
if (HopperBlockEntity.isFullContainer(iinventory1, enumdirection)) {
return false;
} else {
@ -307,7 +307,7 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
for (int i = 0; i < iinventory.getContainerSize(); ++i) {
if (!iinventory.getItem(i).isEmpty()) {
ItemStack itemstack = iinventory.getItem(i).copy();
@@ -241,7 +393,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -240,7 +392,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
}
}
@ -316,7 +316,7 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
}
}
}
@@ -251,27 +403,68 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -250,27 +402,68 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
}
private static boolean isFullContainer(Container inventory, Direction direction) {
@ -395,7 +395,7 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
});
} else {
Iterator iterator = HopperBlockEntity.getItemsAtAndAbove(world, hopper).iterator();
@@ -290,10 +483,12 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -289,10 +482,12 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
}
}
@ -407,9 +407,9 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
+ if (!itemstack.isEmpty() && HopperBlockEntity.canTakeItemFromContainer(iinventory, itemstack, i, enumdirection)) { // If this logic changes, update above. this is left inused incase reflective plugins
+ return hopperPull(ihopper, iinventory, itemstack, i); /* // Paper - disable rest
ItemStack itemstack1 = itemstack.copy();
// ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.splitStack(i, 1), (EnumDirection) null);
// ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null);
// CraftBukkit start - Call event on collection of items from inventories into the hopper
@@ -330,7 +525,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -329,7 +524,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
}
itemstack1.shrink(origCount - itemstack2.getCount()); // Spigot
@ -418,7 +418,7 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
}
return false;
@@ -339,7 +534,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -338,7 +533,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
public static boolean addItem(Container inventory, ItemEntity itemEntity) {
boolean flag = false;
// CraftBukkit start
@ -427,7 +427,7 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
itemEntity.level.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return false;
@@ -398,7 +593,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -397,7 +592,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
stack = stack.split(to.getMaxStackSize());
}
// Spigot end
@ -437,7 +437,7 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
stack = ItemStack.EMPTY;
flag = true;
} else if (HopperBlockEntity.canMergeItems(itemstack1, stack)) {
@@ -449,18 +646,23 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -448,18 +645,23 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
}
public static List<ItemEntity> getItemsAtAndAbove(Level world, Hopper hopper) {
@ -466,7 +466,7 @@ index 3e2832087e8c2c0e2c45f18b0da49299611e76ad..89b9982e65acfcaa84e10d37e619f18b
Object object = null;
BlockPos blockposition = new BlockPos(x, y, z);
if ( !world.hasChunkAt( blockposition ) ) return null; // Spigot
@@ -480,7 +682,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -479,7 +681,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
}
}