3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2025-01-11 23:50:54 +01:00

[ci skip] Add more patch identifying comments

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-13 18:34:33 +01:00
Ursprung e84621a9d8
Commit c0e4697dbd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
20 geänderte Dateien mit 190 neuen und 185 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Allow proper checking of empty item stacks
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 9ce03abd24ae8c2f156ade360094157e20f63666..32da455eb46d09a846bae5270b32a6d6d6b962fd 100644 index 9ce03abd24ae8c2f156ade360094157e20f63666..bec8114b52d4d888a78c238f48902aa460e193f5 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
@@ -33,12 +33,19 @@ public final class CraftItemStack extends ItemStack { @@ -33,12 +33,19 @@ public final class CraftItemStack extends ItemStack {
@ -17,7 +17,7 @@ index 9ce03abd24ae8c2f156ade360094157e20f63666..32da455eb46d09a846bae5270b32a6d6
+ public boolean isEmpty() { + public boolean isEmpty() {
+ return handle == null || handle.isEmpty(); + return handle == null || handle.isEmpty();
+ } + }
+ // Paper end + // Paper end - override isEmpty to use vanilla's impl
+ +
public static net.minecraft.world.item.ItemStack asNMSCopy(ItemStack original) { public static net.minecraft.world.item.ItemStack asNMSCopy(ItemStack original) {
if (original instanceof CraftItemStack) { if (original instanceof CraftItemStack) {
@ -25,7 +25,7 @@ index 9ce03abd24ae8c2f156ade360094157e20f63666..32da455eb46d09a846bae5270b32a6d6
return stack.handle == null ? net.minecraft.world.item.ItemStack.EMPTY : stack.handle.copy(); return stack.handle == null ? net.minecraft.world.item.ItemStack.EMPTY : stack.handle.copy();
} }
- if (original == null || original.getType() == Material.AIR) { - if (original == null || original.getType() == Material.AIR) {
+ if (original == null || original.isEmpty()) { // Paper - use isEmpty + if (original == null || original.isEmpty()) { // Paper - override isEmpty to use vanilla's impl; use isEmpty
return net.minecraft.world.item.ItemStack.EMPTY; return net.minecraft.world.item.ItemStack.EMPTY;
} }

Datei anzeigen

@ -5,34 +5,34 @@ Subject: [PATCH] Fix silent equipment change for mobs
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 16d84042e2575418880897c728a99d1b8bbcdd15..5af48151159135b869ec4753bbcf79dd257c1570 100644 index 16d84042e2575418880897c728a99d1b8bbcdd15..c81c72bf1027fcbaac67808fbcf6e0af112176bc 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1059,13 +1059,20 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -1059,13 +1059,20 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override @Override
public void setItemSlot(EquipmentSlot slot, ItemStack stack) { public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
+ // Paper start + // Paper start - Fix silent equipment change
+ setItemSlot(slot, stack, false); + setItemSlot(slot, stack, false);
+ } + }
+ +
+ @Override + @Override
+ public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) { + public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) {
+ // Paper end + // Paper end - Fix silent equipment change
this.verifyEquippedItem(stack); this.verifyEquippedItem(stack);
switch (slot.getType()) { switch (slot.getType()) {
case HAND: case HAND:
- this.onEquipItem(slot, (ItemStack) this.handItems.set(slot.getIndex(), stack), stack); - this.onEquipItem(slot, (ItemStack) this.handItems.set(slot.getIndex(), stack), stack);
+ this.onEquipItem(slot, (ItemStack) this.handItems.set(slot.getIndex(), stack), stack, silent); // Paper + this.onEquipItem(slot, (ItemStack) this.handItems.set(slot.getIndex(), stack), stack, silent); // Paper - Fix silent equipment change
break; break;
case ARMOR: case ARMOR:
- this.onEquipItem(slot, (ItemStack) this.armorItems.set(slot.getIndex(), stack), stack); - this.onEquipItem(slot, (ItemStack) this.armorItems.set(slot.getIndex(), stack), stack);
+ this.onEquipItem(slot, (ItemStack) this.armorItems.set(slot.getIndex(), stack), stack, silent); // Paper + this.onEquipItem(slot, (ItemStack) this.armorItems.set(slot.getIndex(), stack), stack, silent); // Paper - Fix silent equipment change
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 8e9469fec42f7b6a132cf173f6f5a95777a29b3b..b319021b22c5dceba6199ed27814b2dcf47b8d50 100644 index 8e9469fec42f7b6a132cf173f6f5a95777a29b3b..a383c0c8b5c89ef1eef7d18edc3a09f749fdd310 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -250,8 +250,8 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo @@ -250,8 +250,8 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@ -41,13 +41,13 @@ index 8e9469fec42f7b6a132cf173f6f5a95777a29b3b..b319021b22c5dceba6199ed27814b2dc
@Override @Override
- public void setItemSlot(EquipmentSlot slot, ItemStack stack) { - public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
- super.setItemSlot(slot, stack); - super.setItemSlot(slot, stack);
+ public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) { // Paper + public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) { // Paper - Fix silent equipment change
+ super.setItemSlot(slot, stack, silent); // Paper + super.setItemSlot(slot, stack, silent); // Paper - Fix silent equipment change
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.reassessWeaponGoal(); this.reassessWeaponGoal();
} }
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 d5890f295350ae5fb6e4844c90f6ab8e3a5f5516..a7d40d41a332f0612a2f1ff60c7082e4a8825ba1 100644 index d5890f295350ae5fb6e4844c90f6ab8e3a5f5516..990bb65f784a2ac52e131d1ed146c2cd6dc19dce 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
@@ -1900,7 +1900,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1900,7 +1900,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -58,7 +58,7 @@ index d5890f295350ae5fb6e4844c90f6ab8e3a5f5516..a7d40d41a332f0612a2f1ff60c7082e4
+ // notify observers if the block state is the same and the Y level equals the original y level (for mega trees) + // notify observers if the block state is the same and the Y level equals the original y level (for mega trees)
+ // blocks at the same Y level with the same state can be assumed to be saplings which trigger observers regardless of if the + // blocks at the same Y level with the same state can be assumed to be saplings which trigger observers regardless of if the
+ // tree grew or not + // tree grew or not
+ if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) { + if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) { // Paper - Fix silent equipment change
this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512); this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512);
} }
} }

Datei anzeigen

@ -8,7 +8,7 @@ disables saving any forced stats, so it stays at the same value (without enablin
fixes stat initialization to not cause a NullPointerException fixes stat initialization to not cause a NullPointerException
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
index 9501e5f25f5c4d3069e554d4dc82b0e094156682..9bb8d4d7be6a937980aa653db82be084d066a563 100644 index 9501e5f25f5c4d3069e554d4dc82b0e094156682..f890738d3bb9fb5e70a9d323c6cec97f9948f9cf 100644
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java --- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java +++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
@@ -48,13 +48,6 @@ public class ServerStatsCounter extends StatsCounter { @@ -48,13 +48,6 @@ public class ServerStatsCounter extends StatsCounter {
@ -25,21 +25,26 @@ index 9501e5f25f5c4d3069e554d4dc82b0e094156682..9bb8d4d7be6a937980aa653db82be084
if (file.isFile()) { if (file.isFile()) {
try { try {
this.parseLocal(server.getFixerUpper(), FileUtils.readFileToString(file)); this.parseLocal(server.getFixerUpper(), FileUtils.readFileToString(file));
@@ -65,6 +58,13 @@ public class ServerStatsCounter extends StatsCounter { @@ -65,6 +58,18 @@ public class ServerStatsCounter extends StatsCounter {
} }
} }
+ // Spigot start // Paper start - moved after stat fetching for player state file. + // Paper start - Moved after stat fetching for player state file
+ // Moves the loading after vanilla loading, so it overrides the values.
+ // Disables saving any forced stats, so it stays at the same value (without enabling disableStatSaving)
+ // Fixes stat initialization to not cause a NullPointerException
+ // Spigot start
+ for ( Map.Entry<ResourceLocation, Integer> entry : org.spigotmc.SpigotConfig.forcedStats.entrySet() ) + for ( Map.Entry<ResourceLocation, Integer> entry : org.spigotmc.SpigotConfig.forcedStats.entrySet() )
+ { + {
+ Stat<ResourceLocation> wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.get(entry.getKey()))); // Paper - ensured by SpigotConfig#stats + Stat<ResourceLocation> wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.get(entry.getKey()))); // Paper - ensured by SpigotConfig#stats
+ this.stats.put( wrapper, entry.getValue().intValue() ); + this.stats.put( wrapper, entry.getValue().intValue() );
+ } + }
+ // Spigot end // Paper end - moved after stat fetching for player state file. + // Spigot end
+ // Paper end - Moved after stat fetching for player state file
} }
public void save() { public void save() {
@@ -80,6 +80,7 @@ public class ServerStatsCounter extends StatsCounter { @@ -80,6 +85,7 @@ public class ServerStatsCounter extends StatsCounter {
@Override @Override
public void setValue(Player player, Stat<?> stat, int value) { public void setValue(Player player, Stat<?> stat, int value) {
if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot

Datei anzeigen

@ -18,7 +18,7 @@ index da5ff65fade5cdf14fad3705c08b48896bc4c36d..d6cbe98e67fdbf8db46338a88ab1356d
void setMaxStackSize(int size); void setMaxStackSize(int size);
diff --git a/src/main/java/net/minecraft/world/SimpleContainer.java b/src/main/java/net/minecraft/world/SimpleContainer.java diff --git a/src/main/java/net/minecraft/world/SimpleContainer.java b/src/main/java/net/minecraft/world/SimpleContainer.java
index 061e870e0cdd5bf00351b7e8104361bce86809f3..0259d188e6e16384069bf2a1c6e0197fe631ab6b 100644 index 061e870e0cdd5bf00351b7e8104361bce86809f3..5cdb0face59ee3a12d8aba95ebe16658c80fb544 100644
--- a/src/main/java/net/minecraft/world/SimpleContainer.java --- a/src/main/java/net/minecraft/world/SimpleContainer.java
+++ b/src/main/java/net/minecraft/world/SimpleContainer.java +++ b/src/main/java/net/minecraft/world/SimpleContainer.java
@@ -30,7 +30,7 @@ public class SimpleContainer implements Container, StackedContentsCompatible { @@ -30,7 +30,7 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
@ -34,11 +34,11 @@ index 061e870e0cdd5bf00351b7e8104361bce86809f3..0259d188e6e16384069bf2a1c6e0197f
} }
public org.bukkit.inventory.InventoryHolder getOwner() { public org.bukkit.inventory.InventoryHolder getOwner() {
+ // Paper start + // Paper start - Add missing InventoryHolders
+ if (this.bukkitOwner == null && this.bukkitOwnerCreator != null) { + if (this.bukkitOwner == null && this.bukkitOwnerCreator != null) {
+ this.bukkitOwner = this.bukkitOwnerCreator.get(); + this.bukkitOwner = this.bukkitOwnerCreator.get();
+ } + }
+ // Paper end + // Paper end - Add missing InventoryHolders
return this.bukkitOwner; return this.bukkitOwner;
} }
@ -46,18 +46,18 @@ index 061e870e0cdd5bf00351b7e8104361bce86809f3..0259d188e6e16384069bf2a1c6e0197f
public SimpleContainer(int size) { public SimpleContainer(int size) {
this(size, null); this(size, null);
} }
+ // Paper start + // Paper start - Add missing InventoryHolders
+ private @Nullable java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator; + private @Nullable java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator;
+ public SimpleContainer(java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator, int size) { + public SimpleContainer(java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator, int size) {
+ this(size); + this(size);
+ this.bukkitOwnerCreator = bukkitOwnerCreator; + this.bukkitOwnerCreator = bukkitOwnerCreator;
+ } + }
+ // Paper end + // Paper end - Add missing InventoryHolders
public SimpleContainer(int i, org.bukkit.inventory.InventoryHolder owner) { public SimpleContainer(int i, org.bukkit.inventory.InventoryHolder owner) {
this.bukkitOwner = owner; this.bukkitOwner = owner;
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index cdd230337584befb37f2e48b24dd504398b431a5..8fd82051bba33b4703e4d99fff886b63a319a5ba 100644 index cdd230337584befb37f2e48b24dd504398b431a5..0727dcbd561c0b488733aa0ad0d3f256d0f76c66 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -1029,4 +1029,15 @@ public abstract class AbstractContainerMenu { @@ -1029,4 +1029,15 @@ public abstract class AbstractContainerMenu {
@ -65,7 +65,7 @@ index cdd230337584befb37f2e48b24dd504398b431a5..8fd82051bba33b4703e4d99fff886b63
return this.stateId; return this.stateId;
} }
+ +
+ // Paper start - add missing BlockInventoryHolder to inventories + // Paper start - Add missing InventoryHolders
+ // The reason this is a supplier, is that the createHolder method uses the bukkit InventoryView#getTopInventory to get the inventory in question + // The reason this is a supplier, is that the createHolder method uses the bukkit InventoryView#getTopInventory to get the inventory in question
+ // and that can't be obtained safely until the AbstractContainerMenu has been fully constructed. Using a supplier lazily + // and that can't be obtained safely until the AbstractContainerMenu has been fully constructed. Using a supplier lazily
+ // initializes the InventoryHolder safely. + // initializes the InventoryHolder safely.
@ -74,10 +74,10 @@ index cdd230337584befb37f2e48b24dd504398b431a5..8fd82051bba33b4703e4d99fff886b63
+ Preconditions.checkArgument(context != null, "context was null"); + Preconditions.checkArgument(context != null, "context was null");
+ return () -> context.createBlockHolder(this); + return () -> context.createBlockHolder(this);
+ } + }
+ // Paper end + // Paper end - Add missing InventoryHolders
} }
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
index a6e712606ece631502ae4c7513403092df77524f..25af92ec0d086160020cade97b0ddf7f6546e159 100644 index a6e712606ece631502ae4c7513403092df77524f..5942bac2f24dafad6a3d451fcc126a97e436cd4f 100644
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java --- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
@@ -41,7 +41,7 @@ public class BeaconMenu extends AbstractContainerMenu { @@ -41,7 +41,7 @@ public class BeaconMenu extends AbstractContainerMenu {
@ -85,12 +85,12 @@ index a6e712606ece631502ae4c7513403092df77524f..25af92ec0d086160020cade97b0ddf7f
super(MenuType.BEACON, syncId); super(MenuType.BEACON, syncId);
this.player = (Inventory) inventory; // CraftBukkit - TODO: check this this.player = (Inventory) inventory; // CraftBukkit - TODO: check this
- this.beacon = new SimpleContainer(1) { - this.beacon = new SimpleContainer(1) {
+ this.beacon = new SimpleContainer(this.createBlockHolder(context), 1) { // Paper + this.beacon = new SimpleContainer(this.createBlockHolder(context), 1) { // Paper - Add missing InventoryHolders
@Override @Override
public boolean canPlaceItem(int slot, ItemStack stack) { public boolean canPlaceItem(int slot, ItemStack stack) {
return stack.is(ItemTags.BEACON_PAYMENT_ITEMS); return stack.is(ItemTags.BEACON_PAYMENT_ITEMS);
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
index 819187dbcf468d9278ce33bd97688476aab53f8e..09be5db3c09262e8bc56c4e20a48fe648f09237c 100644 index 819187dbcf468d9278ce33bd97688476aab53f8e..32e7c7599bffb9ea5384615d31e0b63de08a8813 100644
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java --- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java +++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
@@ -52,7 +52,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { @@ -52,7 +52,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
@ -98,7 +98,7 @@ index 819187dbcf468d9278ce33bd97688476aab53f8e..09be5db3c09262e8bc56c4e20a48fe64
public CartographyTableMenu(int syncId, Inventory inventory, final ContainerLevelAccess context) { public CartographyTableMenu(int syncId, Inventory inventory, final ContainerLevelAccess context) {
super(MenuType.CARTOGRAPHY_TABLE, syncId); super(MenuType.CARTOGRAPHY_TABLE, syncId);
- this.container = new SimpleContainer(2) { - this.container = new SimpleContainer(2) {
+ this.container = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper + this.container = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper - Add missing InventoryHolders
@Override @Override
public void setChanged() { public void setChanged() {
CartographyTableMenu.this.slotsChanged(this); CartographyTableMenu.this.slotsChanged(this);
@ -107,19 +107,19 @@ index 819187dbcf468d9278ce33bd97688476aab53f8e..09be5db3c09262e8bc56c4e20a48fe64
// CraftBukkit end // CraftBukkit end
}; };
- this.resultContainer = new ResultContainer() { - this.resultContainer = new ResultContainer() {
+ this.resultContainer = new ResultContainer(this.createBlockHolder(context)) { // Paper + this.resultContainer = new ResultContainer(this.createBlockHolder(context)) { // Paper - Add missing InventoryHolders
@Override @Override
public void setChanged() { public void setChanged() {
CartographyTableMenu.this.slotsChanged(this); CartographyTableMenu.this.slotsChanged(this);
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java b/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java b/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
index f00a957a0f55e69f93e6d7dc80193304447c3dcb..d2f19b44ce4ab663a68ee330de4d4582ae9f3f00 100644 index f00a957a0f55e69f93e6d7dc80193304447c3dcb..91699661c78089e07be06e4456413c5aa90562b1 100644
--- a/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java --- a/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
+++ b/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java +++ b/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
@@ -21,6 +21,18 @@ public interface ContainerLevelAccess { @@ -21,6 +21,18 @@ public interface ContainerLevelAccess {
return new org.bukkit.Location(this.getWorld().getWorld(), this.getPosition().getX(), this.getPosition().getY(), this.getPosition().getZ()); return new org.bukkit.Location(this.getWorld().getWorld(), this.getPosition().getX(), this.getPosition().getY(), this.getPosition().getZ());
} }
// CraftBukkit end // CraftBukkit end
+ // Paper start + // Paper start - Add missing InventoryHolders
+ default boolean isBlock() { + default boolean isBlock() {
+ return false; + return false;
+ } + }
@ -130,7 +130,7 @@ index f00a957a0f55e69f93e6d7dc80193304447c3dcb..d2f19b44ce4ab663a68ee330de4d4582
+ } + }
+ return new org.bukkit.craftbukkit.inventory.CraftBlockInventoryHolder(this, menu.getBukkitView().getTopInventory()); + return new org.bukkit.craftbukkit.inventory.CraftBlockInventoryHolder(this, menu.getBukkitView().getTopInventory());
+ } + }
+ // Paper end + // Paper end - Add missing InventoryHolders
ContainerLevelAccess NULL = new ContainerLevelAccess() { ContainerLevelAccess NULL = new ContainerLevelAccess() {
@Override @Override
@ -138,17 +138,17 @@ index f00a957a0f55e69f93e6d7dc80193304447c3dcb..d2f19b44ce4ab663a68ee330de4d4582
return pos; return pos;
} }
// CraftBukkit end // CraftBukkit end
+ // Paper start + // Paper start - Add missing InventoryHolders
+ @Override + @Override
+ public boolean isBlock() { + public boolean isBlock() {
+ return true; + return true;
+ } + }
+ // Paper end + // Paper end - Add missing InventoryHolders
@Override @Override
public <T> Optional<T> evaluate(BiFunction<Level, BlockPos, T> getter) { public <T> Optional<T> evaluate(BiFunction<Level, BlockPos, T> getter) {
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
index c2d6265933dc4ceed80e2bd517970d02164a63df..c5c509fbb915c60dfa95aac8510684d0b9f8b0ff 100644 index c2d6265933dc4ceed80e2bd517970d02164a63df..343f44db579839eb61376f876b5eff2e615dc2e5 100644
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java --- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
@@ -61,7 +61,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { @@ -61,7 +61,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
@ -156,12 +156,12 @@ index c2d6265933dc4ceed80e2bd517970d02164a63df..c5c509fbb915c60dfa95aac8510684d0
public EnchantmentMenu(int syncId, Inventory playerInventory, ContainerLevelAccess context) { public EnchantmentMenu(int syncId, Inventory playerInventory, ContainerLevelAccess context) {
super(MenuType.ENCHANTMENT, syncId); super(MenuType.ENCHANTMENT, syncId);
- this.enchantSlots = new SimpleContainer(2) { - this.enchantSlots = new SimpleContainer(2) {
+ this.enchantSlots = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper + this.enchantSlots = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper - Add missing InventoryHolders
@Override @Override
public void setChanged() { public void setChanged() {
super.setChanged(); super.setChanged();
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index 24187a7ce812cb83a9a736bec8dce9e68ccc0798..076c2b2938c9b88b7e71dbc2aa9d8c7e90d4fe75 100644 index 24187a7ce812cb83a9a736bec8dce9e68ccc0798..4acad717bfec91e4abcdd59900e6872838d0712c 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -59,8 +59,8 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -59,8 +59,8 @@ public class GrindstoneMenu extends AbstractContainerMenu {
@ -170,13 +170,13 @@ index 24187a7ce812cb83a9a736bec8dce9e68ccc0798..076c2b2938c9b88b7e71dbc2aa9d8c7e
super(MenuType.GRINDSTONE, syncId); super(MenuType.GRINDSTONE, syncId);
- this.resultSlots = new ResultContainer(); - this.resultSlots = new ResultContainer();
- this.repairSlots = new SimpleContainer(2) { - this.repairSlots = new SimpleContainer(2) {
+ this.resultSlots = new ResultContainer(this.createBlockHolder(context)); // Paper + this.resultSlots = new ResultContainer(this.createBlockHolder(context)); // Paper - Add missing InventoryHolders
+ this.repairSlots = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper + this.repairSlots = new SimpleContainer(this.createBlockHolder(context), 2) { // Paper - Add missing InventoryHolders
@Override @Override
public void setChanged() { public void setChanged() {
super.setChanged(); super.setChanged();
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
index ff770b9ce68a62418de0c7ed389650626fa1dcb2..c2cf5a8e788637c6264cf43d712a5be223ff1cc5 100644 index ff770b9ce68a62418de0c7ed389650626fa1dcb2..e5a7f36843d621e6c714ef2e1cb8e2e3551924ef 100644
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java --- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
@@ -18,7 +18,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { @@ -18,7 +18,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
@ -184,7 +184,7 @@ index ff770b9ce68a62418de0c7ed389650626fa1dcb2..c2cf5a8e788637c6264cf43d712a5be2
protected final Container inputSlots; protected final Container inputSlots;
private final List<Integer> inputSlotIndexes; private final List<Integer> inputSlotIndexes;
- protected final ResultContainer resultSlots = new ResultContainer(); - protected final ResultContainer resultSlots = new ResultContainer();
+ protected final ResultContainer resultSlots; // Paper - delay field init + protected final ResultContainer resultSlots; // Paper - Add missing InventoryHolders; delay field init
private final int resultSlotIndex; private final int resultSlotIndex;
protected abstract boolean mayPickup(Player player, boolean present); protected abstract boolean mayPickup(Player player, boolean present);
@ -192,7 +192,7 @@ index ff770b9ce68a62418de0c7ed389650626fa1dcb2..c2cf5a8e788637c6264cf43d712a5be2
public ItemCombinerMenu(@Nullable MenuType<?> type, int syncId, Inventory playerInventory, ContainerLevelAccess context) { public ItemCombinerMenu(@Nullable MenuType<?> type, int syncId, Inventory playerInventory, ContainerLevelAccess context) {
super(type, syncId); super(type, syncId);
this.access = context; this.access = context;
+ this.resultSlots = new ResultContainer(this.createBlockHolder(this.access)); // Paper - delay field init + this.resultSlots = new ResultContainer(this.createBlockHolder(this.access)); // Paper - Add missing InventoryHolders; delay field init
this.player = playerInventory.player; this.player = playerInventory.player;
ItemCombinerMenuSlotDefinition itemcombinermenuslotdefinition = this.createInputSlotDefinitions(); ItemCombinerMenuSlotDefinition itemcombinermenuslotdefinition = this.createInputSlotDefinitions();
@ -201,12 +201,12 @@ index ff770b9ce68a62418de0c7ed389650626fa1dcb2..c2cf5a8e788637c6264cf43d712a5be2
private SimpleContainer createContainer(int size) { private SimpleContainer createContainer(int size) {
- return new SimpleContainer(size) { - return new SimpleContainer(size) {
+ return new SimpleContainer(this.createBlockHolder(this.access), size) { // Paper + return new SimpleContainer(this.createBlockHolder(this.access), size) { // Paper - Add missing InventoryHolders
@Override @Override
public void setChanged() { public void setChanged() {
super.setChanged(); super.setChanged();
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index e28c1cdf4763e9db3e29b3c0f08d65f978017931..146006af2af0881de199a0607a1b8f33de4c3f4f 100644 index e28c1cdf4763e9db3e29b3c0f08d65f978017931..c70af9c36ab5806643b050554d7d27a1e2db2028 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java --- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -73,7 +73,7 @@ public class LoomMenu extends AbstractContainerMenu { @@ -73,7 +73,7 @@ public class LoomMenu extends AbstractContainerMenu {
@ -214,7 +214,7 @@ index e28c1cdf4763e9db3e29b3c0f08d65f978017931..146006af2af0881de199a0607a1b8f33
this.slotUpdateListener = () -> { this.slotUpdateListener = () -> {
}; };
- this.inputContainer = new SimpleContainer(3) { - this.inputContainer = new SimpleContainer(3) {
+ this.inputContainer = new SimpleContainer(this.createBlockHolder(context), 3) { // Paper + this.inputContainer = new SimpleContainer(this.createBlockHolder(context), 3) { // Paper - Add missing InventoryHolders
@Override @Override
public void setChanged() { public void setChanged() {
super.setChanged(); super.setChanged();
@ -223,12 +223,12 @@ index e28c1cdf4763e9db3e29b3c0f08d65f978017931..146006af2af0881de199a0607a1b8f33
// CraftBukkit end // CraftBukkit end
}; };
- this.outputContainer = new SimpleContainer(1) { - this.outputContainer = new SimpleContainer(1) {
+ this.outputContainer = new SimpleContainer(this.createBlockHolder(context), 1) { // Paper + this.outputContainer = new SimpleContainer(this.createBlockHolder(context), 1) { // Paper - Add missing InventoryHolders
@Override @Override
public void setChanged() { public void setChanged() {
super.setChanged(); super.setChanged();
diff --git a/src/main/java/net/minecraft/world/inventory/ResultContainer.java b/src/main/java/net/minecraft/world/inventory/ResultContainer.java diff --git a/src/main/java/net/minecraft/world/inventory/ResultContainer.java b/src/main/java/net/minecraft/world/inventory/ResultContainer.java
index d4592218d761eb38402e3d95c642e80a708cb333..3e268c4d93241fad72a366c8c8f477e650d5a3db 100644 index d4592218d761eb38402e3d95c642e80a708cb333..4c4266a85c38e41e6c7e6144a68624f4daa50c54 100644
--- a/src/main/java/net/minecraft/world/inventory/ResultContainer.java --- a/src/main/java/net/minecraft/world/inventory/ResultContainer.java
+++ b/src/main/java/net/minecraft/world/inventory/ResultContainer.java +++ b/src/main/java/net/minecraft/world/inventory/ResultContainer.java
@@ -29,7 +29,12 @@ public class ResultContainer implements Container, RecipeCraftingHolder { @@ -29,7 +29,12 @@ public class ResultContainer implements Container, RecipeCraftingHolder {
@ -236,12 +236,12 @@ index d4592218d761eb38402e3d95c642e80a708cb333..3e268c4d93241fad72a366c8c8f477e6
public org.bukkit.inventory.InventoryHolder getOwner() { public org.bukkit.inventory.InventoryHolder getOwner() {
- return null; // Result slots don't get an owner - return null; // Result slots don't get an owner
+ // Paper start + // Paper start - Add missing InventoryHolders
+ if (this.holder == null && this.holderCreator != null) { + if (this.holder == null && this.holderCreator != null) {
+ this.holder = this.holderCreator.get(); + this.holder = this.holderCreator.get();
+ } + }
+ return this.holder; // Result slots don't get an owner + return this.holder; // Result slots don't get an owner
+ // Paper end - yes they do + // Paper end - Add missing InventoryHolders
} }
// Don't need a transaction; the InventoryCrafting keeps track of it for us // Don't need a transaction; the InventoryCrafting keeps track of it for us
@ -249,19 +249,19 @@ index d4592218d761eb38402e3d95c642e80a708cb333..3e268c4d93241fad72a366c8c8f477e6
return null; return null;
} }
// CraftBukkit end // CraftBukkit end
+ // Paper start + // Paper start - Add missing InventoryHolders
+ private @Nullable java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> holderCreator; + private @Nullable java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> holderCreator;
+ private @Nullable org.bukkit.inventory.InventoryHolder holder; + private @Nullable org.bukkit.inventory.InventoryHolder holder;
+ public ResultContainer(java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> holderCreator) { + public ResultContainer(java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> holderCreator) {
+ this(); + this();
+ this.holderCreator = holderCreator; + this.holderCreator = holderCreator;
+ } + }
+ // Paper end + // Paper end - Add missing InventoryHolders
public ResultContainer() { public ResultContainer() {
this.itemStacks = NonNullList.withSize(1, ItemStack.EMPTY); this.itemStacks = NonNullList.withSize(1, ItemStack.EMPTY);
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index aa1d1466d0a7b76967a41d948b7a4114fe06242f..f8129dcdcae12ed66ec58e8c749fa88ec3cd85d8 100644 index aa1d1466d0a7b76967a41d948b7a4114fe06242f..d6b9de312f67269e1e4b7bb5200ce8a0be674602 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java --- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java +++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -68,7 +68,7 @@ public class StonecutterMenu extends AbstractContainerMenu { @@ -68,7 +68,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
@ -269,7 +269,7 @@ index aa1d1466d0a7b76967a41d948b7a4114fe06242f..f8129dcdcae12ed66ec58e8c749fa88e
this.slotUpdateListener = () -> { this.slotUpdateListener = () -> {
}; };
- this.container = new SimpleContainer(1) { - this.container = new SimpleContainer(1) {
+ this.container = new SimpleContainer(this.createBlockHolder(context), 1) { // Paper + this.container = new SimpleContainer(this.createBlockHolder(context), 1) { // Paper - Add missing InventoryHolders
@Override @Override
public void setChanged() { public void setChanged() {
super.setChanged(); super.setChanged();
@ -278,25 +278,25 @@ index aa1d1466d0a7b76967a41d948b7a4114fe06242f..f8129dcdcae12ed66ec58e8c749fa88e
// CraftBukkit end // CraftBukkit end
}; };
- this.resultContainer = new ResultContainer(); - this.resultContainer = new ResultContainer();
+ this.resultContainer = new ResultContainer(this.createBlockHolder(context)); // Paper + this.resultContainer = new ResultContainer(this.createBlockHolder(context)); // Paper - Add missing InventoryHolders
this.access = context; this.access = context;
this.level = playerInventory.player.level(); this.level = playerInventory.player.level();
this.inputSlot = this.addSlot(new Slot(this.container, 0, 20, 33)); this.inputSlot = this.addSlot(new Slot(this.container, 0, 20, 33));
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java
index 7ae484b0fa5bf5494c6ead15f7f1c0fa840ae270..04585d2bc27dc8a165238ee9d2612e179b66fb63 100644 index 7ae484b0fa5bf5494c6ead15f7f1c0fa840ae270..7129eb5f5cea39992b4c690cb421004004a952ea 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftBlockInventoryHolder.java
@@ -17,6 +17,13 @@ public class CraftBlockInventoryHolder implements BlockInventoryHolder { @@ -17,6 +17,13 @@ public class CraftBlockInventoryHolder implements BlockInventoryHolder {
this.block = CraftBlock.at(world, pos); this.block = CraftBlock.at(world, pos);
this.inventory = new CraftInventory(inv); this.inventory = new CraftInventory(inv);
} }
+ // Paper start + // Paper start - Add missing InventoryHolders
+ public CraftBlockInventoryHolder(net.minecraft.world.inventory.ContainerLevelAccess levelAccess, Inventory inventory) { + public CraftBlockInventoryHolder(net.minecraft.world.inventory.ContainerLevelAccess levelAccess, Inventory inventory) {
+ com.google.common.base.Preconditions.checkArgument(levelAccess.isBlock()); + com.google.common.base.Preconditions.checkArgument(levelAccess.isBlock());
+ this.block = CraftBlock.at(levelAccess.getWorld(), levelAccess.getPosition()); + this.block = CraftBlock.at(levelAccess.getWorld(), levelAccess.getPosition());
+ this.inventory = inventory; + this.inventory = inventory;
+ } + }
+ // Paper end + // Paper end - Add missing InventoryHolders
@Override @Override
public Block getBlock() { public Block getBlock() {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add missing logs for log-ips config option
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
index d4f5a98a0b1ca9f2a8baa6e0b27353df94d1f333..8f4a964a0863b1be834c1ea1e3d49092516f9258 100644 index d4f5a98a0b1ca9f2a8baa6e0b27353df94d1f333..569516822319c885e76be1aa92580bdf0bc932f5 100644
--- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java --- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
+++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java +++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
@@ -50,7 +50,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter { @@ -50,7 +50,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
@ -13,7 +13,7 @@ index d4f5a98a0b1ca9f2a8baa6e0b27353df94d1f333..8f4a964a0863b1be834c1ea1e3d49092
if (i == 0) { if (i == 0) {
- LegacyQueryHandler.LOGGER.debug("Ping: (<1.3.x) from {}", socketaddress); - LegacyQueryHandler.LOGGER.debug("Ping: (<1.3.x) from {}", socketaddress);
+ LegacyQueryHandler.LOGGER.debug("Ping: (<1.3.x) from {}", net.minecraft.server.MinecraftServer.getServer().logIPs() ? socketaddress: "<ip address withheld>"); // Paper + LegacyQueryHandler.LOGGER.debug("Ping: (<1.3.x) from {}", net.minecraft.server.MinecraftServer.getServer().logIPs() ? socketaddress: "<ip address withheld>"); // Paper - Respect logIPs option
// Paper start - Call PaperServerListPingEvent and use results // Paper start - Call PaperServerListPingEvent and use results
event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(net.minecraft.server.MinecraftServer.getServer(), (java.net.InetSocketAddress) socketaddress, 39, null); event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(net.minecraft.server.MinecraftServer.getServer(), (java.net.InetSocketAddress) socketaddress, 39, null);
@ -22,7 +22,7 @@ index d4f5a98a0b1ca9f2a8baa6e0b27353df94d1f333..8f4a964a0863b1be834c1ea1e3d49092
// Paper end // Paper end
} else { } else {
- LegacyQueryHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}", socketaddress); - LegacyQueryHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}", socketaddress);
+ LegacyQueryHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}", net.minecraft.server.MinecraftServer.getServer().logIPs() ? socketaddress: "<ip address withheld>"); // Paper + LegacyQueryHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}", net.minecraft.server.MinecraftServer.getServer().logIPs() ? socketaddress: "<ip address withheld>"); // Paper - Respect logIPs option
} }
if (s == null) { if (s == null) {
@ -31,7 +31,7 @@ index d4f5a98a0b1ca9f2a8baa6e0b27353df94d1f333..8f4a964a0863b1be834c1ea1e3d49092
this.buf = null; this.buf = null;
- LOGGER.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress()); - LOGGER.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress());
+ LOGGER.debug("Ping: (1.6) from {}", net.minecraft.server.MinecraftServer.getServer().logIPs() ? ctx.channel().remoteAddress(): "<ip address withheld>"); // Paper + LOGGER.debug("Ping: (1.6) from {}", net.minecraft.server.MinecraftServer.getServer().logIPs() ? ctx.channel().remoteAddress(): "<ip address withheld>"); // Paper - Respect logIPs option
java.net.InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port); java.net.InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port);
com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest( com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(

Datei anzeigen

@ -9,7 +9,7 @@ class to quickly retrieve nearby players instead of possible
searching all players on the server. searching all players on the server.
diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
index c3ce8a42dddd76b7189ad5685b23f9d9f8ccadb3..17ba07cbd4792f63d88ce29d00da280f30c4abff 100644 index c3ce8a42dddd76b7189ad5685b23f9d9f8ccadb3..f164256d59b761264876ca0c85f812d101bfd5de 100644
--- a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java --- a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
+++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java +++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
@@ -17,7 +17,8 @@ public final class NearbyPlayers { @@ -17,7 +17,8 @@ public final class NearbyPlayers {
@ -39,12 +39,12 @@ index c3ce8a42dddd76b7189ad5685b23f9d9f8ccadb3..17ba07cbd4792f63d88ce29d00da280f
players[NearbyMapType.GENERAL_REALLY_SMALL.ordinal()].update(chunk.x, chunk.z, GENERAL_REALLY_SMALL_VIEW_DISTANCE); players[NearbyMapType.GENERAL_REALLY_SMALL.ordinal()].update(chunk.x, chunk.z, GENERAL_REALLY_SMALL_VIEW_DISTANCE);
players[NearbyMapType.TICK_VIEW_DISTANCE.ordinal()].update(chunk.x, chunk.z, ChunkSystem.getTickViewDistance(player)); players[NearbyMapType.TICK_VIEW_DISTANCE.ordinal()].update(chunk.x, chunk.z, ChunkSystem.getTickViewDistance(player));
players[NearbyMapType.VIEW_DISTANCE.ordinal()].update(chunk.x, chunk.z, ChunkSystem.getLoadViewDistance(player)); players[NearbyMapType.VIEW_DISTANCE.ordinal()].update(chunk.x, chunk.z, ChunkSystem.getLoadViewDistance(player));
+ players[NearbyMapType.SPAWN_RANGE.ordinal()].update(chunk.x, chunk.z, SPAWN_RANGE_VIEW_DISTANCE); + players[NearbyMapType.SPAWN_RANGE.ordinal()].update(chunk.x, chunk.z, SPAWN_RANGE_VIEW_DISTANCE); // Paper - optimise chunk iteration
} }
public TrackedChunk getChunk(final ChunkPos pos) { public TrackedChunk getChunk(final ChunkPos pos) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..5afeb59ff25fed2d565407acacffec8383398006 100644 index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754b4fcd1e8 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -79,11 +79,19 @@ public class ChunkHolder { @@ -79,11 +79,19 @@ public class ChunkHolder {
@ -103,12 +103,12 @@ index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..5afeb59ff25fed2d565407acacffec83
+ +
public void broadcastChanges(LevelChunk chunk) { public void broadcastChanges(LevelChunk chunk) {
- if (this.hasChangedSections || !this.skyChangedLightSectionFilter.isEmpty() || !this.blockChangedLightSectionFilter.isEmpty()) { - if (this.hasChangedSections || !this.skyChangedLightSectionFilter.isEmpty() || !this.blockChangedLightSectionFilter.isEmpty()) {
+ if (this.needsBroadcastChanges()) { // Paper - moved into above, other logic needs to call + if (this.needsBroadcastChanges()) { // Paper - optimise chunk tick iteration; moved into above, other logic needs to call
Level world = chunk.getLevel(); Level world = chunk.getLevel();
List list; List list;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 0405bc1e17975a74af3d56edf34354f5cb553a1c..d08b4ff04362a5a9add88d060beb48e4119b594d 100644 index 0405bc1e17975a74af3d56edf34354f5cb553a1c..71606bca60410c8ab6fd6427dc11e35614928702 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -191,6 +191,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -191,6 +191,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -135,7 +135,7 @@ index 0405bc1e17975a74af3d56edf34354f5cb553a1c..d08b4ff04362a5a9add88d060beb48e4
// Paper end // Paper end
- private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { - private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) {
+ public static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { // Paper - optimise chunk iteration - public + public static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { // Paper - optimise chunk iteration; public
double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8);
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8);
double d2 = d0 - entity.getX(); double d2 = d0 - entity.getX();

Datei anzeigen

@ -65,7 +65,7 @@ index cc1c077c3e91d1f8852fcd6ea939864cfce398a8..4634f4fbb0c06c68436c5e30069621c9
if (this.hasDelayedDestroy) { if (this.hasDelayedDestroy) {
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 3ce5c06a6c154c0b8c9f2aaaa0a2f9d092cc4551..12d4ab6aa349e3f465cc88a2717243ff5064df02 100644 index 3ce5c06a6c154c0b8c9f2aaaa0a2f9d092cc4551..c5a07b414da0209035f3f186f72a8913243187be 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
@@ -3818,6 +3818,10 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3818,6 +3818,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -89,7 +89,7 @@ index 3ce5c06a6c154c0b8c9f2aaaa0a2f9d092cc4551..12d4ab6aa349e3f465cc88a2717243ff
+ boolean shouldLagCompensate = this.useItem.getItem().isEdible() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000)); + boolean shouldLagCompensate = this.useItem.getItem().isEdible() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000));
+ if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level().isClientSide && !stack.useOnRelease()) { + if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level().isClientSide && !stack.useOnRelease()) {
+ this.useItemRemaining = 0; + this.useItemRemaining = 0;
+ // Paper end + // Paper end - lag compensate eating
this.completeUsingItem(); this.completeUsingItem();
} }
@ -101,7 +101,7 @@ index 3ce5c06a6c154c0b8c9f2aaaa0a2f9d092cc4551..12d4ab6aa349e3f465cc88a2717243ff
+ // Paper start - lag compensate eating + // Paper start - lag compensate eating
+ this.useItemRemaining = this.totalEatTimeTicks = itemstack.getUseDuration(); + this.useItemRemaining = this.totalEatTimeTicks = itemstack.getUseDuration();
+ this.eatStartTime = System.nanoTime(); + this.eatStartTime = System.nanoTime();
+ // Paper end + // Paper end - lag compensate eating
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(1, true);
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
@ -113,7 +113,7 @@ index 3ce5c06a6c154c0b8c9f2aaaa0a2f9d092cc4551..12d4ab6aa349e3f465cc88a2717243ff
+ // Paper start - lag compensate eating + // Paper start - lag compensate eating
+ this.useItemRemaining = this.totalEatTimeTicks = 0; + this.useItemRemaining = this.totalEatTimeTicks = 0;
+ this.eatStartTime = -1L; + this.eatStartTime = -1L;
+ // Paper end + // Paper end - lag compensate eating
} }
} }
@ -125,7 +125,7 @@ index 3ce5c06a6c154c0b8c9f2aaaa0a2f9d092cc4551..12d4ab6aa349e3f465cc88a2717243ff
+ // Paper start - lag compensate eating + // Paper start - lag compensate eating
+ this.useItemRemaining = this.totalEatTimeTicks = 0; + this.useItemRemaining = this.totalEatTimeTicks = 0;
+ this.eatStartTime = -1L; + this.eatStartTime = -1L;
+ // Paper end + // Paper end - lag compensate eating
} }
public boolean isBlocking() { public boolean isBlocking() {

Datei anzeigen

@ -141,14 +141,14 @@ index 58422f00c7d64dbd1cf6d7211c9838875cbe7778..c157309ac78e7af084d3acb6e8b2bcd4
private boolean testInvisible = true; private boolean testInvisible = true;
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
index b3293a722fb5c5262a777402140c764c03367800..aaa07fcd4b32fe0de88142ab30378327a01f1729 100644 index b3293a722fb5c5262a777402140c764c03367800..bb685325e6cb2ac5ddccfca8602013e38b4a4891 100644
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java --- a/src/main/java/net/minecraft/world/level/EntityGetter.java
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
@@ -230,9 +230,13 @@ public interface EntityGetter { @@ -230,9 +230,13 @@ public interface EntityGetter {
T livingEntity = null; T livingEntity = null;
for(T livingEntity2 : entityList) { for(T livingEntity2 : entityList) {
+ // Paper start - move up + // Paper start - optimise nearby player retrieval; move up
+ // don't check entities outside closest range + // don't check entities outside closest range
+ double e = livingEntity2.distanceToSqr(x, y, z); + double e = livingEntity2.distanceToSqr(x, y, z);
+ if (d == -1.0D || e < d) { + if (d == -1.0D || e < d) {
@ -156,7 +156,7 @@ index b3293a722fb5c5262a777402140c764c03367800..aaa07fcd4b32fe0de88142ab30378327
if (targetPredicate.test(entity, livingEntity2)) { if (targetPredicate.test(entity, livingEntity2)) {
- double e = livingEntity2.distanceToSqr(x, y, z); - double e = livingEntity2.distanceToSqr(x, y, z);
- if (d == -1.0D || e < d) { - if (d == -1.0D || e < d) {
+ // Paper - move up + // Paper - optimise nearby player retrieval; move up
d = e; d = e;
livingEntity = livingEntity2; livingEntity = livingEntity2;
} }

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Remove streams for villager AI
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
index b45c4f50705f80163d44d9e588f86a5770f5be38..879e16d4c881a97f95eeff8016f9900d6cfe10c2 100644 index b45c4f50705f80163d44d9e588f86a5770f5be38..64165fed12c6c76d4ceb36d69f47a1235c1e8e44 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
@@ -52,7 +52,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> @@ -52,7 +52,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
@ -13,7 +13,7 @@ index b45c4f50705f80163d44d9e588f86a5770f5be38..879e16d4c881a97f95eeff8016f9900d
this.status = Behavior.Status.RUNNING; this.status = Behavior.Status.RUNNING;
this.orderPolicy.apply(this.behaviors); this.orderPolicy.apply(this.behaviors);
- this.runningPolicy.apply(this.behaviors.stream(), world, entity, time); - this.runningPolicy.apply(this.behaviors.stream(), world, entity, time);
+ this.runningPolicy.apply(this.behaviors.entries, world, entity, time); + this.runningPolicy.apply(this.behaviors.entries, world, entity, time); // Paper - Remove streams
return true; return true;
} else { } else {
return false; return false;
@ -26,13 +26,13 @@ index b45c4f50705f80163d44d9e588f86a5770f5be38..879e16d4c881a97f95eeff8016f9900d
- }).forEach((task) -> { - }).forEach((task) -> {
- task.tickOrStop(world, entity, time); - task.tickOrStop(world, entity, time);
- }); - });
+ // Paper start + // Paper start - Remove streams
+ for (BehaviorControl<? super E> task : this.behaviors) { + for (BehaviorControl<? super E> task : this.behaviors) {
+ if (task.getStatus() == Behavior.Status.RUNNING) { + if (task.getStatus() == Behavior.Status.RUNNING) {
+ task.tickOrStop(world, entity, time); + task.tickOrStop(world, entity, time);
+ } + }
+ } + }
+ // Paper end + // Paper end - Remove streams
if (this.behaviors.stream().noneMatch((task) -> { if (this.behaviors.stream().noneMatch((task) -> {
return task.getStatus() == Behavior.Status.RUNNING; return task.getStatus() == Behavior.Status.RUNNING;
})) { })) {
@ -45,13 +45,13 @@ index b45c4f50705f80163d44d9e588f86a5770f5be38..879e16d4c881a97f95eeff8016f9900d
- }).forEach((task) -> { - }).forEach((task) -> {
- task.doStop(world, entity, time); - task.doStop(world, entity, time);
- }); - });
+ // Paper start + // Paper start - Remove streams
+ for (BehaviorControl<? super E> behavior : this.behaviors) { + for (BehaviorControl<? super E> behavior : this.behaviors) {
+ if (behavior.getStatus() == Behavior.Status.RUNNING) { + if (behavior.getStatus() == Behavior.Status.RUNNING) {
+ behavior.doStop(world, entity, time); + behavior.doStop(world, entity, time);
+ } + }
+ } + }
+ // Paper end + // Paper end - Remove streams
this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory); this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory);
} }
@ -65,7 +65,7 @@ index b45c4f50705f80163d44d9e588f86a5770f5be38..879e16d4c881a97f95eeff8016f9900d
- }).filter((task) -> { - }).filter((task) -> {
- return task.tryStart(world, entity, time); - return task.tryStart(world, entity, time);
- }).findFirst(); - }).findFirst();
+ // Paper start - remove streams + // Paper start - Remove streams
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time) { + public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time) {
+ for (ShufflingList.WeightedEntry<BehaviorControl<? super E>> task : tasks) { + for (ShufflingList.WeightedEntry<BehaviorControl<? super E>> task : tasks) {
+ final BehaviorControl<? super E> behavior = task.getData(); + final BehaviorControl<? super E> behavior = task.getData();
@ -73,7 +73,7 @@ index b45c4f50705f80163d44d9e588f86a5770f5be38..879e16d4c881a97f95eeff8016f9900d
+ break; + break;
+ } + }
+ } + }
+ // Paper end - remove streams + // Paper end - Remove streams
} }
}, },
TRY_ALL { TRY_ALL {
@ -84,7 +84,7 @@ index b45c4f50705f80163d44d9e588f86a5770f5be38..879e16d4c881a97f95eeff8016f9900d
- }).forEach((task) -> { - }).forEach((task) -> {
- task.tryStart(world, entity, time); - task.tryStart(world, entity, time);
- }); - });
+ // Paper start - remove streams + // Paper start - Remove streams
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time) { + public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time) {
+ for (ShufflingList.WeightedEntry<BehaviorControl<? super E>> task : tasks) { + for (ShufflingList.WeightedEntry<BehaviorControl<? super E>> task : tasks) {
+ final BehaviorControl<? super E> behavior = task.getData(); + final BehaviorControl<? super E> behavior = task.getData();
@ -92,12 +92,12 @@ index b45c4f50705f80163d44d9e588f86a5770f5be38..879e16d4c881a97f95eeff8016f9900d
+ behavior.tryStart(world, entity, time); + behavior.tryStart(world, entity, time);
+ } + }
+ } + }
+ // Paper end - remove streams + // Paper end - Remove streams
} }
}; };
- public abstract <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time); - public abstract <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time);
+ public abstract <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time); // Paper - remove streams + public abstract <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time); // Paper - Remove streams
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
@ -114,7 +114,7 @@ index 731ef21dbbd25d6924717de42f4569a9b5935643..fe3ab3d388f0481fb0db06b7f730f868
private final boolean isUnsafe; // Paper private final boolean isUnsafe; // Paper
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java
index 1dfcc5cba6ffb463acf161a23fff1ca452184290..61a164c5bfc86faa3f4d04a66e0257016cfd937d 100644 index 1dfcc5cba6ffb463acf161a23fff1ca452184290..9958690971a2f14bfdb8841e466fa783452c5b0c 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java
@@ -25,13 +25,16 @@ public class NearestItemSensor extends Sensor<Mob> { @@ -25,13 +25,16 @@ public class NearestItemSensor extends Sensor<Mob> {
@ -126,7 +126,7 @@ index 1dfcc5cba6ffb463acf161a23fff1ca452184290..61a164c5bfc86faa3f4d04a66e025701
}); });
- list.sort(Comparator.comparingDouble(entity::distanceToSqr)); - list.sort(Comparator.comparingDouble(entity::distanceToSqr));
+ list.sort((e1, e2) -> Double.compare(entity.distanceToSqr(e1), entity.distanceToSqr(e2))); // better to take the sort perf hit than using line of sight more than we need to. + list.sort((e1, e2) -> Double.compare(entity.distanceToSqr(e1), entity.distanceToSqr(e2))); // better to take the sort perf hit than using line of sight more than we need to.
+ // Paper start - remove streams + // Paper start - Remove streams
// Paper start - remove streams in favour of lists // Paper start - remove streams in favour of lists
ItemEntity nearest = null; ItemEntity nearest = null;
- for (ItemEntity entityItem : list) { - for (ItemEntity entityItem : list) {
@ -134,7 +134,7 @@ index 1dfcc5cba6ffb463acf161a23fff1ca452184290..61a164c5bfc86faa3f4d04a66e025701
+ for (int i = 0; i < list.size(); i++) { + for (int i = 0; i < list.size(); i++) {
+ ItemEntity entityItem = list.get(i); + ItemEntity entityItem = list.get(i);
+ if (entity.hasLineOfSight(entityItem)) { + if (entity.hasLineOfSight(entityItem)) {
+ // Paper end - remove streams + // Paper end - Remove streams
nearest = entityItem; nearest = entityItem;
break; break;
} }

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Fix missing map initialize event call
public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData; public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData;
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 ba5b86211b02fc5a90d1e3443afbd1e41fc1dbf1..af712365d676bc33314b5a3fc6ff8ae823dc3012 100644 index ba5b86211b02fc5a90d1e3443afbd1e41fc1dbf1..6ff5898846ef2d985f5ce630db9a31c4ad75ca66 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
@@ -2133,13 +2133,25 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2133,13 +2133,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -18,7 +18,7 @@ index ba5b86211b02fc5a90d1e3443afbd1e41fc1dbf1..af712365d676bc33314b5a3fc6ff8ae8
- MapItemSavedData worldmap = (MapItemSavedData) this.getServer().overworld().getDataStorage().get(MapItemSavedData.factory(), id); - MapItemSavedData worldmap = (MapItemSavedData) this.getServer().overworld().getDataStorage().get(MapItemSavedData.factory(), id);
- if (worldmap != null) { - if (worldmap != null) {
- worldmap.id = id; - worldmap.id = id;
+ // Paper start - Call missing map initialize event & set id + // Paper start - Call missing map initialize event and set id
+ final DimensionDataStorage storage = this.getServer().overworld().getDataStorage(); + final DimensionDataStorage storage = this.getServer().overworld().getDataStorage();
+ +
+ final net.minecraft.world.level.saveddata.SavedData existing = storage.cache.get(id); + final net.minecraft.world.level.saveddata.SavedData existing = storage.cache.get(id);
@ -38,7 +38,7 @@ index ba5b86211b02fc5a90d1e3443afbd1e41fc1dbf1..af712365d676bc33314b5a3fc6ff8ae8
- // CraftBukkit end - // CraftBukkit end
+ +
+ return existing instanceof MapItemSavedData data ? data : null; + return existing instanceof MapItemSavedData data ? data : null;
+ // Paper end + // Paper end - Call missing map initialize event and set id
} }
@Override @Override

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Update entity data when attaching firework to entity
public net.minecraft.world.entity.projectile.FireworkRocketEntity DATA_ATTACHED_TO_TARGET public net.minecraft.world.entity.projectile.FireworkRocketEntity DATA_ATTACHED_TO_TARGET
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index 13b09465952dca2e95647ddb9753a7fe2db51720..c13cdbaf7abdf120a3969f8e887b4c3b78989c9c 100644 index 13b09465952dca2e95647ddb9753a7fe2db51720..8694c0dd606ec4e0fd60be434f70860e7779a871 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -69,6 +69,10 @@ public class CraftFirework extends CraftProjectile implements Firework { @@ -69,6 +69,10 @@ public class CraftFirework extends CraftProjectile implements Firework {
@ -17,7 +17,7 @@ index 13b09465952dca2e95647ddb9753a7fe2db51720..c13cdbaf7abdf120a3969f8e887b4c3b
+ // Paper start - update entity data + // Paper start - update entity data
+ this.getHandle().getEntityData().set(FireworkRocketEntity.DATA_ATTACHED_TO_TARGET, + this.getHandle().getEntityData().set(FireworkRocketEntity.DATA_ATTACHED_TO_TARGET,
+ entity != null ? java.util.OptionalInt.of(entity.getEntityId()) : java.util.OptionalInt.empty()); + entity != null ? java.util.OptionalInt.of(entity.getEntityId()) : java.util.OptionalInt.empty());
+ // Paper end + // Paper end - update entity data
return true; return true;
} }

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Use correct variable for initializing CraftLootTable
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
index 973b786368cf628815f099eefe968338c97c52ed..3b740b1fcada96a6fac18a22ea77d1d3ad2a9cce 100644 index 973b786368cf628815f099eefe968338c97c52ed..3ddf6ab00de2456ebf504985b88994f970e3b5c4 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java --- a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
@@ -103,7 +103,7 @@ public class LootDataManager implements PreparableReloadListener, LootDataResolv @@ -103,7 +103,7 @@ public class LootDataManager implements PreparableReloadListener, LootDataResolv
@ -13,7 +13,7 @@ index 973b786368cf628815f099eefe968338c97c52ed..3b740b1fcada96a6fac18a22ea77d1d3
// CraftBukkit start // CraftBukkit start
map1.forEach((key, lootTable) -> { map1.forEach((key, lootTable) -> {
- if (object instanceof LootTable table) { - if (object instanceof LootTable table) {
+ if (lootTable instanceof LootTable table) { // Paper - use correct variable + if (lootTable instanceof LootTable table) { // Paper - Use correct variable for initializing CraftLootTable
table.craftLootTable = new CraftLootTable(CraftNamespacedKey.fromMinecraft(key.location()), table); table.craftLootTable = new CraftLootTable(CraftNamespacedKey.fromMinecraft(key.location()), table);
} }
}); });

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Make setVelocity method of Fireballs change the travel
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
index 2783e218d5e5c24787429237974e196761f4d02b..774ed1fdc909c911bf93a1b720285b43e9f728b8 100644 index 2783e218d5e5c24787429237974e196761f4d02b..1d8aab2fda18c6e2bb30f6ba4a6325263267b628 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@@ -46,6 +46,18 @@ public class CraftFireball extends AbstractProjectile implements Fireball { @@ -46,6 +46,18 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
@ -23,7 +23,7 @@ index 2783e218d5e5c24787429237974e196761f4d02b..774ed1fdc909c911bf93a1b720285b43
+ this.getHandle().zPower = velocity.getZ(); + this.getHandle().zPower = velocity.getZ();
+ update(); + update();
+ } + }
+ // Paper end + // Paper end - set direction without normalizing
+ +
@Override @Override
public AbstractHurtingProjectile getHandle() { public AbstractHurtingProjectile getHandle() {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fix NPE in SculkBloomEvent world access
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
index ccb1db9649dfded891b308c346a6aeb870b61ce2..65112ec3a6ea1c27f032477720ae74395523012b 100644 index ccb1db9649dfded891b308c346a6aeb870b61ce2..83481539e058e5f428d9951e409fed62ef159e5c 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
@@ -32,9 +32,16 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi @@ -32,9 +32,16 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi
@ -15,13 +15,13 @@ index ccb1db9649dfded891b308c346a6aeb870b61ce2..65112ec3a6ea1c27f032477720ae7439
- this.catalystListener.level = this.level; // CraftBukkit - this.catalystListener.level = this.level; // CraftBukkit
} }
+ // Paper start + // Paper start - Fix NPE in SculkBloomEvent world access
+ @Override + @Override
+ public void setLevel(Level level) { + public void setLevel(Level level) {
+ super.setLevel(level); + super.setLevel(level);
+ this.catalystListener.sculkSpreader.level = level; + this.catalystListener.sculkSpreader.level = level;
+ } + }
+ // Paper end + // Paper end - Fix NPE in SculkBloomEvent world access
+ +
public static void serverTick(Level world, BlockPos pos, BlockState state, SculkCatalystBlockEntity blockEntity) { public static void serverTick(Level world, BlockPos pos, BlockState state, SculkCatalystBlockEntity blockEntity) {
org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = blockEntity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = blockEntity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep.
@ -37,7 +37,7 @@ index ccb1db9649dfded891b308c346a6aeb870b61ce2..65112ec3a6ea1c27f032477720ae7439
this.positionSource = positionSource; this.positionSource = positionSource;
this.sculkSpreader = SculkSpreader.createLevelSpreader(); this.sculkSpreader = SculkSpreader.createLevelSpreader();
- this.sculkSpreader.level = this.level; // CraftBukkit - this.sculkSpreader.level = this.level; // CraftBukkit
+ // this.sculkSpreader.level = this.level; // CraftBukkit // Paper - bad fix + // this.sculkSpreader.level = this.level; // CraftBukkit // Paper - Fix NPE in SculkBloomEvent world access
} }
@Override @Override

Datei anzeigen

@ -5,19 +5,19 @@ Subject: [PATCH] Add predicate for blocks when raytracing
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
index 799837c172a5f7856c78e6fe2595c575f3058a5e..7205865bbe0f83fb35678bddc0977f92980e77b5 100644 index 799837c172a5f7856c78e6fe2595c575f3058a5e..0abbe9be08cf7450f5d2d17deed590053c77a528 100644
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java --- a/src/main/java/net/minecraft/world/level/BlockGetter.java
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
@@ -83,6 +83,12 @@ public interface BlockGetter extends LevelHeightAccessor { @@ -83,6 +83,12 @@ public interface BlockGetter extends LevelHeightAccessor {
// CraftBukkit start - moved block handling into separate method for use by Block#rayTrace // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) { default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
+ // Paper start + // Paper start - Add predicate for blocks when raytracing
+ return clip(raytrace1, blockposition, null); + return clip(raytrace1, blockposition, null);
+ } + }
+ +
+ default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition, java.util.function.Predicate<? super org.bukkit.block.Block> canCollide) { + default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition, java.util.function.Predicate<? super org.bukkit.block.Block> canCollide) {
+ // Paper end + // Paper end - Add predicate for blocks when raytracing
// Paper start - Prevent raytrace from loading chunks // Paper start - Prevent raytrace from loading chunks
BlockState iblockdata = this.getBlockStateIfLoaded(blockposition); BlockState iblockdata = this.getBlockStateIfLoaded(blockposition);
if (iblockdata == null) { if (iblockdata == null) {
@ -34,27 +34,27 @@ index 799837c172a5f7856c78e6fe2595c575f3058a5e..7205865bbe0f83fb35678bddc0977f92
// CraftBukkit end // CraftBukkit end
default BlockHitResult clip(ClipContext context) { default BlockHitResult clip(ClipContext context) {
+ // Paper start + // Paper start - Add predicate for blocks when raytracing
+ return clip(context, (java.util.function.Predicate<org.bukkit.block.Block>) null); + return clip(context, (java.util.function.Predicate<org.bukkit.block.Block>) null);
+ } + }
+ +
+ default BlockHitResult clip(ClipContext context, java.util.function.Predicate<? super org.bukkit.block.Block> canCollide) { + default BlockHitResult clip(ClipContext context, java.util.function.Predicate<? super org.bukkit.block.Block> canCollide) {
+ // Paper end + // Paper end - Add predicate for blocks when raytracing
return (BlockHitResult) BlockGetter.traverseBlocks(context.getFrom(), context.getTo(), context, (raytrace1, blockposition) -> { return (BlockHitResult) BlockGetter.traverseBlocks(context.getFrom(), context.getTo(), context, (raytrace1, blockposition) -> {
- return this.clip(raytrace1, blockposition); // CraftBukkit - moved into separate method - return this.clip(raytrace1, blockposition); // CraftBukkit - moved into separate method
+ return this.clip(raytrace1, blockposition, canCollide); // CraftBukkit - moved into separate method // Paper - use method with canCollide predicate + return this.clip(raytrace1, blockposition, canCollide); // CraftBukkit - moved into separate method // Paper - Add predicate for blocks when raytracing
}, (raytrace1) -> { }, (raytrace1) -> {
Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo()); Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 4f89f38e1d2d9cdb34af8d1d217577e9a437eea5..5fc06ade042f96ae9f623b18faaa1069d769153f 100644 index 4f89f38e1d2d9cdb34af8d1d217577e9a437eea5..56ff02ebe9da504f2aa955430ac13b3dba4211f7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1125,9 +1125,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1125,9 +1125,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate<? super Entity> filter) { public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate<? super Entity> filter) {
+ // Paper start + // Paper start - Add predicate for blocks when raytracing
+ return rayTraceEntities((io.papermc.paper.math.Position) start, direction, maxDistance, raySize, filter); + return rayTraceEntities((io.papermc.paper.math.Position) start, direction, maxDistance, raySize, filter);
+ } + }
+ +
@ -64,7 +64,7 @@ index 4f89f38e1d2d9cdb34af8d1d217577e9a437eea5..5fc06ade042f96ae9f623b18faaa1069
- start.checkFinite(); - start.checkFinite();
+ Preconditions.checkArgument(!(start instanceof Location location) || this.equals(location.getWorld()), "Location start cannot be in a different world"); + Preconditions.checkArgument(!(start instanceof Location location) || this.equals(location.getWorld()), "Location start cannot be in a different world");
+ Preconditions.checkArgument(start.isFinite(), "Location start is not finite"); + Preconditions.checkArgument(start.isFinite(), "Location start is not finite");
+ // Paper end + // Paper end - Add predicate for blocks when raytracing
Preconditions.checkArgument(direction != null, "Vector direction cannot be null"); Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
direction.checkFinite(); direction.checkFinite();
@ -72,7 +72,7 @@ index 4f89f38e1d2d9cdb34af8d1d217577e9a437eea5..5fc06ade042f96ae9f623b18faaa1069
@Override @Override
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) { public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
+ // Paper start + // Paper start - Add predicate for blocks when raytracing
+ return this.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode, ignorePassableBlocks, null); + return this.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode, ignorePassableBlocks, null);
+ } + }
+ +
@ -83,7 +83,7 @@ index 4f89f38e1d2d9cdb34af8d1d217577e9a437eea5..5fc06ade042f96ae9f623b18faaa1069
- start.checkFinite(); - start.checkFinite();
+ Preconditions.checkArgument(!(start instanceof Location location) || this.equals(location.getWorld()), "Location start cannot be in a different world"); + Preconditions.checkArgument(!(start instanceof Location location) || this.equals(location.getWorld()), "Location start cannot be in a different world");
+ Preconditions.checkArgument(start.isFinite(), "Location start is not finite"); + Preconditions.checkArgument(start.isFinite(), "Location start is not finite");
+ // Paper end + // Paper end - Add predicate for blocks when raytracing
Preconditions.checkArgument(direction != null, "Vector direction cannot be null"); Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
direction.checkFinite(); direction.checkFinite();
@ -92,10 +92,10 @@ index 4f89f38e1d2d9cdb34af8d1d217577e9a437eea5..5fc06ade042f96ae9f623b18faaa1069
Vector dir = direction.clone().normalize().multiply(maxDistance); Vector dir = direction.clone().normalize().multiply(maxDistance);
- Vec3 startPos = CraftLocation.toVec3D(start); - Vec3 startPos = CraftLocation.toVec3D(start);
+ Vec3 startPos = io.papermc.paper.util.MCUtil.toVec3(start); // Paper + Vec3 startPos = io.papermc.paper.util.MCUtil.toVec3(start); // Paper - Add predicate for blocks when raytracing
Vec3 endPos = startPos.add(dir.getX(), dir.getY(), dir.getZ()); Vec3 endPos = startPos.add(dir.getX(), dir.getY(), dir.getZ());
- HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), CollisionContext.empty())); - HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), CollisionContext.empty()));
+ HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), CollisionContext.empty()), canCollide); // Paper - use method with canCollide predicate + HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), CollisionContext.empty()), canCollide); // Paper - Add predicate for blocks when raytracing
return CraftRayTraceResult.fromNMS(this, nmsHitResult); return CraftRayTraceResult.fromNMS(this, nmsHitResult);
} }
@ -103,14 +103,14 @@ index 4f89f38e1d2d9cdb34af8d1d217577e9a437eea5..5fc06ade042f96ae9f623b18faaa1069
@Override @Override
public RayTraceResult rayTrace(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, Predicate<? super Entity> filter) { public RayTraceResult rayTrace(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, Predicate<? super Entity> filter) {
- RayTraceResult blockHit = this.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode, ignorePassableBlocks); - RayTraceResult blockHit = this.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode, ignorePassableBlocks);
+ // Paper start + // Paper start - Add predicate for blocks when raytracing
+ return this.rayTrace(start, direction, maxDistance, fluidCollisionMode, ignorePassableBlocks, raySize, filter, null); + return this.rayTrace(start, direction, maxDistance, fluidCollisionMode, ignorePassableBlocks, raySize, filter, null);
+ } + }
+ +
+ @Override + @Override
+ public RayTraceResult rayTrace(io.papermc.paper.math.Position start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, Predicate<? super Entity> filter, Predicate<? super Block> canCollide) { + public RayTraceResult rayTrace(io.papermc.paper.math.Position start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, Predicate<? super Entity> filter, Predicate<? super Block> canCollide) {
+ RayTraceResult blockHit = this.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode, ignorePassableBlocks, canCollide); + RayTraceResult blockHit = this.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode, ignorePassableBlocks, canCollide);
+ // Paper end + // Paper end - Add predicate for blocks when raytracing
Vector startVec = null; Vector startVec = null;
double blockHitDistance = maxDistance; double blockHitDistance = maxDistance;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] fix secure profile with proxy online mode
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 db363bca264e37c29fda58291246aba0d3759de0..58536aabf607015939a1326f80207c0a06eed8ff 100644 index db363bca264e37c29fda58291246aba0d3759de0..ae5686515707a510e4bae6e78b196adba2a182ef 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
@@ -638,7 +638,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -638,7 +638,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -17,7 +17,7 @@ index db363bca264e37c29fda58291246aba0d3759de0..58536aabf607015939a1326f80207c0a
+ return dedicatedserverproperties.enforceSecureProfile + return dedicatedserverproperties.enforceSecureProfile
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() + && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
+ && this.services.canValidateProfileKeys(); + && this.services.canValidateProfileKeys();
+ // Paper end + // Paper end - fix secure profile with proxy online mode
} }
@Override @Override

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fix strikeLightningEffect powers lightning rods and clears
diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java
index 255fb5e922c63130708e4bcab208b4db52a58387..1e76230c078ef07418345b0bc50c574cf63c9094 100644 index 255fb5e922c63130708e4bcab208b4db52a58387..21f0c986ac3237a2ab560dc545392f04a8bb4ef3 100644
--- a/src/main/java/net/minecraft/world/entity/LightningBolt.java --- a/src/main/java/net/minecraft/world/entity/LightningBolt.java
+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java +++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java
@@ -45,7 +45,7 @@ public class LightningBolt extends Entity { @@ -45,7 +45,7 @@ public class LightningBolt extends Entity {
@ -14,7 +14,7 @@ index 255fb5e922c63130708e4bcab208b4db52a58387..1e76230c078ef07418345b0bc50c574c
private final Set<Entity> hitEntities = Sets.newHashSet(); private final Set<Entity> hitEntities = Sets.newHashSet();
private int blocksSetOnFire; private int blocksSetOnFire;
- public boolean isSilent = false; // Spigot - public boolean isSilent = false; // Spigot
+ public boolean isEffect; // Paper + public boolean isEffect; // Paper - Properly handle lightning effects api
public LightningBolt(EntityType<? extends LightningBolt> type, Level world) { public LightningBolt(EntityType<? extends LightningBolt> type, Level world) {
super(type, world); super(type, world);
@ -23,7 +23,7 @@ index 255fb5e922c63130708e4bcab208b4db52a58387..1e76230c078ef07418345b0bc50c574c
public void tick() { public void tick() {
super.tick(); super.tick();
- if (!this.isSilent && this.life == 2) { // Spigot - if (!this.isSilent && this.life == 2) { // Spigot
+ if (!this.isEffect && this.life == 2) { // Spigot // Paper + if (!this.isEffect && this.life == 2) { // Spigot // Paper - Properly handle lightning effects api
if (this.level().isClientSide()) { if (this.level().isClientSide()) {
this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F, false); this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F, false);
this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F, false); this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F, false);
@ -32,7 +32,7 @@ index 255fb5e922c63130708e4bcab208b4db52a58387..1e76230c078ef07418345b0bc50c574c
} }
- if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.visualOnly - if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.visualOnly
+ if (this.life >= 0 && !this.isEffect) { // CraftBukkit - add !this.visualOnly // Paper - undo + if (this.life >= 0 && !this.isEffect) { // CraftBukkit - add !this.visualOnly // Paper - Properly handle lightning effects api
if (!(this.level() instanceof ServerLevel)) { if (!(this.level() instanceof ServerLevel)) {
this.level().setSkyFlashTime(2); this.level().setSkyFlashTime(2);
} else if (!this.visualOnly) { } else if (!this.visualOnly) {
@ -41,12 +41,12 @@ index 255fb5e922c63130708e4bcab208b4db52a58387..1e76230c078ef07418345b0bc50c574c
private void spawnFire(int spreadAttempts) { private void spawnFire(int spreadAttempts) {
- if (!this.visualOnly && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { - if (!this.visualOnly && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
+ if (!this.visualOnly && !this.isEffect && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { // Paper + if (!this.visualOnly && !this.isEffect && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { // Paper - Properly handle lightning effects api
BlockPos blockposition = this.blockPosition(); BlockPos blockposition = this.blockPosition();
BlockState iblockdata = BaseFireBlock.getState(this.level(), blockposition); BlockState iblockdata = BaseFireBlock.getState(this.level(), blockposition);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 5fc06ade042f96ae9f623b18faaa1069d769153f..fd37494da843e70cbb5e707714ff77724d7ff0bb 100644 index 56ff02ebe9da504f2aa955430ac13b3dba4211f7..f9be183b5971801fbb55db17fcc2fa9d0701daf5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -773,7 +773,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -773,7 +773,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -54,7 +54,7 @@ index 5fc06ade042f96ae9f623b18faaa1069d769153f..fd37494da843e70cbb5e707714ff7772
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world); LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world);
lightning.moveTo(loc.getX(), loc.getY(), loc.getZ()); lightning.moveTo(loc.getX(), loc.getY(), loc.getZ());
- lightning.setVisualOnly(isVisual); - lightning.setVisualOnly(isVisual);
+ lightning.isEffect = isVisual; // Paper + lightning.isEffect = isVisual; // Paper - Properly handle lightning effects api
this.world.strikeLightning(lightning, LightningStrikeEvent.Cause.CUSTOM); this.world.strikeLightning(lightning, LightningStrikeEvent.Cause.CUSTOM);
return (LightningStrike) lightning.getBukkitEntity(); return (LightningStrike) lightning.getBukkitEntity();
} }
@ -72,12 +72,12 @@ index 5fc06ade042f96ae9f623b18faaa1069d769153f..fd37494da843e70cbb5e707714ff7772
lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() ); lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() );
- lightning.visualOnly = true; - lightning.visualOnly = true;
- lightning.isSilent = isSilent; - lightning.isSilent = isSilent;
+ lightning.isEffect = true; // Paper + lightning.isEffect = true; // Paper - Properly handle lightning effects api
CraftWorld.this.world.strikeLightning( lightning, LightningStrikeEvent.Cause.CUSTOM ); CraftWorld.this.world.strikeLightning( lightning, LightningStrikeEvent.Cause.CUSTOM );
return (LightningStrike) lightning.getBukkitEntity(); return (LightningStrike) lightning.getBukkitEntity();
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
index cd9bd7f06e55e970b7791e635610bb5e7491d102..70b377c03346cb8573827aeb493f3b6eb8efb1f8 100644 index cd9bd7f06e55e970b7791e635610bb5e7491d102..4fd1a856cd2e8ebcce0a14e3244108e8344691cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
@@ -13,7 +13,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike @@ -13,7 +13,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
@ -85,7 +85,7 @@ index cd9bd7f06e55e970b7791e635610bb5e7491d102..70b377c03346cb8573827aeb493f3b6e
@Override @Override
public boolean isEffect() { public boolean isEffect() {
- return this.getHandle().visualOnly; - return this.getHandle().visualOnly;
+ return this.getHandle().isEffect; // Paper + return this.getHandle().isEffect; // Paper - Properly handle lightning effects api
} }
public int getFlashes() { public int getFlashes() {
@ -94,7 +94,7 @@ index cd9bd7f06e55e970b7791e635610bb5e7491d102..70b377c03346cb8573827aeb493f3b6e
public boolean isSilent() public boolean isSilent()
{ {
- return CraftLightningStrike.this.getHandle().isSilent; - return CraftLightningStrike.this.getHandle().isSilent;
+ return false; // Paper - the concept of isSilent doesn't exist as sound is controlled by the client + return false; // Paper - Properly handle lightning effects api; the concept of isSilent doesn't exist as sound is controlled by the client
} }
}; };

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Add hand to fish event for all player interactions
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..a2093158e57d5f43c4afa66386481b82b3c4c3c4 100644 index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..5706c9b744b660d6f7639b8152dce82799c4b466 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -474,7 +474,15 @@ public class FishingHook extends Projectile { @@ -474,7 +474,15 @@ public class FishingHook extends Projectile {
@Override @Override
public void readAdditionalSaveData(CompoundTag nbt) {} public void readAdditionalSaveData(CompoundTag nbt) {}
+ // Paper start - add hand parameter + // Paper start - Add hand parameter to PlayerFishEvent
+ @Deprecated + @Deprecated
+ @io.papermc.paper.annotation.DoNotUse + @io.papermc.paper.annotation.DoNotUse
public int retrieve(ItemStack usedItem) { public int retrieve(ItemStack usedItem) {
@ -20,7 +20,7 @@ index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..a2093158e57d5f43c4afa66386481b82
+ } + }
+ +
+ public int retrieve(net.minecraft.world.InteractionHand hand, ItemStack usedItem) { + public int retrieve(net.minecraft.world.InteractionHand hand, ItemStack usedItem) {
+ // Paper end + // Paper end - Add hand parameter to PlayerFishEvent
net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner(); net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner();
if (!this.level().isClientSide && entityhuman != null && !this.shouldStopFishing(entityhuman)) { if (!this.level().isClientSide && entityhuman != null && !this.shouldStopFishing(entityhuman)) {
@ -29,7 +29,7 @@ index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..a2093158e57d5f43c4afa66386481b82
if (this.hookedIn != null) { if (this.hookedIn != null) {
// CraftBukkit start // CraftBukkit start
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), this.hookedIn.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY); - PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), this.hookedIn.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), this.hookedIn.getBukkitEntity(), (FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.CAUGHT_ENTITY); // Paper - add hand + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), this.hookedIn.getBukkitEntity(), (FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.CAUGHT_ENTITY); // Paper - Add hand parameter to PlayerFishEvent
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent); this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) { if (playerFishEvent.isCancelled()) {
@ -38,7 +38,7 @@ index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..a2093158e57d5f43c4afa66386481b82
// Paper end // Paper end
// CraftBukkit start // CraftBukkit start
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), entityitem != null ? entityitem.getBukkitEntity() : null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH); // Paper - entityitem may be null - PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), entityitem != null ? entityitem.getBukkitEntity() : null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH); // Paper - entityitem may be null
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), entityitem != null ? entityitem.getBukkitEntity() : null, (FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.CAUGHT_FISH); // Paper - entityitem may be null // Paper - add hand + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), entityitem != null ? entityitem.getBukkitEntity() : null, (FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.CAUGHT_FISH); // Paper - entityitem may be null // Paper - Add hand parameter to PlayerFishEvent
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1); playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent); this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
@ -47,7 +47,7 @@ index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..a2093158e57d5f43c4afa66386481b82
if (this.onGround()) { if (this.onGround()) {
// CraftBukkit start // CraftBukkit start
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND); - PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.IN_GROUND); // Paper - add hand + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.IN_GROUND); // Paper - Add hand parameter to PlayerFishEvent
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent); this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) { if (playerFishEvent.isCancelled()) {
@ -56,12 +56,12 @@ index a9eaa079a43bc8a5e81deaf6df5ce2f9c53cb319..a2093158e57d5f43c4afa66386481b82
// CraftBukkit start // CraftBukkit start
if (i == 0) { if (i == 0) {
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.REEL_IN); - PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.REEL_IN);
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.REEL_IN); // Paper - add hand + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.REEL_IN); // Paper - Add hand parameter to PlayerFishEvent
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent); this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) { if (playerFishEvent.isCancelled()) {
return 0; return 0;
diff --git a/src/main/java/net/minecraft/world/item/FishingRodItem.java b/src/main/java/net/minecraft/world/item/FishingRodItem.java diff --git a/src/main/java/net/minecraft/world/item/FishingRodItem.java b/src/main/java/net/minecraft/world/item/FishingRodItem.java
index b9aca584c9765e995d1f8b9b2e45e5257fb6ab9d..ad326a68e87ae571a7eb7b6804bf67ecec64211f 100644 index b9aca584c9765e995d1f8b9b2e45e5257fb6ab9d..95144f0ea5e99285c0a82b9d2e60766b785a236d 100644
--- a/src/main/java/net/minecraft/world/item/FishingRodItem.java --- a/src/main/java/net/minecraft/world/item/FishingRodItem.java
+++ b/src/main/java/net/minecraft/world/item/FishingRodItem.java +++ b/src/main/java/net/minecraft/world/item/FishingRodItem.java
@@ -29,7 +29,7 @@ public class FishingRodItem extends Item implements Vanishable { @@ -29,7 +29,7 @@ public class FishingRodItem extends Item implements Vanishable {
@ -69,7 +69,7 @@ index b9aca584c9765e995d1f8b9b2e45e5257fb6ab9d..ad326a68e87ae571a7eb7b6804bf67ec
if (user.fishing != null) { if (user.fishing != null) {
if (!world.isClientSide) { if (!world.isClientSide) {
- i = user.fishing.retrieve(itemstack); - i = user.fishing.retrieve(itemstack);
+ i = user.fishing.retrieve(hand, itemstack); // Paper - add hand parameter + i = user.fishing.retrieve(hand, itemstack); // Paper - Add hand parameter to PlayerFishEvent
itemstack.hurtAndBreak(i, user, (entityhuman1) -> { itemstack.hurtAndBreak(i, user, (entityhuman1) -> {
entityhuman1.broadcastBreakEvent(hand); entityhuman1.broadcastBreakEvent(hand);
}); });

Datei anzeigen

@ -11,17 +11,17 @@ also changed. Also in several places, the breed item was stored after
it was decreased by one to consume the item. it was decreased by one to consume the item.
diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java
index 907ed82fea71254d6624eda878e2668cd26422a7..f6e0eefe068fe1a9fe159b382cf94de488521728 100644 index 907ed82fea71254d6624eda878e2668cd26422a7..081d1e38b7b1f286e138b0981aaa760e58761215 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Animal.java --- a/src/main/java/net/minecraft/world/entity/animal/Animal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java +++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java
@@ -152,8 +152,9 @@ public abstract class Animal extends AgeableMob { @@ -152,8 +152,9 @@ public abstract class Animal extends AgeableMob {
int i = this.getAge(); int i = this.getAge();
if (!this.level().isClientSide && i == 0 && this.canFallInLove()) { if (!this.level().isClientSide && i == 0 && this.canFallInLove()) {
+ final ItemStack breedCopy = itemstack.copy(); // Paper + final ItemStack breedCopy = itemstack.copy(); // Paper - Fix EntityBreedEvent copying
this.usePlayerItem(player, hand, itemstack); this.usePlayerItem(player, hand, itemstack);
- this.setInLove(player); - this.setInLove(player);
+ this.setInLove(player, breedCopy); // Paper + this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
@ -29,18 +29,18 @@ index 907ed82fea71254d6624eda878e2668cd26422a7..f6e0eefe068fe1a9fe159b382cf94de4
return this.inLove <= 0; return this.inLove <= 0;
} }
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Fix EntityBreedEvent copying
public void setInLove(@Nullable Player player) { public void setInLove(@Nullable Player player) {
+ // Paper start - pass breed stack + // Paper start - Fix EntityBreedEvent copying
+ this.setInLove(player, null); + this.setInLove(player, null);
+ } + }
+ public void setInLove(@Nullable Player player, @Nullable ItemStack breedItemCopy) { + public void setInLove(@Nullable Player player, @Nullable ItemStack breedItemCopy) {
+ if (breedItemCopy != null) this.breedItem = breedItemCopy; + if (breedItemCopy != null) this.breedItem = breedItemCopy;
+ // Paper end + // Paper end - Fix EntityBreedEvent copying
// CraftBukkit start // CraftBukkit start
EntityEnterLoveModeEvent entityEnterLoveModeEvent = CraftEventFactory.callEntityEnterLoveModeEvent(player, this, 600); EntityEnterLoveModeEvent entityEnterLoveModeEvent = CraftEventFactory.callEntityEnterLoveModeEvent(player, this, 600);
if (entityEnterLoveModeEvent.isCancelled()) { if (entityEnterLoveModeEvent.isCancelled()) {
+ this.breedItem = null; // Paper - clear if cancelled + this.breedItem = null; // Paper - Fix EntityBreedEvent copying; clear if cancelled
return; return;
} }
this.inLove = entityEnterLoveModeEvent.getTicksInLove(); this.inLove = entityEnterLoveModeEvent.getTicksInLove();
@ -49,27 +49,27 @@ index 907ed82fea71254d6624eda878e2668cd26422a7..f6e0eefe068fe1a9fe159b382cf94de4
this.loveCause = player.getUUID(); this.loveCause = player.getUUID();
} }
- this.breedItem = player.getInventory().getSelected(); // CraftBukkit - this.breedItem = player.getInventory().getSelected(); // CraftBukkit
+ // Paper - set breed item in better place + // Paper - Fix EntityBreedEvent copying; set breed item in better place
this.level().broadcastEntityEvent(this, (byte) 18); this.level().broadcastEntityEvent(this, (byte) 18);
} }
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index 683cc5f9f066d554383fcd30e3654ac06ec76510..17e42c49fe6f1696a0b0b4b2537cabfe565692e5 100644 index 683cc5f9f066d554383fcd30e3654ac06ec76510..089328028b9f82be3ddbfab42b6d0f015c4b71b5 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -649,8 +649,9 @@ public class Panda extends Animal { @@ -649,8 +649,9 @@ public class Panda extends Animal {
this.usePlayerItem(player, hand, itemstack); this.usePlayerItem(player, hand, itemstack);
this.ageUp((int) ((float) (-this.getAge() / 20) * 0.1F), true); this.ageUp((int) ((float) (-this.getAge() / 20) * 0.1F), true);
} else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) { } else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) {
+ final ItemStack breedCopy = itemstack.copy(); // Paper + final ItemStack breedCopy = itemstack.copy(); // Paper - Fix EntityBreedEvent copying
this.usePlayerItem(player, hand, itemstack); this.usePlayerItem(player, hand, itemstack);
- this.setInLove(player); - this.setInLove(player);
+ this.setInLove(player, breedCopy); // Paper + this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying
} else { } else {
if (this.level().isClientSide || this.isSitting() || this.isInWater()) { if (this.level().isClientSide || this.isSitting() || this.isInWater()) {
return InteractionResult.PASS; return InteractionResult.PASS;
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index 1d9427da270edb447a2c8e031c4f05fe5d39603b..7dee2d1c4ce038f42334120f5dedb836f4e21723 100644 index 1d9427da270edb447a2c8e031c4f05fe5d39603b..01b07320d8c94907e41283d5bc8943da2bbc6c6e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -389,7 +389,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl @@ -389,7 +389,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
@ -77,12 +77,12 @@ index 1d9427da270edb447a2c8e031c4f05fe5d39603b..7dee2d1c4ce038f42334120f5dedb836
boolean bl2 = this.isTamed() && this.getAge() == 0 && this.canFallInLove(); boolean bl2 = this.isTamed() && this.getAge() == 0 && this.canFallInLove();
if (bl2) { if (bl2) {
- this.setInLove(player); - this.setInLove(player);
+ this.setInLove(player, item.copy()); // Paper + this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying
} }
boolean bl3 = this.isBaby(); boolean bl3 = this.isBaby();
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 8fe5a4ccf474c094b8081828c93e8973cdabb6ed..63bbb5723f587788a65cc1cdac4cea94d96f254b 100644 index 8fe5a4ccf474c094b8081828c93e8973cdabb6ed..d9539f5275c4cb63910ba79aa522d9569ad35a89 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -513,7 +513,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, @@ -513,7 +513,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@ -90,7 +90,7 @@ index 8fe5a4ccf474c094b8081828c93e8973cdabb6ed..63bbb5723f587788a65cc1cdac4cea94
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
flag = true; flag = true;
- this.setInLove(player); - this.setInLove(player);
+ this.setInLove(player, item.copy()); // Paper + this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying
} }
} else if (item.is(Items.GOLDEN_APPLE) || item.is(Items.ENCHANTED_GOLDEN_APPLE)) { } else if (item.is(Items.GOLDEN_APPLE) || item.is(Items.ENCHANTED_GOLDEN_APPLE)) {
f = 10.0F; f = 10.0F;
@ -99,12 +99,12 @@ index 8fe5a4ccf474c094b8081828c93e8973cdabb6ed..63bbb5723f587788a65cc1cdac4cea94
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
flag = true; flag = true;
- this.setInLove(player); - this.setInLove(player);
+ this.setInLove(player, item.copy()); // Paper + this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
index 5f61c97478f005aaaaad1b027118079db7275cf7..9120663b63fc0e365e8edb359892b0db1ee97875 100644 index 5f61c97478f005aaaaad1b027118079db7275cf7..4863586b1c54192e0228342a0c36561348ebb3fb 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -191,7 +191,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V @@ -191,7 +191,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
@ -112,7 +112,7 @@ index 5f61c97478f005aaaaad1b027118079db7275cf7..9120663b63fc0e365e8edb359892b0db
if (this.isTamed() && this.getAge() == 0 && this.canFallInLove()) { if (this.isTamed() && this.getAge() == 0 && this.canFallInLove()) {
flag = true; flag = true;
- this.setInLove(player); - this.setInLove(player);
+ this.setInLove(player, item.copy()); // Paper + this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying
} }
} }

Datei anzeigen

@ -19,19 +19,19 @@ where generation happened directly to a ServerLevel and the
entity still has the flag set. entity still has the flag set.
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 af712365d676bc33314b5a3fc6ff8ae823dc3012..891ebb5a03adaa5d184b7363bbfa94e8a17c2773 100644 index 6ff5898846ef2d985f5ce630db9a31c4ad75ca66..2afc66b83d21a16be3fbe78476e532fc95582db9 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
@@ -1681,6 +1681,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1681,6 +1681,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit start // CraftBukkit start
private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
+ entity.generation = false; // Reset flag if it was added during a ServerLevel generation process + entity.generation = false; // Paper - Don't fire sync event during generation; Reset flag if it was added during a ServerLevel generation process
// Paper start // Paper start
if (entity.valid) { if (entity.valid) {
MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable());
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 c4d7d668bab1546c8196b2c570298038d767220a..cc86993aa7bf95ed5ae861feedc7e1049f12e210 100644 index c4d7d668bab1546c8196b2c570298038d767220a..64ee22fe8ec64e9e942471d2c114554e241f5708 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
@@ -711,7 +711,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -711,7 +711,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -39,47 +39,47 @@ index c4d7d668bab1546c8196b2c570298038d767220a..cc86993aa7bf95ed5ae861feedc7e104
return; return;
} }
- this.level.getCraftServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[pose.ordinal()])); - this.level.getCraftServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[pose.ordinal()]));
+ // Paper start - don't fire event during generation + // Paper start - Don't fire sync event during generation
+ if (!this.generation) { + if (!this.generation) {
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[pose.ordinal()])); + this.level.getCraftServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[pose.ordinal()]));
+ } + }
+ // Paper end - don't fire event during generation + // Paper end - Don't fire sync event during generation
// CraftBukkit end // CraftBukkit end
this.entityData.set(Entity.DATA_POSE, pose); this.entityData.set(Entity.DATA_POSE, pose);
} }
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..00389d7ec3e8b059d5591a2019ba240fda2901fe 100644 index 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..abb2a02e0fc1deedb0ad76aec64f74ce355129cc 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -588,9 +588,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT @@ -588,9 +588,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
} }
public static Optional<Entity> create(CompoundTag nbt, Level world) { public static Optional<Entity> create(CompoundTag nbt, Level world) {
+ // Paper start - add generation bool param + // Paper start - Don't fire sync event during generation
+ return create(nbt, world, false); + return create(nbt, world, false);
+ } + }
+ public static Optional<Entity> create(CompoundTag nbt, Level world, boolean generation) { + public static Optional<Entity> create(CompoundTag nbt, Level world, boolean generation) {
+ // Paper end - add generation bool param + // Paper end - Don't fire sync event during generation
return Util.ifElse(EntityType.by(nbt).map((entitytypes) -> { return Util.ifElse(EntityType.by(nbt).map((entitytypes) -> {
return entitytypes.create(world); return entitytypes.create(world);
}), (entity) -> { }), (entity) -> {
+ if (generation) entity.generation = true; // Paper - add generation bool param + if (generation) entity.generation = true; // Paper - Don't fire sync event during generation
entity.load(nbt); entity.load(nbt);
}, () -> { }, () -> {
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
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 7471e5ba8fc0e2d17cdd3d8b580fe7375d58cc73..bc45bd5816b1b62cdd6011f2372702451b83f22b 100644 index d90d86f6b6e656bc6680afa07c7a9e99e6325851..f242b2c56bfc2f17e87125e642538d58feb253e0 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
@@ -1133,6 +1133,11 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -1133,6 +1133,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) { public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
+ // Paper start - add boolean param to optionally fire the event + // Paper start - Don't fire sync event during generation
+ return this.addEffect(mobeffect, entity, cause, true); + return this.addEffect(mobeffect, entity, cause, true);
+ } + }
+ public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause, boolean fireEvent) { + public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause, boolean fireEvent) {
+ // Paper end + // Paper end - Don't fire sync event during generation
// org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API // org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
if (this.isTickingEffects) { if (this.isTickingEffects) {
this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause)); this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
@ -87,13 +87,13 @@ index 7471e5ba8fc0e2d17cdd3d8b580fe7375d58cc73..bc45bd5816b1b62cdd6011f237270245
override = new MobEffectInstance(mobeffect1).update(mobeffect); override = new MobEffectInstance(mobeffect1).update(mobeffect);
} }
+ if (fireEvent) { // Paper + if (fireEvent) { // Paper - Don't fire sync event during generation
EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect1, mobeffect, cause, override); EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect1, mobeffect, cause, override);
+ override = event.isOverride(); // Paper + override = event.isOverride(); // Paper - Don't fire sync event during generation
if (event.isCancelled()) { if (event.isCancelled()) {
return false; return false;
} }
+ } // Paper + } // Paper - Don't fire sync event during generation
// CraftBukkit end // CraftBukkit end
if (mobeffect1 == null) { if (mobeffect1 == null) {
@ -102,12 +102,12 @@ index 7471e5ba8fc0e2d17cdd3d8b580fe7375d58cc73..bc45bd5816b1b62cdd6011f237270245
flag = true; flag = true;
// CraftBukkit start // CraftBukkit start
- } else if (event.isOverride()) { - } else if (event.isOverride()) {
+ } else if (override) { // Paper + } else if (override) { // Paper - Don't fire sync event during generation
mobeffect1.update(mobeffect); mobeffect1.update(mobeffect);
this.onEffectUpdated(mobeffect1, true, entity); this.onEffectUpdated(mobeffect1, true, entity);
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
index 5a9f4a022c8e7a0804543335bfe91e1328d040e6..9063f66b0497a3eb3893e307e685be692cc5c128 100644 index 5a9f4a022c8e7a0804543335bfe91e1328d040e6..8094c133f9e934c98eee09738220bacd87a0a364 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
@@ -182,7 +182,7 @@ public class Spider extends Monster { @@ -182,7 +182,7 @@ public class Spider extends Monster {
@ -115,12 +115,12 @@ index 5a9f4a022c8e7a0804543335bfe91e1328d040e6..9063f66b0497a3eb3893e307e685be69
if (mobeffectlist != null) { if (mobeffectlist != null) {
- this.addEffect(new MobEffectInstance(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit - this.addEffect(new MobEffectInstance(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
+ this.addEffect(new MobEffectInstance(mobeffectlist, -1), null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN, world instanceof net.minecraft.server.level.ServerLevel); // CraftBukkit // Paper - only fire the effect event if this is happening in a ServerLevel + this.addEffect(new MobEffectInstance(mobeffectlist, -1), null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN, world instanceof net.minecraft.server.level.ServerLevel); // CraftBukkit // Paper - Don't fire sync event during generation; only if this is happening in a ServerLevel
} }
} }
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 52c389472e013e658344496218689465350bf8a3..a341eff6a4ccc1eda38afd9d0017b08b68cb6413 100644 index 52c389472e013e658344496218689465350bf8a3..8c4d434bffa640a17d6870080f79cd0e492c7537 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
@@ -518,7 +518,7 @@ public class StructureTemplate { @@ -518,7 +518,7 @@ public class StructureTemplate {
@ -128,12 +128,12 @@ index 52c389472e013e658344496218689465350bf8a3..a341eff6a4ccc1eda38afd9d0017b08b
// CraftBukkit start // CraftBukkit start
// try { // try {
- return EntityType.create(nbt, world.getLevel()); - return EntityType.create(nbt, world.getLevel());
+ return EntityType.create(nbt, world.getLevel(), true); // Paper - set generation bool + return EntityType.create(nbt, world.getLevel(), true); // Paper - Don't fire sync event during generation
// } catch (Exception exception) { // } catch (Exception exception) {
// return Optional.empty(); // return Optional.empty();
// } // }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
index a650411e3fa7e2a045ac55502c77028be348acf1..0f115d555cbc9fed224c9e8b0fab5fae6b0e7ff2 100644 index a650411e3fa7e2a045ac55502c77028be348acf1..86a20c91beff6b27e6ec886e49ba902b216106f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java --- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
@@ -93,15 +93,17 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel { @@ -93,15 +93,17 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel {
@ -149,7 +149,7 @@ index a650411e3fa7e2a045ac55502c77028be348acf1..0f115d555cbc9fed224c9e8b0fab5fae
- public void addFreshEntityWithPassengers(Entity entity) { - public void addFreshEntityWithPassengers(Entity entity) {
- this.handle.addFreshEntityWithPassengers(entity); - this.handle.addFreshEntityWithPassengers(entity);
- } - }
+ // Paper start - don't override these methods so all entities are run through addFreshEntity + // Paper start - Don't fire sync event during generation; don't override these methods so all entities are run through addFreshEntity
+ // @Override + // @Override
+ // public void addFreshEntityWithPassengers(Entity arg0, CreatureSpawnEvent.SpawnReason arg1) { + // public void addFreshEntityWithPassengers(Entity arg0, CreatureSpawnEvent.SpawnReason arg1) {
+ // this.handle.addFreshEntityWithPassengers(arg0, arg1); + // this.handle.addFreshEntityWithPassengers(arg0, arg1);
@ -159,12 +159,12 @@ index a650411e3fa7e2a045ac55502c77028be348acf1..0f115d555cbc9fed224c9e8b0fab5fae
+ // public void addFreshEntityWithPassengers(Entity entity) { + // public void addFreshEntityWithPassengers(Entity entity) {
+ // this.handle.addFreshEntityWithPassengers(entity); + // this.handle.addFreshEntityWithPassengers(entity);
+ // } + // }
+ // Paper end - don't override these methods + // Paper end - Don't fire sync event during generation; don't override these methods
@Override @Override
public ServerLevel getMinecraftWorld() { public ServerLevel getMinecraftWorld() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java
index b4b297945fb601701aac845d09e88fb74b09c3fa..0762140eb66e9d4dedeb6d12270bdca4c88558f5 100644 index b4b297945fb601701aac845d09e88fb74b09c3fa..7482dfe64458320d44089c0778591694202e9f70 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java --- a/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java
@@ -39,21 +39,23 @@ public class TransformerGeneratorAccess extends DelegatedGeneratorAccess { @@ -39,21 +39,23 @@ public class TransformerGeneratorAccess extends DelegatedGeneratorAccess {
@ -186,7 +186,7 @@ index b4b297945fb601701aac845d09e88fb74b09c3fa..0762140eb66e9d4dedeb6d12270bdca4
- } - }
- super.addFreshEntityWithPassengers(arg0, arg1); - super.addFreshEntityWithPassengers(arg0, arg1);
- } - }
+ // Paper start - don't override these methods so all entities are run through addFreshEntity + // Paper start - Don't fire sync event during generation; don't override these methods so all entities are run through addFreshEntity
+ // @Override + // @Override
+ // public void addFreshEntityWithPassengers(Entity entity) { + // public void addFreshEntityWithPassengers(Entity entity) {
+ // if (this.structureTransformer != null && !this.structureTransformer.transformEntity(entity)) { + // if (this.structureTransformer != null && !this.structureTransformer.transformEntity(entity)) {
@ -202,7 +202,7 @@ index b4b297945fb601701aac845d09e88fb74b09c3fa..0762140eb66e9d4dedeb6d12270bdca4
+ // } + // }
+ // super.addFreshEntityWithPassengers(arg0, arg1); + // super.addFreshEntityWithPassengers(arg0, arg1);
+ // } + // }
+ // Paper end - don't override these methods + // Paper end - Don't fire sync event during generation; don't override these methods
public boolean setCraftBlock(BlockPos position, CraftBlockState craftBlockState, int i, int j) { public boolean setCraftBlock(BlockPos position, CraftBlockState craftBlockState, int i, int j) {
if (this.structureTransformer != null) { if (this.structureTransformer != null) {