More more patches

This commit is contained in:
Nassim Jahnke 2022-06-07 21:55:39 +02:00
parent 2710efc693
commit 1669c6b097
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
59 changed files with 295 additions and 271 deletions

View file

@ -1,6 +1,5 @@
group=io.papermc.paper group=io.papermc.paper
version=1.19-R0.1-SNAPSHOT version=1.19-R0.1-SNAPSHOT
mcVersion=1.19 mcVersion=1.19
org.gradle.caching=true org.gradle.caching=true

View file

@ -5,12 +5,12 @@ Subject: [PATCH] Complete resource pack API
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b85e557972e37566c853e0b4f882719b4d8bb293..7fdc50a94f18f8a2417643fdd174b754d04999ab 100644 index 984209f32015d765367fd7693fb759de571b9ad0..9b057950417704669fdeb80efb2417904a010074 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1654,8 +1654,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1686,8 +1686,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
this.disconnect(new TranslatableComponent("multiplayer.requiredTexturePrompt.disconnect")); this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
} }
- this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()])); // CraftBukkit - this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()])); // CraftBukkit
- -
@ -23,10 +23,10 @@ index b85e557972e37566c853e0b4f882719b4d8bb293..7fdc50a94f18f8a2417643fdd174b754
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index de9dbbff4e0e3d14821d21a1506a6b2d4a8ce3ab..47c2f02a47804da12e380e6ceecac2fc147df1b5 100644 index f7e77a911ea950efc6be76d4d2c6b3fdf66a383c..92530a0ebb73c0b2598cd21c6312b0d83c0f0edf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -147,6 +147,7 @@ import org.bukkit.plugin.Plugin; @@ -145,6 +145,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.StandardMessenger; import org.bukkit.plugin.messaging.StandardMessenger;
import org.bukkit.profile.PlayerProfile; import org.bukkit.profile.PlayerProfile;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
@ -34,7 +34,7 @@ index de9dbbff4e0e3d14821d21a1506a6b2d4a8ce3ab..47c2f02a47804da12e380e6ceecac2fc
import net.md_5.bungee.api.chat.BaseComponent; // Spigot import net.md_5.bungee.api.chat.BaseComponent; // Spigot
@@ -165,6 +166,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -163,6 +164,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private double healthScale = 20; private double healthScale = 20;
private CraftWorldBorder clientWorldBorder = null; private CraftWorldBorder clientWorldBorder = null;
private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener(); private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener();
@ -45,7 +45,7 @@ index de9dbbff4e0e3d14821d21a1506a6b2d4a8ce3ab..47c2f02a47804da12e380e6ceecac2fc
public CraftPlayer(CraftServer server, ServerPlayer entity) { public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity); super(server, entity);
@@ -2111,6 +2116,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2109,6 +2114,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public boolean getAffectsSpawning() { public boolean getAffectsSpawning() {
return this.getHandle().affectsSpawning; return this.getHandle().affectsSpawning;
} }

View file

@ -30,10 +30,10 @@ index 7bbcee19248933f67fd40f46db43363890593c73..16707c734f33f6080875e5e3ea338aff
+ } + }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3341fb3250f2dd06328e7ec8ee2758d7497eaecc..63002e9defc876d974426a1e7f087fa421215b8d 100644 index ff7f1347619d4df2a5c217a4b6545878ed81293c..c4860d85eb0a1cab7786982969d58a5729bc93c9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -456,6 +456,7 @@ public final class CraftServer implements Server { @@ -451,6 +451,7 @@ public final class CraftServer implements Server {
if (type == PluginLoadOrder.STARTUP) { if (type == PluginLoadOrder.STARTUP) {
this.helpMap.clear(); this.helpMap.clear();
this.helpMap.initializeGeneralTopics(); this.helpMap.initializeGeneralTopics();
@ -41,7 +41,7 @@ index 3341fb3250f2dd06328e7ec8ee2758d7497eaecc..63002e9defc876d974426a1e7f087fa4
} }
Plugin[] plugins = this.pluginManager.getPlugins(); Plugin[] plugins = this.pluginManager.getPlugins();
@@ -475,7 +476,7 @@ public final class CraftServer implements Server { @@ -470,7 +471,7 @@ public final class CraftServer implements Server {
this.commandMap.registerServerAliases(); this.commandMap.registerServerAliases();
DefaultPermissions.registerCorePermissions(); DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions();

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions
https://github.com/PaperMC/Paper/issues/49 https://github.com/PaperMC/Paper/issues/49
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 63002e9defc876d974426a1e7f087fa421215b8d..37f5448a201aafd799fc661498d44e583632ae91 100644 index c4860d85eb0a1cab7786982969d58a5729bc93c9..8aef55dc446c0fd62bc0913d65085132a63bbc71 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2521,5 +2521,23 @@ public final class CraftServer implements Server { @@ -2504,5 +2504,23 @@ public final class CraftServer implements Server {
} }
return this.adventure$audiences; return this.adventure$audiences;
} }

View file

@ -7,10 +7,10 @@ Metadata is not meant to persist reload as things break badly with non primitive
This will remove metadata on reload so it does not crash everything if a plugin uses it. This will remove metadata on reload so it does not crash everything if a plugin uses it.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 37f5448a201aafd799fc661498d44e583632ae91..93b55593da49e181f8863347c28043a32e1460dc 100644 index 8aef55dc446c0fd62bc0913d65085132a63bbc71..f40446e07308dd9f09622dba55933bc3486f80b8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -945,8 +945,16 @@ public final class CraftServer implements Server { @@ -940,8 +940,16 @@ public final class CraftServer implements Server {
world.paperConfig.init(); // Paper world.paperConfig.init(); // Paper
} }

View file

@ -18,10 +18,10 @@ For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's. ItemMeta API equivalents, and should deprecate the old API's.
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 1a52db84d9630a095347a85e136a9ad118f77325..d66cc030dcd3d98f57803938c8c06342a028ee88 100644 index 7f778e037c1821cc45236bf2a95c28243d0ec126..751c23e3f12b44667c0ae36c0712e498d73ab16e 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -14,6 +14,8 @@ import java.text.DecimalFormatSymbols; @@ -12,6 +12,8 @@ import java.text.DecimalFormatSymbols;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -30,7 +30,7 @@ index 1a52db84d9630a095347a85e136a9ad118f77325..d66cc030dcd3d98f57803938c8c06342
import java.util.Locale; import java.util.Locale;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Optional; import java.util.Optional;
@@ -153,6 +155,23 @@ public final class ItemStack { @@ -151,6 +153,23 @@ public final class ItemStack {
return this.getItem().getTooltipImage(this); return this.getItem().getTooltipImage(this);
} }
@ -54,7 +54,7 @@ index 1a52db84d9630a095347a85e136a9ad118f77325..d66cc030dcd3d98f57803938c8c06342
public ItemStack(ItemLike item) { public ItemStack(ItemLike item) {
this(item, 1); this(item, 1);
} }
@@ -200,6 +219,7 @@ public final class ItemStack { @@ -202,6 +221,7 @@ public final class ItemStack {
// CraftBukkit start - make defensive copy as this data may be coming from the save thread // CraftBukkit start - make defensive copy as this data may be coming from the save thread
this.tag = nbttagcompound.getCompound("tag").copy(); this.tag = nbttagcompound.getCompound("tag").copy();
// CraftBukkit end // CraftBukkit end
@ -62,7 +62,7 @@ index 1a52db84d9630a095347a85e136a9ad118f77325..d66cc030dcd3d98f57803938c8c06342
this.getItem().verifyTagAfterLoad(this.tag); this.getItem().verifyTagAfterLoad(this.tag);
} }
@@ -758,6 +778,7 @@ public final class ItemStack { @@ -772,6 +792,7 @@ public final class ItemStack {
public void setTag(@Nullable CompoundTag nbt) { public void setTag(@Nullable CompoundTag nbt) {
this.tag = nbt; this.tag = nbt;
@ -70,7 +70,7 @@ index 1a52db84d9630a095347a85e136a9ad118f77325..d66cc030dcd3d98f57803938c8c06342
if (this.getItem().canBeDepleted()) { if (this.getItem().canBeDepleted()) {
this.setDamageValue(this.getDamageValue()); this.setDamageValue(this.getDamageValue());
} }
@@ -1063,6 +1084,7 @@ public final class ItemStack { @@ -1061,6 +1082,7 @@ public final class ItemStack {
ListTag nbttaglist = this.tag.getList("Enchantments", 10); ListTag nbttaglist = this.tag.getList("Enchantments", 10);
nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level)); nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level));
@ -79,7 +79,7 @@ index 1a52db84d9630a095347a85e136a9ad118f77325..d66cc030dcd3d98f57803938c8c06342
public boolean isEnchanted() { public boolean isEnchanted() {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index e88df908377450964ae5b6ff97ee97bd2f09c05f..ba70ac49222c517a38e20e86cee1fd38aecb6318 100644 index 4b79b96579efbc4dd9a10e7183ed08b73b488794..3745033afb8923ce06cbf13b55c4e96f2a89573f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -6,7 +6,6 @@ import java.util.Map; @@ -6,7 +6,6 @@ import java.util.Map;
@ -203,7 +203,7 @@ index e88df908377450964ae5b6ff97ee97bd2f09c05f..ba70ac49222c517a38e20e86cee1fd38
static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) { static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index b42527e0307811a3697f6e7b0afc9a10527acbaf..20d10e5b54edaf1c5212bbc33b8cd1aa426fa826 100644 index 0a5f063bc74e1dae67167537437ebd7e4ddf113a..4d687fa31f4d889ac755c178b9afd2b927c78ee2 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList; @@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList;

View file

@ -30,10 +30,10 @@ index 397995fe4c360d837282535b9b7aaf7f3d93f85f..4c4385d3d20556a2695f69c95d6b3cff
+ } + }
} }
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 04bd882525235e6712082d6b710f33abe555884c..68b15e3061e1e8637a34ee5e0f0953dd23645f49 100644 index 27c31a9e926f919c7edc8fc0cdd7fba70616d60c..046082ab7deb21574d9471b78a39a4a6bb296c2f 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -310,7 +310,7 @@ public abstract class AbstractArrow extends Projectile { @@ -311,7 +311,7 @@ public abstract class AbstractArrow extends Projectile {
protected void tickDespawn() { protected void tickDespawn() {
++this.life; ++this.life;

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic. Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e330fc198705ff2a4d8503f8710e6424afc9fbbf..780afec80f90473beb4ea585f514ea7727344b9f 100644 index a04e75293b1d196341bc641ee7da975bf9baec13..64661de5763ac184eed690b15a8665b1dc1a3603 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -209,7 +209,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -214,7 +214,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final LevelStorageSource.LevelStorageAccess convertable; public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid; public final UUID uuid;
@ -19,10 +19,10 @@ index e330fc198705ff2a4d8503f8710e6424afc9fbbf..780afec80f90473beb4ea585f514ea77
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index d923cc91a8f1e71831be8ded1b4818ac3b48fc34..cccce52ef5a1ac7284bc878c7b8f0d2a312fac57 100644 index 2bc5b3c76264a5a23170adbc2e04c55a5e4f2a6a..7f52bf3e2b6588ce4e364906500f24e323bdb664 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -318,6 +318,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -329,6 +329,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return chunk == null ? null : chunk.getFluidState(blockposition); return chunk == null ? null : chunk.getFluidState(blockposition);
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Custom replacement for eaten items
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cb7cccee34e897195d0a258ba6623b75e797ee7c..c5a24e50b4314b2eae63c50a6575ab3ba8165ef8 100644 index 3f82c88058edb5c37fff98d760d931de20a85b5d..0eafee2cb706a20f9eb7c5a7e4f2fc81b9f952c9 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3552,9 +3552,10 @@ public abstract class LivingEntity extends Entity { @@ -3586,9 +3586,10 @@ public abstract class LivingEntity extends Entity {
this.triggerItemUseEffects(this.useItem, 16); this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent // CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack; ItemStack itemstack;
@ -20,7 +20,7 @@ index cb7cccee34e897195d0a258ba6623b75e797ee7c..c5a24e50b4314b2eae63c50a6575ab3b
level.getCraftServer().getPluginManager().callEvent(event); level.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@@ -3568,6 +3569,13 @@ public abstract class LivingEntity extends Entity { @@ -3602,6 +3603,13 @@ public abstract class LivingEntity extends Entity {
} else { } else {
itemstack = this.useItem.finishUsingItem(this.level, this); itemstack = this.useItem.finishUsingItem(this.level, this);
} }
@ -34,7 +34,7 @@ index cb7cccee34e897195d0a258ba6623b75e797ee7c..c5a24e50b4314b2eae63c50a6575ab3b
// CraftBukkit end // CraftBukkit end
if (itemstack != this.useItem) { if (itemstack != this.useItem) {
@@ -3575,6 +3583,11 @@ public abstract class LivingEntity extends Entity { @@ -3609,6 +3617,11 @@ public abstract class LivingEntity extends Entity {
} }
this.stopUsingItem(); this.stopUsingItem();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c5a24e50b4314b2eae63c50a6575ab3ba8165ef8..c358c3d20669a9063439cee4a77555b5aa43bbf2 100644 index 0eafee2cb706a20f9eb7c5a7e4f2fc81b9f952c9..80f8fe489ea403b48cd7b7218ce32d4926f98136 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -761,7 +761,13 @@ public abstract class LivingEntity extends Entity { @@ -784,7 +784,13 @@ public abstract class LivingEntity extends Entity {
@Override @Override
public void readAdditionalSaveData(CompoundTag nbt) { public void readAdditionalSaveData(CompoundTag nbt) {
@ -23,7 +23,7 @@ index c5a24e50b4314b2eae63c50a6575ab3ba8165ef8..c358c3d20669a9063439cee4a77555b5
if (nbt.contains("Attributes", 9) && this.level != null && !this.level.isClientSide) { if (nbt.contains("Attributes", 9) && this.level != null && !this.level.isClientSide) {
this.getAttributes().load(nbt.getList("Attributes", 10)); this.getAttributes().load(nbt.getList("Attributes", 10));
} }
@@ -1248,6 +1254,10 @@ public abstract class LivingEntity extends Entity { @@ -1271,6 +1277,10 @@ public abstract class LivingEntity extends Entity {
} }
public void setHealth(float health) { public void setHealth(float health) {
@ -34,7 +34,7 @@ index c5a24e50b4314b2eae63c50a6575ab3ba8165ef8..c358c3d20669a9063439cee4a77555b5
// CraftBukkit start - Handle scaled health // CraftBukkit start - Handle scaled health
if (this instanceof ServerPlayer) { if (this instanceof ServerPlayer) {
org.bukkit.craftbukkit.entity.CraftPlayer player = ((ServerPlayer) this).getBukkitEntity(); org.bukkit.craftbukkit.entity.CraftPlayer player = ((ServerPlayer) this).getBukkitEntity();
@@ -3386,7 +3396,7 @@ public abstract class LivingEntity extends Entity { @@ -3419,7 +3429,7 @@ public abstract class LivingEntity extends Entity {
} }
public void setAbsorptionAmount(float amount) { public void setAbsorptionAmount(float amount) {
@ -44,10 +44,10 @@ index c5a24e50b4314b2eae63c50a6575ab3ba8165ef8..c358c3d20669a9063439cee4a77555b5
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 47c2f02a47804da12e380e6ceecac2fc147df1b5..9c69ea97f00791b0757db93fa9a6a5eb03577864 100644 index 92530a0ebb73c0b2598cd21c6312b0d83c0f0edf..75bed7319bad695331f6cc633da5eec4b1d46f9f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1916,6 +1916,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1914,6 +1914,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void setRealHealth(double health) { public void setRealHealth(double health) {

View file

@ -6,16 +6,26 @@ Subject: [PATCH] Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 79dddb060d967303be70b690df83c3b2a2b1f67e..f35f6221f839504329f0d87c417ad40ad68bc178 100644 index e6917848029b1686e4e3a1a0eadac85eda92518d..3b998ca5230dc03a7faf2b0d1d1731b442337346 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -155,6 +155,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -105,6 +105,7 @@ import net.minecraft.world.level.entity.EntityInLevelCallback;
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.levelgen.Heightmap;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.PushReaction;
@@ -158,6 +159,38 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
} }
+ // Paper start + // Paper start
+ public static Random SHARED_RANDOM = new Random() { + public static RandomSource SHARED_RANDOM = new RandomRandomSource();
+ private static final class RandomRandomSource extends java.util.Random implements RandomSource {
+ private boolean locked = false; + private boolean locked = false;
+
+ @Override + @Override
+ public synchronized void setSeed(long seed) { + public synchronized void setSeed(long seed) {
+ if (locked) { + if (locked) {
@ -25,17 +35,32 @@ index 79dddb060d967303be70b690df83c3b2a2b1f67e..f35f6221f839504329f0d87c417ad40a
+ locked = true; + locked = true;
+ } + }
+ } + }
+ }; +
+ @Override
+ public RandomSource fork() {
+ return new net.minecraft.world.level.levelgen.LegacyRandomSource(this.nextLong());
+ }
+
+ @Override
+ public PositionalRandomFactory forkPositional() {
+ return new net.minecraft.world.level.levelgen.LegacyRandomSource.LegacyPositionalRandomFactory(this.nextLong());
+ }
+
+ @Override
+ public int nextInt(int origin, int bound) {
+ return RandomSource.super.nextInt(origin, bound);
+ }
+ }
+ // Paper end + // Paper end
+ +
private CraftEntity bukkitEntity; private CraftEntity bukkitEntity;
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
@@ -342,7 +357,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -345,7 +378,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.bb = Entity.INITIAL_AABB; this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO; this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F; this.nextStep = 1.0F;
- this.random = new Random(); - this.random = RandomSource.create();
+ this.random = SHARED_RANDOM; // Paper + this.random = SHARED_RANDOM; // Paper
this.remainingFireTicks = -this.getFireImmuneTicks(); this.remainingFireTicks = -this.getFireImmuneTicks();
this.fluidHeight = new Object2DoubleArrayMap(2); this.fluidHeight = new Object2DoubleArrayMap(2);

View file

@ -22,10 +22,10 @@ index 4c4385d3d20556a2695f69c95d6b3cff087d26d9..fa730fd8b969e39cf063a560d9820d36
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 780afec80f90473beb4ea585f514ea7727344b9f..f70b70eb0505aa1efb115e0e5a45a068244fc755 100644 index 64661de5763ac184eed690b15a8665b1dc1a3603..033a4324800d8e4f057d65a9e41ea46c9eebfc6e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -565,7 +565,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -583,7 +583,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15));
if (this.isRainingAt(blockposition)) { if (this.isRainingAt(blockposition)) {
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);

View file

@ -29,10 +29,10 @@ index 4587a3668b6be9222cdd74a38229f89f611d1af6..9f32861d791f7e4cb39d2ad01f48e191
this.x = x; this.x = x;
this.y = y; this.y = y;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index cccce52ef5a1ac7284bc878c7b8f0d2a312fac57..f1f713c892e1843fdf5adec6714dc72f8fd4d354 100644 index 7f52bf3e2b6588ce4e364906500f24e323bdb664..b087f8a58d18df43a04dae3f1a5a8083df10f6e0 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -261,7 +261,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -272,7 +272,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
public boolean isInWorldBounds(BlockPos pos) { public boolean isInWorldBounds(BlockPos pos) {
@ -42,10 +42,10 @@ index cccce52ef5a1ac7284bc878c7b8f0d2a312fac57..f1f713c892e1843fdf5adec6714dc72f
public static boolean isInSpawnableBounds(BlockPos pos) { public static boolean isInSpawnableBounds(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 847ac56f20ab9c5745f9c0fa0e6f16743ba5e471..eea6816c52e6c0329f3bea0e7789cda9dd4a5a08 100644 index 91d2939bde77c52c25d2633dacc461d7284ef2d3..0d815a39d50bb8c06f81e3386764db6a00d84985 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -122,6 +122,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @@ -119,6 +119,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
return GameEventDispatcher.NOOP; return GameEventDispatcher.NOOP;
} }
@ -71,7 +71,7 @@ index 80e383e9a2d12f9f1b0b0d9ae71a0add9b51c9d4..a9c65c8d36e5c7080133706df1363b3c
public BlockState getBlockState(BlockPos pos) { public BlockState getBlockState(BlockPos pos) {
return Blocks.VOID_AIR.defaultBlockState(); return Blocks.VOID_AIR.defaultBlockState();
diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
index 82a4f5fb84884d229d258134fbfe62d34ad30d80..37e7f766e0de7b47c7240c9365bb134fda26a756 100644 index 475663848a612f356a8e01330b03efb33e98fcec..ca46ed27fdc1eef979829d19b9e90db6d5c59e09 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
@@ -47,6 +47,12 @@ public class ImposterProtoChunk extends ProtoChunk { @@ -47,6 +47,12 @@ public class ImposterProtoChunk extends ProtoChunk {
@ -88,11 +88,11 @@ index 82a4f5fb84884d229d258134fbfe62d34ad30d80..37e7f766e0de7b47c7240c9365bb134f
@Override @Override
public FluidState getFluidState(BlockPos pos) { public FluidState getFluidState(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 7a63c26e360fd054bf237df3eeffc466d73d5dfb..8a1084318f271dd64842c9243166eb89764660d4 100644 index 2704a05766d42b0277fa6308820b88371db00ace..a508b7c6dbf9f7acdca77c219d7dd2492cd7c6b8 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -288,12 +288,29 @@ public class LevelChunk extends ChunkAccess { @@ -296,12 +296,29 @@ public class LevelChunk extends ChunkAccess {
}); }
} }
+ // Paper start - Optimize getBlockData to reduce instructions + // Paper start - Optimize getBlockData to reduce instructions
@ -125,7 +125,7 @@ index 7a63c26e360fd054bf237df3eeffc466d73d5dfb..8a1084318f271dd64842c9243166eb89
BlockState iblockdata = null; BlockState iblockdata = null;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index a17d38d08a1f4b3e7ba4ef233a4acaf75177ac4c..c696358102086257033b55adbef84b1a259cb46e 100644 index dddae1e226d8f58cdcfc597e25d4228cd3245cb4..ae37e97e52557b48f129cc02eeea395378a48444 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -21,7 +21,7 @@ public class LevelChunkSection { @@ -21,7 +21,7 @@ public class LevelChunkSection {
@ -138,7 +138,7 @@ index a17d38d08a1f4b3e7ba4ef233a4acaf75177ac4c..c696358102086257033b55adbef84b1a
private short tickingFluidCount; private short tickingFluidCount;
public final PalettedContainer<BlockState> states; public final PalettedContainer<BlockState> states;
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
index ee0be5163811ea39efcb2092e5f126c3fd9b1523..d3d2bd5ea57254a4af0572d5dab460127718ce09 100644 index 3b11824a1b85da437eec108f631eacfb5192459e..5ce6a2b83546f4dbc3183a386f51b4bacc173744 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -88,14 +88,18 @@ public class ProtoChunk extends ChunkAccess { @@ -88,14 +88,18 @@ public class ProtoChunk extends ChunkAccess {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
Saves on some object allocation and processing when no plugin listens to this Saves on some object allocation and processing when no plugin listens to this
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 400a59336300b189a1b86621b53817940f9a599e..16dbd40ab7394450fd97ced74954ae1554c79aa8 100644 index f037503a68f2b7b7c76b6ac7243dde2bf734afbd..68a4fa890250f6c54367cbe319dd9485c988bbb7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1396,6 +1396,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1354,6 +1354,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
@ -18,11 +18,11 @@ index 400a59336300b189a1b86621b53817940f9a599e..16dbd40ab7394450fd97ced74954ae15
this.profiler.push(() -> { this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location(); return worldserver + " " + worldserver.dimension().location();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f70b70eb0505aa1efb115e0e5a45a068244fc755..93c967efbcdbc44f3729d7a70e90847212daa647 100644 index 033a4324800d8e4f057d65a9e41ea46c9eebfc6e..525ed4ddfbf898e7e8af5f2283fde7d5ba9a96d9 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -208,6 +208,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -213,6 +213,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
private int tickPosition; // CraftBukkit start
public final LevelStorageSource.LevelStorageAccess convertable; public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid; public final UUID uuid;
+ public boolean hasPhysicsEvent = true; // Paper + public boolean hasPhysicsEvent = true; // Paper
@ -30,10 +30,10 @@ index f70b70eb0505aa1efb115e0e5a45a068244fc755..93c967efbcdbc44f3729d7a70e908472
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
return this.chunkSource.getChunk(x, z, false); return this.chunkSource.getChunk(x, z, false);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f1f713c892e1843fdf5adec6714dc72f8fd4d354..b2965b136405bce16f1433411df5beab15231113 100644 index b087f8a58d18df43a04dae3f1a5a8083df10f6e0..5732a9a41a14e5297631d78f924b2082efcfe9da 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -473,7 +473,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -484,7 +484,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit start // CraftBukkit start
iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
CraftWorld world = ((ServerLevel) this).getWorld(); CraftWorld world = ((ServerLevel) this).getWorld();
@ -42,15 +42,6 @@ index f1f713c892e1843fdf5adec6714dc72f8fd4d354..b2965b136405bce16f1433411df5beab
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
this.getCraftServer().getPluginManager().callEvent(event); this.getCraftServer().getPluginManager().callEvent(event);
@@ -586,7 +586,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
try {
// CraftBukkit start
CraftWorld world = ((ServerLevel) this).getWorld();
- if (world != null) {
+ if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), CraftBlockData.fromData(iblockdata), world.getBlockAt(neighborPos.getX(), neighborPos.getY(), neighborPos.getZ()));
this.getCraftServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/level/block/BushBlock.java b/src/main/java/net/minecraft/world/level/block/BushBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BushBlock.java b/src/main/java/net/minecraft/world/level/block/BushBlock.java
index d40e791529911ca81398ac267a819415da91502a..03fde6e47c4a347c62fe9b4a3351769aedf874f6 100644 index d40e791529911ca81398ac267a819415da91502a..03fde6e47c4a347c62fe9b4a3351769aedf874f6 100644
--- a/src/main/java/net/minecraft/world/level/block/BushBlock.java --- a/src/main/java/net/minecraft/world/level/block/BushBlock.java
@ -65,7 +56,7 @@ index d40e791529911ca81398ac267a819415da91502a..03fde6e47c4a347c62fe9b4a3351769a
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
index bad85ac1f369d1044fa2e68b6e49cebc3c253c5b..e12b76238cb52a1007f2102473b7f892f8521b62 100644 index a90f6cc0d8c0f6d115e59d07b1b4c9b45fe0ad1e..68de0aa2c755d07389b3b8052d33aba2583adb14 100644
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java --- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
@@ -4,6 +4,7 @@ import javax.annotation.Nullable; @@ -4,6 +4,7 @@ import javax.annotation.Nullable;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 93c967efbcdbc44f3729d7a70e90847212daa647..317ae71b8b9318a8bfe243b7b316f84566b88bf9 100644 index 525ed4ddfbf898e7e8af5f2283fde7d5ba9a96d9..3e78f79c489899e00b375949b178cdea695f79b1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2037,6 +2037,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2115,6 +2115,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); entity.setOrigin(entity.getOriginVector().toLocation(getWorld()));
} }
// Paper end // Paper end
@ -16,11 +16,11 @@ index 93c967efbcdbc44f3729d7a70e90847212daa647..317ae71b8b9318a8bfe243b7b316f845
} }
public void onTrackingEnd(Entity entity) { public void onTrackingEnd(Entity entity) {
@@ -2117,6 +2118,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2190,6 +2191,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
// CraftBukkit end // CraftBukkit end
+ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid + new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
} }
}
} public void onSectionChange(Entity entity) {

View file

@ -30,7 +30,7 @@ index fa730fd8b969e39cf063a560d9820d3655709398..3e7a98073c86d94881e7c03786e3745d
+ } + }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 8a1084318f271dd64842c9243166eb89764660d4..e2ecbd60ed5200589313d767a17600dca1231931 100644 index a508b7c6dbf9f7acdca77c219d7dd2492cd7c6b8..605ec3ac08845178795721977b685dfbaab33156 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -281,6 +281,13 @@ public class LevelChunk extends ChunkAccess { @@ -281,6 +281,13 @@ public class LevelChunk extends ChunkAccess {
@ -46,4 +46,4 @@ index 8a1084318f271dd64842c9243166eb89764660d4..e2ecbd60ed5200589313d767a17600dc
+ +
@Override @Override
public GameEventDispatcher getEventDispatcher(int ySectionCoord) { public GameEventDispatcher getEventDispatcher(int ySectionCoord) {
return (GameEventDispatcher) this.gameEventDispatcherSections.computeIfAbsent(ySectionCoord, (j) -> { Level world = this.level;

View file

@ -6,7 +6,7 @@ Subject: [PATCH] EntityPathfindEvent
Fires when an Entity decides to start moving to a location. Fires when an Entity decides to start moving to a location.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
index 57a17458dbe1629ebbf58fea9f43f09511b91fb0..dda38820f763f93513b5d83a4239197b48a45238 100644 index 0b2e10a0f508448d9e7d003e6c822f0a56d4022f..27cd393e81f6ef9b5690c051624d8d2af50acd34 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java --- a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
@@ -35,7 +35,7 @@ public class FlyingPathNavigation extends PathNavigation { @@ -35,7 +35,7 @@ public class FlyingPathNavigation extends PathNavigation {
@ -19,7 +19,7 @@ index 57a17458dbe1629ebbf58fea9f43f09511b91fb0..dda38820f763f93513b5d83a4239197b
@Override @Override
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
index a9fd90d5282bd013e031b9d7481e3f777d6892c6..a6f8ca71ba5d107cfbd24b8e8a225195dc233637 100644 index 27b072943328aca4489a9565bda700e7e7dcbb6a..f610c06d7bb51ec2c63863dd46711712986a106a 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java --- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
@@ -69,7 +69,7 @@ public class GroundPathNavigation extends PathNavigation { @@ -69,7 +69,7 @@ public class GroundPathNavigation extends PathNavigation {
@ -32,7 +32,7 @@ index a9fd90d5282bd013e031b9d7481e3f777d6892c6..a6f8ca71ba5d107cfbd24b8e8a225195
private int getSurfaceY() { private int getSurfaceY() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 0ed51ff1607277801ddf307984bb3b776ed74816..66a2813b0b4fc321d24dde4d51dbf2dc81e6149d 100644 index eaf1653b14e5fdacae38abe75260a64d0ffbfc1d..ff1e04e5e3b8099b0b71eda1c0de864c809c5029 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -10,6 +10,7 @@ import net.minecraft.core.BlockPos; @@ -10,6 +10,7 @@ import net.minecraft.core.BlockPos;
@ -43,7 +43,7 @@ index 0ed51ff1607277801ddf307984bb3b776ed74816..66a2813b0b4fc321d24dde4d51dbf2dc
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Mob;
@@ -106,7 +107,13 @@ public abstract class PathNavigation { @@ -108,7 +109,13 @@ public abstract class PathNavigation {
@Nullable @Nullable
public Path createPath(BlockPos target, int distance) { public Path createPath(BlockPos target, int distance) {
@ -58,7 +58,7 @@ index 0ed51ff1607277801ddf307984bb3b776ed74816..66a2813b0b4fc321d24dde4d51dbf2dc
} }
@Nullable @Nullable
@@ -116,7 +123,7 @@ public abstract class PathNavigation { @@ -118,7 +125,7 @@ public abstract class PathNavigation {
@Nullable @Nullable
public Path createPath(Entity entity, int distance) { public Path createPath(Entity entity, int distance) {
@ -67,7 +67,7 @@ index 0ed51ff1607277801ddf307984bb3b776ed74816..66a2813b0b4fc321d24dde4d51dbf2dc
} }
@Nullable @Nullable
@@ -126,6 +133,16 @@ public abstract class PathNavigation { @@ -128,6 +135,16 @@ public abstract class PathNavigation {
@Nullable @Nullable
protected Path createPath(Set<BlockPos> positions, int range, boolean useHeadPos, int distance, float followRange) { protected Path createPath(Set<BlockPos> positions, int range, boolean useHeadPos, int distance, float followRange) {
@ -84,7 +84,7 @@ index 0ed51ff1607277801ddf307984bb3b776ed74816..66a2813b0b4fc321d24dde4d51dbf2dc
if (positions.isEmpty()) { if (positions.isEmpty()) {
return null; return null;
} else if (this.mob.getY() < (double)this.level.getMinBuildHeight()) { } else if (this.mob.getY() < (double)this.level.getMinBuildHeight()) {
@@ -135,6 +152,23 @@ public abstract class PathNavigation { @@ -137,6 +154,23 @@ public abstract class PathNavigation {
} else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) { } else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) {
return this.path; return this.path;
} else { } else {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Do not load chunks for Pathfinding
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
index ca45dfc6c05760e00987c09b697efb1f9ff0e78a..2d42df635b1ce8d975278fb36f00fe9b8b8f060f 100644 index 235b01e23a8997d0d65de3655b3b3ff50a204c06..c48e097464977dbec22d1370c3393ba1fe105137 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -457,7 +457,12 @@ public class WalkNodeEvaluator extends NodeEvaluator { @@ -477,7 +477,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
for(int n = -1; n <= 1; ++n) { for(int n = -1; n <= 1; ++n) {
if (l != 0 || n != 0) { if (l != 0 || n != 0) {
pos.set(i + l, j + m, k + n); pos.set(i + l, j + m, k + n);
@ -22,7 +22,7 @@ index ca45dfc6c05760e00987c09b697efb1f9ff0e78a..2d42df635b1ce8d975278fb36f00fe9b
if (blockState.is(Blocks.CACTUS)) { if (blockState.is(Blocks.CACTUS)) {
return BlockPathTypes.DANGER_CACTUS; return BlockPathTypes.DANGER_CACTUS;
} }
@@ -473,6 +478,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { @@ -493,6 +498,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
if (world.getFluidState(pos).is(FluidTags.WATER)) { if (world.getFluidState(pos).is(FluidTags.WATER)) {
return BlockPathTypes.WATER_BORDER; return BlockPathTypes.WATER_BORDER;
} }
@ -30,7 +30,7 @@ index ca45dfc6c05760e00987c09b697efb1f9ff0e78a..2d42df635b1ce8d975278fb36f00fe9b
} }
} }
} }
@@ -482,7 +488,8 @@ public class WalkNodeEvaluator extends NodeEvaluator { @@ -502,7 +508,8 @@ public class WalkNodeEvaluator extends NodeEvaluator {
} }
protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) { protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) {

View file

@ -20,10 +20,10 @@ index 8834ed411a7db86b4d2b88183a1315317107d719..c45b5ab6776f3ac79f856c3a6467c510
static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() { static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() {
@Override @Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7fdc50a94f18f8a2417643fdd174b754d04999ab..782e83989b82ca5547f953473b199694ed2f6690 100644 index 9b057950417704669fdeb80efb2417904a010074..1b92ee3988c1bdcbc751f32bd480b2ad2f588139 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2220,8 +2220,37 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2410,8 +2410,37 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}); });
} }
} }

View file

@ -20,21 +20,21 @@ index 3e7a98073c86d94881e7c03786e3745db2c445cd..8dcb136f3f77bc69d5976cc17ecdafb9
+ } + }
} }
diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
index 4ba446351d8b8b97ebfab1436d8f313f2747901e..b642ced1bc4dd819210db291cfc1837d011431ab 100644 index bd5a45765b53bf4f2f9aaea4769c71ffb008741d..845f086eb8cc7dd87c820065e7621c3c2a5cc04f 100644
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java --- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block; @@ -2,6 +2,7 @@ package net.minecraft.world.level.block;
import java.util.Random;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.world.level.LevelReader; import net.minecraft.util.RandomSource;
@@ -39,6 +40,7 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock { @@ -39,6 +40,7 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock {
@Override @Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
+ if (this instanceof GrassBlock && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper + if (this instanceof GrassBlock && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper
if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) { if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) {
// CraftBukkit start // CraftBukkit start

View file

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Apr 2016 17:48:50 -0400
Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3e78f79c489899e00b375949b178cdea695f79b1..39343854ea106aaa2c1c9f490cbdae28eb2550e6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1361,6 +1361,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override
public void updateNeighborsAt(BlockPos pos, Block sourceBlock) {
+ if (captureBlockStates) { return; } // Paper - Cancel all physics during placement
this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, (Direction) null);
}

View file

@ -11,7 +11,7 @@ After: http://i.imgur.com/nJ46crB.png
Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
index ebfc546d258b92ee02e0e726b9d4dbff6a671d51..6426d6c2c31ead49444fe56e2230266290fa79dd 100644 index c8ae9d25eedb7cb2d9f95b799a507727b655f11f..9b81ce9d85cba07e9752c29fb5a842c4b00aa873 100644
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java --- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java +++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
@@ -11,8 +11,8 @@ public class SimpleBitStorage implements BitStorage { @@ -11,8 +11,8 @@ public class SimpleBitStorage implements BitStorage {
@ -24,7 +24,7 @@ index ebfc546d258b92ee02e0e726b9d4dbff6a671d51..6426d6c2c31ead49444fe56e22302662
+ private final int divideAdd; private final long divideAddUnsigned; // Paper + private final int divideAdd; private final long divideAddUnsigned; // Paper
private final int divideShift; private final int divideShift;
public SimpleBitStorage(int elementBits, int size, int[] is) { public SimpleBitStorage(int elementBits, int size, int[] data) {
@@ -56,8 +56,8 @@ public class SimpleBitStorage implements BitStorage { @@ -56,8 +56,8 @@ public class SimpleBitStorage implements BitStorage {
this.mask = (1L << elementBits) - 1L; this.mask = (1L << elementBits) - 1L;
this.valuesPerLong = (char)(64 / elementBits); this.valuesPerLong = (char)(64 / elementBits);

View file

@ -32,10 +32,10 @@ index 1294b38262505b0d54089e428df9b363219de1f0..c5339618c195507c1d1482e4e77e262e
buf.writeComponent(this.playerPrefix); buf.writeComponent(this.playerPrefix);
buf.writeComponent(this.playerSuffix); buf.writeComponent(this.playerSuffix);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 16dbd40ab7394450fd97ced74954ae1554c79aa8..66ba45e0a3c4970df9f8b3a0b8b5cfdaf597e40c 100644 index 68a4fa890250f6c54367cbe319dd9485c988bbb7..4a84a0cea0ccc5de699c5b1e1a6686a72b954e40 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -162,6 +162,7 @@ import net.minecraft.world.level.storage.loot.LootTables; @@ -150,6 +150,7 @@ import net.minecraft.world.level.storage.loot.LootTables;
import net.minecraft.world.level.storage.loot.PredicateManager; import net.minecraft.world.level.storage.loot.PredicateManager;
import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -43,7 +43,7 @@ index 16dbd40ab7394450fd97ced74954ae1554c79aa8..66ba45e0a3c4970df9f8b3a0b8b5cfda
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -608,6 +609,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -576,6 +577,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld())); this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
} }
@ -65,10 +65,10 @@ index 16dbd40ab7394450fd97ced74954ae1554c79aa8..66ba45e0a3c4970df9f8b3a0b8b5cfda
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP)); this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
this.connection.acceptConnections(); this.connection.acceptConnections();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 68835bcd519e41808669df51c0a9b04aa21727cb..3d3e647fbfbb8007b6e7dc87808d63ca4465fc21 100644 index 4cf2264208ce681d92441cd06bf8120d586bc82a..e0b279d9437b30ca4a18a3036bf59664570a746f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -88,6 +88,7 @@ import net.minecraft.world.level.storage.PlayerDataStorage; @@ -98,6 +98,7 @@ import net.minecraft.world.level.storage.PlayerDataStorage;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.Objective;
import net.minecraft.world.scores.PlayerTeam; import net.minecraft.world.scores.PlayerTeam;
@ -76,7 +76,7 @@ index 68835bcd519e41808669df51c0a9b04aa21727cb..3d3e647fbfbb8007b6e7dc87808d63ca
import net.minecraft.world.scores.Team; import net.minecraft.world.scores.Team;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -150,6 +151,7 @@ public abstract class PlayerList { @@ -154,6 +155,7 @@ public abstract class PlayerList {
// CraftBukkit start // CraftBukkit start
private CraftServer cserver; private CraftServer cserver;
private final Map<String,ServerPlayer> playersByName = new java.util.HashMap<>(); private final Map<String,ServerPlayer> playersByName = new java.util.HashMap<>();
@ -84,7 +84,7 @@ index 68835bcd519e41808669df51c0a9b04aa21727cb..3d3e647fbfbb8007b6e7dc87808d63ca
public PlayerList(MinecraftServer server, RegistryAccess.Frozen registryManager, PlayerDataStorage saveHandler, int maxPlayers) { public PlayerList(MinecraftServer server, RegistryAccess.Frozen registryManager, PlayerDataStorage saveHandler, int maxPlayers) {
this.cserver = server.server = new CraftServer((DedicatedServer) server, this); this.cserver = server.server = new CraftServer((DedicatedServer) server, this);
@@ -385,6 +387,13 @@ public abstract class PlayerList { @@ -389,6 +391,13 @@ public abstract class PlayerList {
player.initInventoryMenu(); player.initInventoryMenu();
// CraftBukkit - Moved from above, added world // CraftBukkit - Moved from above, added world
@ -98,7 +98,7 @@ index 68835bcd519e41808669df51c0a9b04aa21727cb..3d3e647fbfbb8007b6e7dc87808d63ca
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ()); PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
} }
@@ -504,6 +513,16 @@ public abstract class PlayerList { @@ -508,6 +517,16 @@ public abstract class PlayerList {
entityplayer.doTick(); // SPIGOT-924 entityplayer.doTick(); // SPIGOT-924
// CraftBukkit end // CraftBukkit end
@ -115,7 +115,7 @@ index 68835bcd519e41808669df51c0a9b04aa21727cb..3d3e647fbfbb8007b6e7dc87808d63ca
this.save(entityplayer); this.save(entityplayer);
if (entityplayer.isPassenger()) { if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle(); Entity entity = entityplayer.getRootVehicle();
@@ -1132,6 +1151,13 @@ public abstract class PlayerList { @@ -1136,6 +1155,13 @@ public abstract class PlayerList {
} }
// CraftBukkit end // CraftBukkit end

View file

@ -6,11 +6,11 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 02613b1f36ecd7f354ac00022af3c193b299c1b1..63cc89c7769bfcc9d663a1827ad525e3ddd82fe5 100644 index eb94a7a156df1616f8093bf2f082de3754917086..9016aced079108aeae09f030a672467a953ef93f 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -88,9 +88,36 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL @@ -87,9 +87,36 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
this.connection.disconnect(chatmessage); this.connection.disconnect(ichatmutablecomponent);
} else { } else {
this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection)); this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection));
+ // Paper start - handshake event + // Paper start - handshake event

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Configurable RCON IP address
For servers with multiple IP's, ability to bind to a specific interface. For servers with multiple IP's, ability to bind to a specific interface.
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 703403222763e42566552f2c6f3852e07f727f76..a7938420f6840b9d3880fb895aaf709ebd844312 100644 index cfff4a6711b2acd4b40ec80544c169a46ded3f79..cc92e2c5e6b62c6a67d0a6534b078e3a6029daf5 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -74,6 +74,8 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie @@ -100,6 +100,8 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@Nullable @Nullable
private WorldGenSettings worldGenSettings; private WorldGenSettings worldGenSettings;
@ -18,10 +18,10 @@ index 703403222763e42566552f2c6f3852e07f727f76..a7938420f6840b9d3880fb895aaf709e
// CraftBukkit start // CraftBukkit start
public DedicatedServerProperties(Properties properties, OptionSet optionset) { public DedicatedServerProperties(Properties properties, OptionSet optionset) {
super(properties, optionset); super(properties, optionset);
@@ -124,6 +126,10 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie @@ -152,6 +154,10 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
}, new JsonObject()), this.get("generate-structures", true), (String) this.get("level-type", (s) -> {
return s.toLowerCase(Locale.ROOT); return s.toLowerCase(Locale.ROOT);
}, "default")); }, WorldPresets.NORMAL.location().toString()));
this.serverResourcePackInfo = DedicatedServerProperties.getServerPackInfo(this.get("resource-pack", ""), this.get("resource-pack-sha1", ""), this.getLegacyString("resource-pack-hash"), this.get("require-resource-pack", false), this.get("resource-pack-prompt", ""));
+ // Paper start - Configurable rcon ip + // Paper start - Configurable rcon ip
+ final String rconIp = this.getStringRaw("rcon.ip"); + final String rconIp = this.getStringRaw("rcon.ip");
+ this.rconIp = rconIp == null ? this.serverIp : rconIp; + this.rconIp = rconIp == null ? this.serverIp : rconIp;

View file

@ -6,10 +6,10 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
Don't even get me started Don't even get me started
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c358c3d20669a9063439cee4a77555b5aa43bbf2..fdf44f109d548d36d84e77fce5aa7fce865448dd 100644 index 80f8fe489ea403b48cd7b7218ce32d4926f98136..7a4996d720cc093f5c4b72356f20fc316cf9c533 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1227,10 +1227,16 @@ public abstract class LivingEntity extends Entity { @@ -1250,10 +1250,16 @@ public abstract class LivingEntity extends Entity {
} }
public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) { public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) {

View file

@ -24,13 +24,13 @@ index 8381b1c9ffa5d9f28281336d5a3df4d01253dd92..2c7cdf91288eb9a88d1d453accc87a8d
+ } + }
} }
diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
index 0c063ec7c5907710947d8e1ee0f122448364e64e..48776edab1479b5e861eca8146da04ebee01c46a 100644 index e1916fe8a7aa736d9266efde954bbfbda38a3a65..d2de8192cbdae37fc7baaef998254bd82485fc72 100644
--- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java --- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
@@ -32,6 +32,7 @@ public class FrostedIceBlock extends IceBlock { @@ -32,6 +32,7 @@ public class FrostedIceBlock extends IceBlock {
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
+ if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice + if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) { if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) {
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();

View file

@ -6,10 +6,10 @@ Subject: [PATCH] remove null possibility for getServer singleton
to stop IDE complaining about potential NPE to stop IDE complaining about potential NPE
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 66ba45e0a3c4970df9f8b3a0b8b5cfdaf597e40c..9e95cb40ce6839de2582e71576b73cdf8787a042 100644 index 4a84a0cea0ccc5de699c5b1e1a6686a72b954e40..b62d7b2e974f9eafb8e60ddb9ed58273b0393185 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -185,6 +185,7 @@ import co.aikar.timings.MinecraftTimings; // Paper @@ -180,6 +180,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable { public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable {
@ -17,15 +17,15 @@ index 66ba45e0a3c4970df9f8b3a0b8b5cfdaf597e40c..9e95cb40ce6839de2582e71576b73cdf
public static final Logger LOGGER = LogUtils.getLogger(); public static final Logger LOGGER = LogUtils.getLogger();
public static final String VANILLA_BRAND = "vanilla"; public static final String VANILLA_BRAND = "vanilla";
private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F; private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F;
@@ -319,6 +320,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -304,6 +305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, DynamicOps<Tag> registryreadops, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable GameProfileCache usercache, ChunkProgressListenerFactory worldloadlistenerfactory) { public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, DynamicOps<Tag> registryreadops, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
super("Server"); super("Server");
+ SERVER = this; // Paper - better singleton + SERVER = this; // Paper - better singleton
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
this.profiler = this.metricsRecorder.getProfiler(); this.profiler = this.metricsRecorder.getProfiler();
this.onMetricsRecordingStopped = (methodprofilerresults) -> { this.onMetricsRecordingStopped = (methodprofilerresults) -> {
@@ -2306,7 +2308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2272,7 +2274,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Deprecated @Deprecated
public static MinecraftServer getServer() { public static MinecraftServer getServer() {

View file

@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed. Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 317ae71b8b9318a8bfe243b7b316f84566b88bf9..9769977c9db77aa52b99b793ca4f5d0c7b54528f 100644 index 39343854ea106aaa2c1c9f490cbdae28eb2550e6..5ee25084459f4cfcc8a95001a9d480e4a235f9f0 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2057,6 +2057,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2136,6 +2136,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
{ {
if ( iter.next().player == entity ) if ( iter.next().player == entity )
{ {
@ -25,10 +25,10 @@ index 317ae71b8b9318a8bfe243b7b316f84566b88bf9..9769977c9db77aa52b99b793ca4f5d0c
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 067513b240db88b818bd26d74c31fb5f8ee80f5d..df753a2d39332464f16207615175bc95d35f61e8 100644 index 24456bbf2cd9f1878cf545e8d164ff524c321a4c..22291d7b8d9294bed1afdaed88040e06120b22e0 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -88,6 +88,7 @@ import net.minecraft.world.item.ElytraItem; @@ -92,6 +92,7 @@ import net.minecraft.world.item.ElytraItem;
import net.minecraft.world.item.ItemCooldowns; import net.minecraft.world.item.ItemCooldowns;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
@ -36,7 +36,7 @@ index 067513b240db88b818bd26d74c31fb5f8ee80f5d..df753a2d39332464f16207615175bc95
import net.minecraft.world.item.ProjectileWeaponItem; import net.minecraft.world.item.ProjectileWeaponItem;
import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.SwordItem;
import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.Recipe;
@@ -106,6 +107,7 @@ import net.minecraft.world.level.block.entity.SignBlockEntity; @@ -110,6 +111,7 @@ import net.minecraft.world.level.block.entity.SignBlockEntity;
import net.minecraft.world.level.block.entity.StructureBlockEntity; import net.minecraft.world.level.block.entity.StructureBlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.block.state.pattern.BlockInWorld;
@ -44,7 +44,7 @@ index 067513b240db88b818bd26d74c31fb5f8ee80f5d..df753a2d39332464f16207615175bc95
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam; import net.minecraft.world.scores.PlayerTeam;
@@ -750,6 +752,14 @@ public abstract class Player extends LivingEntity { @@ -762,6 +764,14 @@ public abstract class Player extends LivingEntity {
return null; return null;
} }
// CraftBukkit end // CraftBukkit end

View file

@ -515,11 +515,11 @@ index 0000000000000000000000000000000000000000..3377b86c337d0234bbb9b0349e4034a7
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f35f6221f839504329f0d87c417ad40ad68bc178..20863d4294ab29c8ad851a50d03200e498843399 100644 index 3b998ca5230dc03a7faf2b0d1d1731b442337346..1c74d8f3b432afb9bcc71d87d86cb977d30ecbb7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -170,6 +170,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -191,6 +191,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}; }
// Paper end // Paper end
+ public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
@ -527,10 +527,10 @@ index f35f6221f839504329f0d87c417ad40ad68bc178..20863d4294ab29c8ad851a50d03200e4
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
index 298f7e29412ecaf15b3fb15da9ee3d6b250f772a..8a07d5d25086d7544757bb86181fbe2b5e743d29 100644 index 9347faecdaa3ef8c375fe8b0a89fc3385b6823bd..9e29080bd041062447f3ba3240811e86022edc56 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
@@ -46,6 +46,7 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @@ -33,6 +33,7 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
public long lootTableSeed; public long lootTableSeed;
// CraftBukkit start // CraftBukkit start
@ -538,55 +538,64 @@ index 298f7e29412ecaf15b3fb15da9ee3d6b250f772a..8a07d5d25086d7544757bb86181fbe2b
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
private int maxStack = MAX_STACK; private int maxStack = MAX_STACK;
@@ -200,12 +201,13 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @@ -134,12 +135,14 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
@Override @Override
protected void addAdditionalSaveData(CompoundTag nbt) { protected void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt); super.addAdditionalSaveData(nbt);
+ this.lootableData.saveNbt(nbt); // Paper + this.lootableData.loadNbt(nbt); // Paper
if (this.lootTable != null) { this.addChestVehicleSaveData(nbt);
nbt.putString("LootTable", this.lootTable.toString()); }
if (this.lootTableSeed != 0L) {
nbt.putLong("LootTableSeed", this.lootTableSeed);
}
- } else {
+ } if (true) { // Paper - Always save the items, Table may stick around
ContainerHelper.saveAllItems(nbt, this.itemStacks);
}
@@ -214,11 +216,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
@Override @Override
protected void readAdditionalSaveData(CompoundTag nbt) { protected void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt); super.readAdditionalSaveData(nbt);
+ this.lootableData.loadNbt(nbt); // Paper + this.lootableData.loadNbt(nbt); // Paper
this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); this.readChestVehicleSaveData(nbt);
if (nbt.contains("LootTable", 8)) {
this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
this.lootTableSeed = nbt.getLong("LootTableSeed");
- } else {
+ } if (true) { // Paper - always load the items, table may still remain
ContainerHelper.loadAllItems(nbt, this.itemStacks);
}
@@ -254,14 +257,15 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
} }
public void unpackLootTable(@Nullable Player player) { diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
- if (this.lootTable != null && this.level.getServer() != null) { index abb35b675fc075c1004a85cd8f0c6f65d290a809..64097c718e906d2afb469202a0c9b82435e2926c 100644
+ if (this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper --- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
LootTable loottable = this.level.getServer().getLootTables().get(this.lootTable); +++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
@@ -65,12 +65,14 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
@Override
protected void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
+ this.lootableData.loadNbt(nbt); // Paper
this.addChestVehicleSaveData(nbt);
}
if (player instanceof ServerPlayer) { @Override
CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer) player, this.lootTable); protected void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt);
+ this.lootableData.loadNbt(nbt); // Paper
this.readChestVehicleSaveData(nbt);
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
index e2a9782e0ae60eb5557dce0831084c5722687df6..8b740ae757721e02761939f8b50199e09f5c9136 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
@@ -61,7 +61,7 @@ public interface ContainerEntity extends Container, MenuProvider {
if (this.getLootTableSeed() != 0L) {
nbt.putLong("LootTableSeed", this.getLootTableSeed());
} }
- } else {
+ } else if (true) { // Paper - always load the items, table may still remain
ContainerHelper.saveAllItems(nbt, this.getItemStacks());
}
- this.lootTable = null; @@ -72,7 +72,7 @@ public interface ContainerEntity extends Container, MenuProvider {
+ //this.lootTable = null; // Paper if (nbt.contains("LootTable", 8)) {
+ this.lootableData.processRefill(player); // Paper this.setLootTable(new ResourceLocation(nbt.getString("LootTable")));
LootContext.Builder loottableinfo_builder = (new LootContext.Builder((ServerLevel) this.level)).withParameter(LootContextParams.ORIGIN, this.position()).withOptionalRandomSeed(this.lootTableSeed); this.setLootTableSeed(nbt.getLong("LootTableSeed"));
- } else {
+ } else if (true) { // Paper - always load the items, table may still remain
ContainerHelper.loadAllItems(nbt, this.getItemStacks());
}
if (player != null) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
index b79d9d26a8e60f9c0ecd69e9c2f9cfd087e21d23..f23fff80d07ac7d06715efe67cb49ebbe704967b 100644 index 216fc20326d71121098430dc1b9f7477265a91b7..e3bee2df77d87630e96621470e940d9d9e152e7f 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
@@ -28,6 +28,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc @@ -28,6 +28,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Async GameProfileCache saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9e95cb40ce6839de2582e71576b73cdf8787a042..49c354fa65e0047a367f0a5410c79b8da8693df9 100644 index b62d7b2e974f9eafb8e60ddb9ed58273b0393185..9e5271d39e4a15a71c59a8560edd59c75ec6dd52 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -985,7 +985,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -942,7 +942,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} catch (java.lang.InterruptedException ignored) {} // Paper } catch (java.lang.InterruptedException ignored) {} // Paper
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
MinecraftServer.LOGGER.info("Saving usercache.json"); MinecraftServer.LOGGER.info("Saving usercache.json");
@ -18,10 +18,10 @@ index 9e95cb40ce6839de2582e71576b73cdf8787a042..49c354fa65e0047a367f0a5410c79b8d
// Spigot end // Spigot end
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 20ff08f1a802d16d2306b570e9fb529946d90f6b..b99c1b62ce01700d5c374a1801e8323d5906255c 100644 index 9e7fb3e2d423ba1db22819aa8b666ca886d98cf6..576fc01b902acaf2a217db3fb39b799f2f57ce01 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -258,7 +258,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -250,7 +250,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} }
if (this.convertOldUsers()) { if (this.convertOldUsers()) {
@ -31,7 +31,7 @@ index 20ff08f1a802d16d2306b570e9fb529946d90f6b..b99c1b62ce01700d5c374a1801e8323d
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) { if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 975ab6061f9d70eb61885960fdfdb24e71b2239e..fdf2557ed19c6ba9c64eddd2876b2434925dcf36 100644 index fb110ecb7fa8d0de7d8ce8e239d1db341a333203..717a0d1c1f4df7ebd5f4cdd5e24cabe3fb66bf06 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -127,7 +127,7 @@ public class GameProfileCache { @@ -127,7 +127,7 @@ public class GameProfileCache {

View file

@ -24,10 +24,10 @@ index a491af30f70f41e5f7b198ae4d40acfb6eec9b38..45712eb3967d61541580db57e1e9f84e
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index c9cc096183753d61d9f53ceca05af07c04bbff3b..861f3790179e18f6192ac8b2fb5d2ecbc54484ad 100644 index 61efa24cb1b24216ae80dcd4e68abc39a9ced1bb..232341fa41b1962d329cc17f3146e41c51d22164 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -67,7 +67,7 @@ public class ServerEntity { @@ -65,7 +65,7 @@ public class ServerEntity {
private boolean wasRiding; private boolean wasRiding;
private boolean wasOnGround; private boolean wasOnGround;
// CraftBukkit start // CraftBukkit start

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Faster redstone torch rapid clock removal
Only resize the the redstone torch list once, since resizing arrays / lists is costly Only resize the the redstone torch list once, since resizing arrays / lists is costly
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 522b33f8d78468f07786dc7d6f184d2bc49dfc3f..9abe4b8bbd97c30d84964d3c66a61e8b43140adb 100644 index 5732a9a41a14e5297631d78f924b2082efcfe9da..4b5d9b90658efe43fcb346dd94dc1e3372809b0e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -157,6 +157,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -163,6 +163,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
private org.spigotmc.TickLimiter tileLimiter; private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition; private int tileTickPosition;
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
@ -18,7 +18,7 @@ index 522b33f8d78468f07786dc7d6f184d2bc49dfc3f..9abe4b8bbd97c30d84964d3c66a61e8b
public CraftWorld getWorld() { public CraftWorld getWorld() {
return this.world; return this.world;
diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java
index 298928f9dae5fc307872f4cb286b644ed5dbcfde..954b86bea345a8e0e3a8dd425f356db6f5cd496f 100644 index 9b6f8508d16bcecd9dc148f75598655e3585f175..da07fce0cf7c9fbdb57d2c59e431b59bf583bf50 100644
--- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java --- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java
@@ -21,7 +21,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit @@ -21,7 +21,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
@ -32,7 +32,7 @@ index 298928f9dae5fc307872f4cb286b644ed5dbcfde..954b86bea345a8e0e3a8dd425f356db6
public static final int RESTART_DELAY = 160; public static final int RESTART_DELAY = 160;
@@ -72,11 +72,15 @@ public class RedstoneTorchBlock extends TorchBlock { @@ -72,11 +72,15 @@ public class RedstoneTorchBlock extends TorchBlock {
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
boolean flag = this.hasNeighborSignal(world, pos, state); boolean flag = this.hasNeighborSignal(world, pos, state);
- List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world); - List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world);
- -

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add server-name parameter
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a0ac6ba17a46bac4c5363a32e078ab89b260bac8..b3d62affc6558d2c3082a75793ebd8b521eb1df6 100644 index f017abbf3418c6000648950dc05b177f9d41f97b..3f531ec9232568243a15ad1b238839b8036a2d82 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -149,6 +149,14 @@ public class Main { @@ -149,6 +149,14 @@ public class Main {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
Also fix view distance lookup Also fix view distance lookup
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 10da58381202f8ec3d49aa2ed08faf30c435883b..89bd094fc31969284d831eaab47a131914d4fb13 100644 index 13fa9c47a95571d63b590c595e15e9a15c2f6a65..7b64b14b1d2c0e242a5d8e8602e49b185fcf8839 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -637,8 +637,9 @@ public class EnderDragon extends Mob implements Enemy { @@ -633,8 +633,9 @@ public class EnderDragon extends Mob implements Enemy {
if (this.dragonDeathTime == 1 && !this.isSilent()) { if (this.dragonDeathTime == 1 && !this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// this.world.b(1028, this.getChunkCoordinates(), 0); // this.world.b(1028, this.getChunkCoordinates(), 0);

View file

@ -21,7 +21,7 @@ index c518704386f14cd033307dd976455c35760d7236..148e79ae4e24fe16dbbb17550c3f258d
private final BlockEntityType<?> type; private final BlockEntityType<?> type;
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index e390cfea5bed64284a97c88a717503f07f073a30..3a2e2adeefe73981b443216724270023408c1feb 100644 index 715873e52708762b25c29caf6d41d7cb8f79ce57..39bd98b9496e4a27fd69a2de7c83c40689017ebc 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -93,7 +93,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C @@ -93,7 +93,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@ -34,7 +34,7 @@ index e390cfea5bed64284a97c88a717503f07f073a30..3a2e2adeefe73981b443216724270023
continue; continue;
} }
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
index cf8a38b7d55d229ac556f8a93b25c155381df3a2..129ebb095c2280376a59b54920e5ff90cf1f465a 100644 index 71206f52a234a17db13062d975cbf66d1ffebc9a..f3fcd345178efd4917ef79cb141275a987f99e58 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
@@ -284,7 +284,9 @@ public class StructureTemplate { @@ -284,7 +284,9 @@ public class StructureTemplate {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Avoid blocking on Network Manager creation
Per Paper issue 294 Per Paper issue 294
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 522aa6a0b4b365a78cf3fce2604d71fb88d30388..e174d9803e557470068f7893260d55a042888517 100644 index 0b657174309b6eaee0c8a2d6c17dd467d278739c..5e1a6f2cd2d0d9c6b17c446fa782e4089cc138d5 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -61,6 +61,15 @@ public class ServerConnectionListener { @@ -62,6 +62,15 @@ public class ServerConnectionListener {
public volatile boolean running; public volatile boolean running;
private final List<ChannelFuture> channels = Collections.synchronizedList(Lists.newArrayList()); private final List<ChannelFuture> channels = Collections.synchronizedList(Lists.newArrayList());
final List<Connection> connections = Collections.synchronizedList(Lists.newArrayList()); final List<Connection> connections = Collections.synchronizedList(Lists.newArrayList());
@ -25,7 +25,7 @@ index 522aa6a0b4b365a78cf3fce2604d71fb88d30388..e174d9803e557470068f7893260d55a0
public ServerConnectionListener(MinecraftServer server) { public ServerConnectionListener(MinecraftServer server) {
this.server = server; this.server = server;
@@ -96,7 +105,8 @@ public class ServerConnectionListener { @@ -97,7 +106,8 @@ public class ServerConnectionListener {
int j = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond(); int j = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond();
Object object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND); Object object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND);
@ -35,7 +35,7 @@ index 522aa6a0b4b365a78cf3fce2604d71fb88d30388..e174d9803e557470068f7893260d55a0
channel.pipeline().addLast("packet_handler", (ChannelHandler) object); channel.pipeline().addLast("packet_handler", (ChannelHandler) object);
((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); ((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
} }
@@ -155,6 +165,7 @@ public class ServerConnectionListener { @@ -156,6 +166,7 @@ public class ServerConnectionListener {
synchronized (this.connections) { synchronized (this.connections) {
// Spigot Start // Spigot Start

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Don't lookup game profiles that have no UUID and no name
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index fdf2557ed19c6ba9c64eddd2876b2434925dcf36..d8acbce8c2f0cc9a93fff044b25629021bf90f75 100644 index 717a0d1c1f4df7ebd5f4cdd5e24cabe3fb66bf06..87b7a669ef111b2dc40d152fe6fe4e75ff8ccc98 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -101,7 +101,7 @@ public class GameProfileCache { @@ -101,7 +101,7 @@ public class GameProfileCache {
@ -14,6 +14,6 @@ index fdf2557ed19c6ba9c64eddd2876b2434925dcf36..d8acbce8c2f0cc9a93fff044b2562902
- if (!GameProfileCache.usesAuthentication() && gameprofile == null) { - if (!GameProfileCache.usesAuthentication() && gameprofile == null) {
+ if (!GameProfileCache.usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name + if (!GameProfileCache.usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name
UUID uuid = Player.createPlayerUUID(new GameProfile((UUID) null, name)); UUID uuid = UUIDUtil.getOrCreatePlayerUUID(new GameProfile((UUID) null, name));
return Optional.of(new GameProfile(uuid, name)); return Optional.of(new GameProfile(uuid, name));

View file

@ -32,7 +32,7 @@ index 46ec9016e17805664531a61a75fc046e041b0848..01b1eb60894a79bd10a035404cc796ce
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index d8acbce8c2f0cc9a93fff044b25629021bf90f75..c4142568c3188c89142799cc4911dd7eae32a45f 100644 index 87b7a669ef111b2dc40d152fe6fe4e75ff8ccc98..6087fff889458dc09d5a3eb52e7d4b0a77bde809 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -98,6 +98,7 @@ public class GameProfileCache { @@ -98,6 +98,7 @@ public class GameProfileCache {
@ -53,7 +53,7 @@ index d8acbce8c2f0cc9a93fff044b25629021bf90f75..c4142568c3188c89142799cc4911dd7e
public void add(GameProfile profile) { public void add(GameProfile profile) {
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index b7b98832be6178a2bca534bf974519ede977b282..aa3caccc58f1cec8d5f396813d7fc40b05985cc8 100644 index da98f074ccd5a40c635824112c97fd174c393cb1..fd9c7e4cb637b67fbbcbee6f8e2449c4e62fc344 100644
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
@@ -66,7 +66,8 @@ public class OldUsersConverter { @@ -66,7 +66,8 @@ public class OldUsersConverter {
@ -67,10 +67,10 @@ index b7b98832be6178a2bca534bf974519ede977b282..aa3caccc58f1cec8d5f396813d7fc40b
} else { } else {
String[] astring1 = astring; String[] astring1 = astring;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 93b55593da49e181f8863347c28043a32e1460dc..bc584d676aef3a107000a101db1323d1ea4d68e8 100644 index f40446e07308dd9f09622dba55933bc3486f80b8..abada046fd469cc5c423c26571d70b5ea062eda1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1703,7 +1703,7 @@ public final class CraftServer implements Server { @@ -1686,7 +1686,7 @@ public final class CraftServer implements Server {
// Spigot Start // Spigot Start
GameProfile profile = null; GameProfile profile = null;
// Only fetch an online UUID in online mode // Only fetch an online UUID in online mode

View file

@ -37,10 +37,10 @@ index 4d6e7b5889ecb81195c7152225ae8e3343d3408c..0bca0f971dac994bd8b6ecd87e8b33e2
return true; return true;
} else if (object instanceof EnumProperty && super.equals(object)) { } else if (object instanceof EnumProperty && super.equals(object)) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
index c3ec7f91794d802e5b9ddac3fffccce378dace68..72f508321ebffcca31240fbdd068b4d185454cbc 100644 index 59b5b22a567e4e2be499a2a35aedb10218a7432a..bdbe0362e49e73c05237f9f3143230e0b03e494e 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java --- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
@@ -38,8 +38,7 @@ public class IntegerProperty extends Property<Integer> { @@ -35,8 +35,7 @@ public class IntegerProperty extends Property<Integer> {
return this.values; return this.values;
} }

View file

@ -23,10 +23,10 @@ index 01b1eb60894a79bd10a035404cc796ce0d3725c8..77e1a4b9b0734734bbcf03b6adc1cf05
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 782e83989b82ca5547f953473b199694ed2f6690..9ab89d4a6e76e450c735733702bba11ef0173f2f 100644 index 1b92ee3988c1bdcbc751f32bd480b2ad2f588139..f3146f65f8e3ac465763093e7f5b53274d4d3356 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1503,13 +1503,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1534,13 +1534,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot start - limit place/interactions // Spigot start - limit place/interactions
private int limitedPackets; private int limitedPackets;
private long lastLimitedPacket = -1; private long lastLimitedPacket = -1;

View file

@ -21,23 +21,23 @@ index 77e1a4b9b0734734bbcf03b6adc1cf0552063d1f..2440e81ef23c3b8c91ca5bdf13347f13
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9ab89d4a6e76e450c735733702bba11ef0173f2f..8a0c3a8f96ed260fa205e1395b4f8e30e563bd34 100644 index f3146f65f8e3ac465763093e7f5b53274d4d3356..71b595a293e0add1ad9f7e5c3a2694a8a16771aa 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -300,7 +300,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -326,7 +326,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger()) { if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger()) {
if (++this.aboveGroundTickCount > 80) { if (++this.aboveGroundTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.flying")); - this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message + this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message
return; return;
} }
} else { } else {
@@ -319,7 +319,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -345,7 +345,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) { if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > 80) { if (++this.aboveGroundVehicleTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.flying")); - this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message + this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message
return; return;
} }

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityZapEvent
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 819f694e96dd21bbc47f345fcd9c5714ab44040f..32a961075b41cd84b24398b9d1a4d58f88439d73 100644 index 2a7c82be934a965ba26dc7bf1f60689360bda487..33d1a6b31afec4dbeb00dcabf50c5840852102d6 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -836,9 +836,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -836,9 +836,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Cache user authenticator threads
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 627931ec09bfb1a84f0659981491cf3b6425aa32..58ef6874cd6c90e6ccc7c39881cc3bf68fba284b 100644 index ff8773f3671970bd759303f7a4bbc17d4df5a1de..13f8f3a2a6382ef51567cc6f46b573d971f700f6 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -116,6 +116,18 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -120,6 +120,18 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
} }
@ -27,28 +27,28 @@ index 627931ec09bfb1a84f0659981491cf3b6425aa32..58ef6874cd6c90e6ccc7c39881cc3bf6
// Spigot start // Spigot start
public void initUUID() public void initUUID()
{ {
@@ -210,8 +222,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -258,8 +270,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce)); this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce));
} else { } else {
// Spigot start // Spigot start
- new Thread("User Authenticator #" + ServerLoginPacketListenerImpl.UNIQUE_THREAD_ID.incrementAndGet()) { - new Thread("User Authenticator #" + ServerLoginPacketListenerImpl.UNIQUE_THREAD_ID.incrementAndGet()) {
- -
+ // Paper start - Cache authenticator threads + // Paper start - Cache authenticator threads
+ authenticatorPool.execute(new Runnable() { + authenticatorPool.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
@@ -222,7 +234,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -270,7 +282,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.gameProfile.getName(), ex); server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.gameProfile.getName(), ex);
}
} }
} - }.start();
- }.start();
+ }); + });
+ // Paper end + // Paper end
// Spigot end // Spigot end
} }
@@ -257,7 +270,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -311,7 +324,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
throw new IllegalStateException("Protocol error", cryptographyexception); throw new IllegalStateException("Protocol error", cryptographyexception);
} }
@ -58,7 +58,7 @@ index 627931ec09bfb1a84f0659981491cf3b6425aa32..58ef6874cd6c90e6ccc7c39881cc3bf6
public void run() { public void run() {
GameProfile gameprofile = ServerLoginPacketListenerImpl.this.gameProfile; GameProfile gameprofile = ServerLoginPacketListenerImpl.this.gameProfile;
@@ -302,10 +316,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -356,10 +370,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
return ServerLoginPacketListenerImpl.this.server.getPreventProxyConnections() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; return ServerLoginPacketListenerImpl.this.server.getPreventProxyConnections() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
} }

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bc584d676aef3a107000a101db1323d1ea4d68e8..f3024dcf7d29359931af1a2d00aa429a75e449a1 100644 index abada046fd469cc5c423c26571d70b5ea062eda1..ae1cfe01f285a773ab9d4bdb9b0dd897615f0b82 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2547,5 +2547,24 @@ public final class CraftServer implements Server { @@ -2530,5 +2530,24 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions(); DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions();
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add ProjectileCollideEvent
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 68b15e3061e1e8637a34ee5e0f0953dd23645f49..91505b592e95240e0dc71a17906ab48f5eb94f34 100644 index 046082ab7deb21574d9471b78a39a4a6bb296c2f..62beefb6693d1801d9d8994c7247dca5bd646b0b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -225,6 +225,17 @@ public abstract class AbstractArrow extends Projectile { @@ -226,6 +226,17 @@ public abstract class AbstractArrow extends Projectile {
} }
} }
@ -27,7 +27,7 @@ index 68b15e3061e1e8637a34ee5e0f0953dd23645f49..91505b592e95240e0dc71a17906ab48f
this.preOnHit((HitResult) object); // CraftBukkit - projectile hit event this.preOnHit((HitResult) object); // CraftBukkit - projectile hit event
this.hasImpulse = true; this.hasImpulse = true;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
index 02b0622d23521090a0725e2b24cc1231e416ba0c..3de3258418f638a1b523c6a9178bb3ef1aaf2915 100644 index 867e50769af3c5bdbed15cfd637e429dcfcb6920..d71dc286673fa7ed708be5bec4c5a6868874c090 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
@@ -11,6 +11,7 @@ import net.minecraft.world.entity.Entity; @@ -11,6 +11,7 @@ import net.minecraft.world.entity.Entity;

View file

@ -13,10 +13,10 @@ by adding code to all overrides in:
to return BLOCKED if it is outside the world border. to return BLOCKED if it is outside the world border.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 66a2813b0b4fc321d24dde4d51dbf2dc81e6149d..7991baa181d60ac037fd859278d00274ddb42be8 100644 index ff1e04e5e3b8099b0b71eda1c0de864c809c5029..649c2fdba307d986d13916bf90e311c862ccefc1 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -155,7 +155,7 @@ public abstract class PathNavigation { @@ -157,7 +157,7 @@ public abstract class PathNavigation {
// Paper start - Pathfind event // Paper start - Pathfind event
boolean copiedSet = false; boolean copiedSet = false;
for (BlockPos possibleTarget : positions) { for (BlockPos possibleTarget : positions) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 9abe4b8bbd97c30d84964d3c66a61e8b43140adb..567cc347af00eed98fdf8832ef6c9468332b94e4 100644 index 4b5d9b90658efe43fcb346dd94dc1e3372809b0e..b28fc4cf5deb543e78b91547c1ab7e1ab9e6f0e4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -319,6 +319,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -330,6 +330,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return chunk == null ? null : chunk.getFluidState(blockposition); return chunk == null ? null : chunk.getFluidState(blockposition);
} }

View file

@ -34,14 +34,14 @@ index 6ec5a1525d0b8ced8fe78d3eab29c5eb82996844..2442c287a7f26cfee10a19e9015558cd
return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ(); return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ();
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 30ee07433cfee7c7911dcea6d8bfc58eacf5833a..fff5c9d40a0bab8642376db3ec25cc1e8d666fa6 100644 index 91666d0c8116353b80d49941f17a3a8405eb50a7..0f92f2906195f5b2b70ca02a46fa111a46f8f18f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -440,6 +440,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { @@ -387,6 +387,7 @@ public abstract class ChunkGenerator {
int l1 = i + i1 * j1;
int i2 = j + i1 * k1;
ChunkPos chunkcoordintpair = randomspreadstructureplacement.getPotentialFeatureChunk(l, l1, i2);
+ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
Iterator iterator = set.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ChunkPos chunkcoordintpair = (ChunkPos) iterator.next();
+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
blockposition_mutableblockposition.set(SectionPos.sectionToBlockCoord(chunkcoordintpair.x, 8), 32, SectionPos.sectionToBlockCoord(chunkcoordintpair.z, 8));
double d1 = blockposition_mutableblockposition.distSqr(center);

View file

@ -51,28 +51,28 @@ index 0b5e223594ff95b8ba7c300d4a66ca7a17e53802..8451982ba4fc9522f2d77f68fc63a0e1
+ } + }
} }
diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
index 7eda0af21ce7662e9bb6d47c79e175a060a8bb13..d595c82f850bb04657a86748d7e04695f934846f 100644 index f95999daa1955dd4d919d0e668fe099901a0481c..7360a0a70ddb3dc055d3ebc62071cb5327094e8e 100644
--- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java --- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
+++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
@@ -386,7 +386,8 @@ public class VillagerTrades { @@ -386,7 +386,8 @@ public class VillagerTrades {
return null; return null;
} else { } else {
ServerLevel serverLevel = (ServerLevel)entity.level; ServerLevel serverLevel = (ServerLevel)entity.level;
- BlockPos blockPos = serverLevel.findNearestMapFeature(this.destination, entity.blockPosition(), 100, true); - BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, true);
+ if (!serverLevel.paperConfig.enableTreasureMaps) return null; // Paper + if (!serverLevel.paperConfig.enableTreasureMaps) return null; // Paper
+ BlockPos blockPos = serverLevel.findNearestMapFeature(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig.treasureMapsAlreadyDiscoveredVillager); // Paper + BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig.treasureMapsAlreadyDiscoveredVillager); // Paper
if (blockPos != null) { if (blockPos != null) {
ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true); ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true);
MapItem.renderBiomePreviewMap(serverLevel, itemStack); MapItem.renderBiomePreviewMap(serverLevel, itemStack);
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
index 385cae45ef8cbaf9f09472585e6f639eea3e0331..a84cef6a10e3d7fdcd02ef6774163785dc3c350c 100644 index 321384730cacbdc22eedc53651e4d24f06c73b99..fa1387ce6029198109bed258c559cd008f531c08 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
@@ -68,7 +68,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { @@ -68,7 +68,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction {
Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN);
if (vec3 != null) { if (vec3 != null) {
ServerLevel serverLevel = context.getLevel(); ServerLevel serverLevel = context.getLevel();
- BlockPos blockPos = serverLevel.findNearestMapFeature(this.destination, new BlockPos(vec3), this.searchRadius, this.skipKnownStructures); - BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, new BlockPos(vec3), this.searchRadius, this.skipKnownStructures);
+ // Paper start + // Paper start
+ if (!serverLevel.paperConfig.enableTreasureMaps) { + if (!serverLevel.paperConfig.enableTreasureMaps) {
+ /* + /*
@ -82,7 +82,7 @@ index 385cae45ef8cbaf9f09472585e6f639eea3e0331..a84cef6a10e3d7fdcd02ef6774163785
+ return stack; + return stack;
+ } + }
+ // Paper end + // Paper end
+ BlockPos blockPos = serverLevel.findNearestMapFeature(this.destination, new BlockPos(vec3), this.searchRadius, serverLevel.paperConfig.treasureMapsAlreadyDiscoveredLootTable == null ? this.skipKnownStructures : serverLevel.paperConfig.treasureMapsAlreadyDiscoveredLootTable); // Paper + BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, new BlockPos(vec3), this.searchRadius, serverLevel.paperConfig.treasureMapsAlreadyDiscoveredLootTable == null ? this.skipKnownStructures : serverLevel.paperConfig.treasureMapsAlreadyDiscoveredLootTable); // Paper
if (blockPos != null) { if (blockPos != null) {
ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true); ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true);
MapItem.renderBiomePreviewMap(serverLevel, itemStack); MapItem.renderBiomePreviewMap(serverLevel, itemStack);

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize ItemStack.isEmpty()
Remove hashMap lookup every check, simplify code to remove ternary Remove hashMap lookup every check, simplify code to remove ternary
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index d66cc030dcd3d98f57803938c8c06342a028ee88..65189af7acc3e60fc7f2bfe82128ada981bf1271 100644 index 751c23e3f12b44667c0ae36c0712e498d73ab16e..a2426b71830d5c39fff04cedaa7569abe332f92a 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -245,7 +245,7 @@ public final class ItemStack { @@ -247,7 +247,7 @@ public final class ItemStack {
} }
public boolean isEmpty() { public boolean isEmpty() {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index a02fe7542c7809d98d8ec68f1013594ee86ccb3f..a82503bc791b5b01e509b333e9d5baa7abbb60b8 100644 index bd0f3295932220e88dfd72b1719651b132a325f9..def35ca400cb315a9eea035026412b69ec51b1a8 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -91,6 +91,7 @@ public class ArmorStand extends LivingEntity { @@ -91,6 +91,7 @@ public class ArmorStand extends LivingEntity {
@ -16,7 +16,7 @@ index a02fe7542c7809d98d8ec68f1013594ee86ccb3f..a82503bc791b5b01e509b333e9d5baa7
public ArmorStand(EntityType<? extends ArmorStand> type, Level world) { public ArmorStand(EntityType<? extends ArmorStand> type, Level world) {
super(type, world); super(type, world);
@@ -926,4 +927,13 @@ public class ArmorStand extends LivingEntity { @@ -925,4 +926,13 @@ public class ArmorStand extends LivingEntity {
public boolean canBeSeenByAnyone() { public boolean canBeSeenByAnyone() {
return !this.isInvisible() && !this.isMarker(); return !this.isInvisible() && !this.isMarker();
} }

View file

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Apr 2016 17:48:50 -0400
Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b2965b136405bce16f1433411df5beab15231113..522b33f8d78468f07786dc7d6f184d2bc49dfc3f 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -544,6 +544,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public void setBlocksDirty(BlockPos pos, BlockState old, BlockState updated) {}
public void updateNeighborsAt(BlockPos pos, Block block) {
+ if (captureBlockStates) { return; } // Paper - Cancel all physics during placement
this.neighborChanged(pos.west(), block, pos);
this.neighborChanged(pos.east(), block, pos);
this.neighborChanged(pos.below(), block, pos);