[ci skip] Add more identifying patch comments

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-18 15:56:25 +01:00
Ursprung 94807a1d2e
Commit 5e73c555bc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
29 geänderte Dateien mit 159 neuen und 141 gelöschten Zeilen

Datei anzeigen

@ -204,7 +204,8 @@ when making and submitting changes.
## Formatting
All modifications to non-Paper files should be marked.
All modifications to non-Paper files should be marked. The one exception to this is
when modifying javadoc comments, which should not have these markers.
- You need to add a comment with a short and identifiable description of the patch:
`// Paper start - <COMMIT DESCRIPTION>`

Datei anzeigen

@ -11,7 +11,7 @@ distance trigger. This adds a config option to ignore that
and use the exact dimension key of the worlds involved.
diff --git a/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java b/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java
index 5f9cb2c7a2874e423087d04d3360af0364692b5c..f81aa5adf9a499cef6dc45bf3f9de2df3dc61460 100644
index 5f9cb2c7a2874e423087d04d3360af0364692b5c..428e0afef2cac9f2a19d8cfe8f2504ddd8e50887 100644
--- a/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java
+++ b/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java
@@ -25,7 +25,7 @@ public record LocationPredicate(Optional<LocationPredicate.PositionPredicate> po
@ -19,24 +19,24 @@ index 5f9cb2c7a2874e423087d04d3360af0364692b5c..f81aa5adf9a499cef6dc45bf3f9de2df
if (this.position.isPresent() && !this.position.get().matches(x, y, z)) {
return false;
- } else if (this.dimension.isPresent() && this.dimension.get() != world.dimension()) {
+ } else if (this.dimension.isPresent() && this.dimension.get() != (io.papermc.paper.configuration.GlobalConfiguration.get().misc.strictAdvancementDimensionCheck ? world.dimension() : org.bukkit.craftbukkit.util.CraftDimensionUtil.getMainDimensionKey(world))) { // Paper
+ } else if (this.dimension.isPresent() && this.dimension.get() != (io.papermc.paper.configuration.GlobalConfiguration.get().misc.strictAdvancementDimensionCheck ? world.dimension() : org.bukkit.craftbukkit.util.CraftDimensionUtil.getMainDimensionKey(world))) { // Paper - Add option for strict advancement dimension checks
return false;
} else {
BlockPos blockPos = BlockPos.containing(x, y, z);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 1f7b13806ffbcf81df67a02129aa2c07dfc7b8f5..08acf8c6e6c624016ca97eef15da29d338433411 100644
index 1f7b13806ffbcf81df67a02129aa2c07dfc7b8f5..f2677922cb97c9aa34f2e80769ac9cccc3dc8089 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1321,6 +1321,12 @@ public class ServerPlayer extends Player {
ResourceKey<Level> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(origin);
ResourceKey<Level> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());
+ // Paper start - config for strict advancement checks for dimensions
+ // Paper start - Add option for strict advancement dimension checks
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.strictAdvancementDimensionCheck) {
+ maindimensionkey = resourcekey;
+ maindimensionkey1 = resourcekey1;
+ }
+ // Paper end
+ // Paper end - Add option for strict advancement dimension checks
CriteriaTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1);
if (maindimensionkey != resourcekey || maindimensionkey1 != resourcekey1) {
CriteriaTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);

Datei anzeigen

@ -8,19 +8,19 @@ in command blocks, and if called asynchronously, would throw
an error
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
index c56f5173fda6b38c2dcaea196217f2f5a7d7c641..d4ff8c6b7801e33be4ff69b8bae13c09f4872c4b 100644
index c56f5173fda6b38c2dcaea196217f2f5a7d7c641..524b0f1086c01888fe0b76e180c40915d16a1eb9 100644
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
@@ -172,6 +172,7 @@ public abstract class BaseCommandBlock implements CommandSource {
@Override
public void sendSystemMessage(Component message) {
if (this.trackOutput) {
+ org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper
+ org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks
SimpleDateFormat simpledateformat = BaseCommandBlock.TIME_FORMAT;
Date date = new Date();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 398a89a1f695f1e99b30ca0d5ebb192c8f465748..84d6b1b3ec3972281218cbe5e72c9d4ce6419c59 100644
index 398a89a1f695f1e99b30ca0d5ebb192c8f465748..7749d9740c965baf901512b242426f9a15aca24f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1873,7 +1873,7 @@ public final class CraftServer implements Server {
@ -28,7 +28,7 @@ index 398a89a1f695f1e99b30ca0d5ebb192c8f465748..84d6b1b3ec3972281218cbe5e72c9d4c
Set<CommandSender> recipients = new HashSet<>();
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {
- if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
+ if (permissible instanceof CommandSender && !(permissible instanceof org.bukkit.command.BlockCommandSender) && permissible.hasPermission(permission)) { // Paper - don't broadcast to BlockCommandSender (specifically Command Blocks)
+ if (permissible instanceof CommandSender && !(permissible instanceof org.bukkit.command.BlockCommandSender) && permissible.hasPermission(permission)) { // Paper - Don't broadcast messages to command blocks
recipients.add((CommandSender) permissible);
}
}

Datei anzeigen

@ -15,7 +15,7 @@ to account for the case where the chunk is _not_ currently loaded
and then later loaded.
diff --git a/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java b/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java
index e64435c1dfbaf182d2292a1123701033f817ec38..d368ba29fec49a989be1cacd2422599d6d613c29 100644
index e64435c1dfbaf182d2292a1123701033f817ec38..47647d3db7ce36226a817df640a0b25574fb9b02 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java
+++ b/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java
@@ -48,7 +48,7 @@ public class DynamicGameEventListener<T extends GameEventListener> {
@ -23,7 +23,7 @@ index e64435c1dfbaf182d2292a1123701033f817ec38..d368ba29fec49a989be1cacd2422599d
private static void ifChunkExists(LevelReader world, @Nullable SectionPos sectionPos, Consumer<GameEventListenerRegistry> dispatcherConsumer) {
if (sectionPos != null) {
- ChunkAccess chunkAccess = world.getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.FULL, false);
+ ChunkAccess chunkAccess = world.getChunkIfLoadedImmediately(sectionPos.getX(), sectionPos.getZ()); // Paper - can cause sync loads while completing a chunk, resulting in deadlock
+ ChunkAccess chunkAccess = world.getChunkIfLoadedImmediately(sectionPos.getX(), sectionPos.getZ()); // Paper - Perf: can cause sync loads while completing a chunk, resulting in deadlock
if (chunkAccess != null) {
dispatcherConsumer.accept(chunkAccess.getListenerRegistry(sectionPos.y()));
}

Datei anzeigen

@ -5,26 +5,26 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index edea89eebb9a99e41dc2bcbabc94b6775f5470df..b0a7c41372609de260298d40490781bb63b0fa1d 100644
index edea89eebb9a99e41dc2bcbabc94b6775f5470df..053dbed42a74a5721cfe9f6d70cd965ede3ef1f3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2699,6 +2699,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
entityitem.setDefaultPickUpDelay();
+ // Paper start
+ // Paper start - Call EntityDropItemEvent
+ return this.spawnAtLocation(entityitem);
+ }
+ }
+ @Nullable
+ public ItemEntity spawnAtLocation(ItemEntity entityitem) {
+ {
+ // Paper end
+ // Paper end - Call EntityDropItemEvent
// CraftBukkit start
EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
Bukkit.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
index fb5e200499a1a73fd40c8b7c81185f48381f49e4..e555fd8ca61e1ce7a52ecd475cc3ea11dedcab08 100644
index fb5e200499a1a73fd40c8b7c81185f48381f49e4..178e1e75fcd0e60a1dd2729a894df08cf4129526 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
@@ -592,7 +592,7 @@ public class Dolphin extends WaterAnimal {
@ -32,12 +32,12 @@ index fb5e200499a1a73fd40c8b7c81185f48381f49e4..e555fd8ca61e1ce7a52ecd475cc3ea11
entityitem.setDeltaMovement((double) (0.3F * -Mth.sin(Dolphin.this.getYRot() * 0.017453292F) * Mth.cos(Dolphin.this.getXRot() * 0.017453292F) + Mth.cos(f1) * f2), (double) (0.3F * Mth.sin(Dolphin.this.getXRot() * 0.017453292F) * 1.5F), (double) (0.3F * Mth.cos(Dolphin.this.getYRot() * 0.017453292F) * Mth.cos(Dolphin.this.getXRot() * 0.017453292F) + Mth.sin(f1) * f2));
- Dolphin.this.level().addFreshEntity(entityitem);
+ Dolphin.this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent
+ Dolphin.this.spawnAtLocation(entityitem); // Paper - Call EntityDropItemEvent
}
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
index 6124209f50300eeaab45b66c2f1a5b2944119450..96799179b0dd1886f0cdc386f04e152a19b3337d 100644
index 6124209f50300eeaab45b66c2f1a5b2944119450..94bb69a7f5795e0fbee171433632b5c3bca3b902 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
@@ -509,14 +509,14 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
@ -45,7 +45,7 @@ index 6124209f50300eeaab45b66c2f1a5b2944119450..96799179b0dd1886f0cdc386f04e152a
entityitem.setThrower(this);
this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F);
- this.level().addFreshEntity(entityitem);
+ this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent
+ this.spawnAtLocation(entityitem); // Paper - Call EntityDropItemEvent
}
}
@ -53,12 +53,12 @@ index 6124209f50300eeaab45b66c2f1a5b2944119450..96799179b0dd1886f0cdc386f04e152a
ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), stack);
- this.level().addFreshEntity(entityitem);
+ this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent
+ this.spawnAtLocation(entityitem); // Paper - Call EntityDropItemEvent
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index 3ec2f590dfe9410f1a9d2afb530eebfcce917798..363892e0c26bab89d2abaa44d8736e2fd84d292f 100644
index 3ec2f590dfe9410f1a9d2afb530eebfcce917798..cafea947d49b729268c0fce98ce7fcf4b0c69478 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -357,8 +357,7 @@ public class Goat extends Animal {
@ -67,22 +67,22 @@ index 3ec2f590dfe9410f1a9d2afb530eebfcce917798..363892e0c26bab89d2abaa44d8736e2f
- this.level().addFreshEntity(entityitem);
- return true;
+ return this.spawnAtLocation(entityitem) != null; // Paper - call EntityDropItemEvent by calling spawnAtLocation.
+ return this.spawnAtLocation(entityitem) != null; // Paper - Call EntityDropItemEvent
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 1d9913cbc7fd0c6e29278b02c38703b52af1245b..36b3945832733b5ad66d25aa3a31335234d2acff 100644
index 1d9913cbc7fd0c6e29278b02c38703b52af1245b..0e85e3ab58d848b119212fa7d2eb4f92d3efe29b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -352,8 +352,9 @@ public class Sniffer extends Animal {
entityitem.setDefaultPickUpDelay();
this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob) null);
+ if (this.spawnAtLocation(entityitem) != null) { // Paper - call EntityDropItemEvent
+ if (this.spawnAtLocation(entityitem) != null) { // Paper - Call EntityDropItemEvent
this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F);
- world.addFreshEntity(entityitem);
+ } // Paper
+ } // Paper - Call EntityDropItemEvent
}
@Override

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] More Teleport API
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index be9584daa1da322855524386acf7718d825a7034..94ea292ea1754c5b0b0776a2dcce034194fb0290 100644
index be9584daa1da322855524386acf7718d825a7034..6498ce505226d35f30062bc3aa52388b739c13fe 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1637,11 +1637,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -19,12 +19,12 @@ index be9584daa1da322855524386acf7718d825a7034..94ea292ea1754c5b0b0776a2dcce0341
+ relativeFlags.add(org.bukkit.craftbukkit.entity.CraftPlayer.toApiRelativeFlag(relativeArgument));
+ }
+ PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags));
+ // Paper end
+ // Paper end - Teleport API
this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled() || !to.equals(event.getTo())) {
- set.clear(); // Can't relative teleport
+ // set.clear(); // Can't relative teleport // Paper - Teleport API: Now you can!
+ // set.clear(); // Can't relative teleport // Paper - Teleport API; Now you can!
to = event.isCancelled() ? event.getFrom() : event.getTo();
d0 = to.getX();
d1 = to.getY();

Datei anzeigen

@ -5,20 +5,20 @@ Subject: [PATCH] Add EntityPortalReadyEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b0a7c41372609de260298d40490781bb63b0fa1d..fcef36f5314107f416953fbd0f891da7348c2243 100644
index 053dbed42a74a5721cfe9f6d70cd965ede3ef1f3..5a57fe0dacd4baf3fea9b64f6325acc34b946036 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3099,6 +3099,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
this.level().getProfiler().push("portal");
this.portalTime = i;
+ // Paper start
+ // Paper start - Add EntityPortalReadyEvent
+ io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER);
+ if (!event.callEvent()) {
+ this.portalTime = 0;
+ } else {
+ worldserver1 = event.getTargetWorld() == null ? null : ((CraftWorld) event.getTargetWorld()).getHandle();
+ // Paper end
+ // Paper end - Add EntityPortalReadyEvent
this.setPortalCooldown();
// CraftBukkit start
if (this instanceof ServerPlayer) {
@ -26,7 +26,7 @@ index b0a7c41372609de260298d40490781bb63b0fa1d..fcef36f5314107f416953fbd0f891da7
} else {
this.changeDimension(worldserver1);
}
+ } // Paper
+ } // Paper - Add EntityPortalReadyEvent
// CraftBukkit end
this.level().getProfiler().pop();
}

Datei anzeigen

@ -9,7 +9,7 @@ should be supported. Some entities (for whatever
reason) use the level's random in some places.
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index fc14a2eb464675f8fb0bff916992687adb4e3d25..6b18f23b57c7000dce9726df98a509ee9477f6d2 100644
index fc14a2eb464675f8fb0bff916992687adb4e3d25..e19a0f1fac3dd04927f73f3d11a921ffc4608388 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -66,7 +66,12 @@ public class ItemEntity extends Entity implements TraceableEntity {
@ -17,17 +17,17 @@ index fc14a2eb464675f8fb0bff916992687adb4e3d25..6b18f23b57c7000dce9726df98a509ee
public ItemEntity(Level world, double x, double y, double z, ItemStack stack) {
- this(world, x, y, z, stack, world.random.nextDouble() * 0.2D - 0.1D, 0.2D, world.random.nextDouble() * 0.2D - 0.1D);
+ // Paper start - don't use world random in entity constructor
+ // Paper start - Don't use level random in entity constructors (to make them thread-safe)
+ this(EntityType.ITEM, world);
+ this.setPos(x, y, z);
+ this.setDeltaMovement(this.random.nextDouble() * 0.2D - 0.1D, 0.2D, this.random.nextDouble() * 0.2D - 0.1D);
+ this.setItem(stack);
+ // Paper end
+ // Paper end - Don't use level random in entity constructors
}
public ItemEntity(Level world, double x, double y, double z, ItemStack stack, double velocityX, double velocityY, double velocityZ) {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index d9ed22e9853eebdf6c517b41787a27a1a56a0871..c3e47426382296d650fa00ce0bc1a82bf23c7877 100644
index d9ed22e9853eebdf6c517b41787a27a1a56a0871..2274541c9386e4f1bbae489a1f123d502ccbf9cc 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -43,7 +43,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@ -35,7 +35,7 @@ index d9ed22e9853eebdf6c517b41787a27a1a56a0871..c3e47426382296d650fa00ce0bc1a82b
this(EntityType.TNT, world);
this.setPos(x, y, z);
- double d3 = world.random.nextDouble() * 6.2831854820251465D;
+ double d3 = this.random.nextDouble() * 6.2831854820251465D; // Paper - don't use world random in entity constructor
+ double d3 = this.random.nextDouble() * 6.2831854820251465D; // Paper - Don't use level random in entity constructors
this.setDeltaMovement(-Math.sin(d3) * 0.02D, 0.20000000298023224D, -Math.cos(d3) * 0.02D);
this.setFuse(80);

Datei anzeigen

@ -7,15 +7,15 @@ Minecraft's prediction system does not handle block entities, so if we are manua
block breaking we need to set it after the prediction is finished. This fixes block entities not showing when cancelling the BlockBreakEvent.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index bf9b185e3defb496022c20ec60a84a4f6f99d5be..4e1ed252bf400ec991f95b02984f01a9689f2989 100644
index bf9b185e3defb496022c20ec60a84a4f6f99d5be..c29ac2fd8dd08fe0c87abc3efb92e539dfdfd739 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -62,6 +62,8 @@ public class ServerPlayerGameMode {
private BlockPos delayedDestroyPos;
private int delayedTickStart;
private int lastSentState;
+ public boolean captureSentBlockEntities = false; // Paper
+ public boolean capturedBlockEntity = false; // Paper
+ public boolean captureSentBlockEntities = false; // Paper - Send block entities after destroy prediction
+ public boolean capturedBlockEntity = false; // Paper - Send block entities after destroy prediction
public ServerPlayerGameMode(ServerPlayer player) {
this.gameModeForPlayer = GameType.DEFAULT_MODE;
@ -27,7 +27,7 @@ index bf9b185e3defb496022c20ec60a84a4f6f99d5be..4e1ed252bf400ec991f95b02984f01a9
- if (tileentity != null) {
- this.player.connection.send(tileentity.getUpdatePacket());
- }
+ capturedBlockEntity = true; // Paper - send block entity after predicting
+ capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
// CraftBukkit end
return;
}
@ -39,7 +39,7 @@ index bf9b185e3defb496022c20ec60a84a4f6f99d5be..4e1ed252bf400ec991f95b02984f01a9
- if (tileentity != null) {
- this.player.connection.send(tileentity.getUpdatePacket());
- }
+ capturedBlockEntity = true; // Paper - send block entity after predicting
+ capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
return;
}
// CraftBukkit end
@ -47,30 +47,30 @@ index bf9b185e3defb496022c20ec60a84a4f6f99d5be..4e1ed252bf400ec991f95b02984f01a9
}
// Update any tile entity data for this block
+ if (!captureSentBlockEntities) { // Paper - Toggle this location for capturing as this is used for api
+ if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction
BlockEntity tileentity = this.level.getBlockEntity(pos);
if (tileentity != null) {
this.player.connection.send(tileentity.getUpdatePacket());
}
+ } else {capturedBlockEntity = true;} // Paper end
+ } else {capturedBlockEntity = true;} // Paper - Send block entities after destroy prediction
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 94ea292ea1754c5b0b0776a2dcce034194fb0290..3f60f33c43dfcc4ea99a80c66a70222b2ea2f4a6 100644
index 6498ce505226d35f30062bc3aa52388b739c13fe..e6bb211374b7fba2e275dd43604ab5a171c833d7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1783,8 +1783,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
// Paper end - Don't allow digging in unloaded chunks
+ // Paper start - send block entities after prediction
+ // Paper start - Send block entities after destroy prediction
+ this.player.gameMode.capturedBlockEntity = false;
+ this.player.gameMode.captureSentBlockEntities = true;
+ // Paper end - send block entities after prediction
+ // Paper end - Send block entities after destroy prediction
this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level().getMaxBuildHeight(), packet.getSequence());
this.player.connection.ackBlockChangesUpTo(packet.getSequence());
+ // Paper start - send block entities after prediction
+ // Paper start - Send block entities after destroy prediction
+ this.player.gameMode.captureSentBlockEntities = false;
+ // If a block entity was modified speedup the block change ack to avoid the block entity
+ // being overriden.
@ -85,7 +85,7 @@ index 94ea292ea1754c5b0b0776a2dcce034194fb0290..3f60f33c43dfcc4ea99a80c66a70222b
+ this.player.connection.send(tileentity.getUpdatePacket());
+ }
+ }
+ // Paper end - send block entities after prediction
+ // Paper end - Send block entities after destroy prediction
return;
default:
throw new IllegalArgumentException("Invalid player action");

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Warn on plugins accessing faraway chunks
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 8200844b73dc7181d5867aafa83087e09ff2df76..28ed2605bc3f4d657f6f58729134aeb81a98dac4 100644
index 8200844b73dc7181d5867aafa83087e09ff2df76..e853c9fdc8ebde6a653aacbb1db6679ce4d9d50b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -813,7 +813,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -13,7 +13,7 @@ index 8200844b73dc7181d5867aafa83087e09ff2df76..28ed2605bc3f4d657f6f58729134aeb8
private static boolean isInWorldBoundsHorizontal(BlockPos pos) {
- return pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000;
+ return pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000; // Dif on change
+ return pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000; // Diff on change warnUnsafeChunk()
}
private static boolean isOutsideSpawnableHeight(int y) {

Datei anzeigen

@ -10,7 +10,7 @@ potentially waterlogged block states fading.
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com
diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
index a4ca58384ae2a39ec568b153cc1a4f7704136108..0a2de99c22cfcc96a664dc2afe7379987ea815db 100644
index a4ca58384ae2a39ec568b153cc1a4f7704136108..3777e60d0b81e242b1a6e9b0be3e2f21a1642335 100644
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
@@ -92,6 +92,11 @@ public class FrogspawnBlock extends Block {
@ -21,7 +21,7 @@ index a4ca58384ae2a39ec568b153cc1a4f7704136108..0a2de99c22cfcc96a664dc2afe737998
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.AIR.defaultBlockState()).isCancelled()) {
+ return;
+ }
+ // Paper end
+ // Paper end - Call BlockFadeEvent
this.destroyBlock(world, pos);
world.playSound((Player)null, pos, SoundEvents.FROGSPAWN_HATCH, SoundSource.BLOCKS, 1.0F, 1.0F);
this.spawnTadpoles(world, pos, random);
@ -39,20 +39,20 @@ index f660e58badfcc2a90e6dd618428a21bf5ad34969..13ee09f93ec325e416a2b29e3608e870
FallingBlockEntity.fall(world, pos, iblockdata1);
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
index 615ee22b4948d6a4869dc8b2111f48056969dd79..3cedc349e79665d3d471c92b5dca25c9e66ca0bf 100644
index 615ee22b4948d6a4869dc8b2111f48056969dd79..8782b05575e4a8d5e5c667c43808442b81c13f6b 100644
--- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
@@ -61,12 +61,26 @@ public class SnifferEggBlock extends Block {
return this.getHatchLevel(state) == 2;
}
+ // Paper start
+ // Paper start - Call BlockFadeEvent
+ private void rescheduleTick(ServerLevel world, BlockPos pos) {
+ int baseDelay = hatchBoost(world, pos) ? BOOSTED_HATCH_TIME_TICKS : REGULAR_HATCH_TIME_TICKS;
+ world.scheduleTick(pos, this, (baseDelay / 3) + world.random.nextInt(RANDOM_HATCH_OFFSET_TICKS));
+ // reschedule to avoid being stuck here and behave like the other calls (see #onPlace)
+ }
+ // Paper end
+ // Paper end - Call BlockFadeEvent
+
@Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
@ -65,7 +65,7 @@ index 615ee22b4948d6a4869dc8b2111f48056969dd79..3cedc349e79665d3d471c92b5dca25c9
+ rescheduleTick(world, pos);
+ return;
+ }
+ // Paper end
+ // Paper end - Call BlockFadeEvent
world.playSound((Player)null, pos, SoundEvents.SNIFFER_EGG_HATCH, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
world.destroyBlock(pos, false);
Sniffer sniffer = EntityType.SNIFFER.create(world);

Datei anzeigen

@ -15,10 +15,10 @@ login plugin message packet.
diff --git a/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
new file mode 100644
index 0000000000000000000000000000000000000000..a34381122de53123169927e181df662814df4816
index 0000000000000000000000000000000000000000..3c31ff3330c2e925e205c0c9ff4f0b832682b576
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
@@ -0,0 +1,75 @@
@@ -0,0 +1,86 @@
+package com.destroystokyo.paper.proxy;
+
+import io.papermc.paper.configuration.GlobalConfiguration;
@ -37,6 +37,17 @@ index 0000000000000000000000000000000000000000..a34381122de53123169927e181df6628
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.world.entity.player.ProfilePublicKey;
+
+/**
+ * While Velocity supports BungeeCord-style IP forwarding, it is not secure. Users
+ * have a lot of problems setting up firewalls or setting up plugins like IPWhitelist.
+ * Further, the BungeeCord IP forwarding protocol still retains essentially its original
+ * form, when there is brand-new support for custom login plugin messages in 1.13.
+ * <p>
+ * Velocity's modern IP forwarding uses an HMAC-SHA256 code to ensure authenticity
+ * of messages, is packed into a binary format that is smaller than BungeeCord's
+ * forwarding, and is integrated into the Minecraft login process by using the 1.13
+ * login plugin message packet.
+ */
+public class VelocityProxy {
+ private static final int SUPPORTED_FORWARDING_VERSION = 1;
+ public static final int MODERN_FORWARDING_WITH_KEY = 2;
@ -95,18 +106,18 @@ index 0000000000000000000000000000000000000000..a34381122de53123169927e181df6628
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 4d7124ae7cefcc8c65bf74ac9d3c103fe6817c42..9d7e1b306f8c96883dbe1adbf7e77825da4cbc21 100644
index 4d7124ae7cefcc8c65bf74ac9d3c103fe6817c42..bbe9ad20a664bcd3952f3a4643add957d20fce20 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -274,13 +274,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
// CraftBukkit end
+ // Paper start
+ // Paper start - Add Velocity IP Forwarding Support
+ boolean usingProxy = org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled;
+ String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
+ String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
+ // Paper end
+ // Paper end - Add Velocity IP Forwarding Support
if (!this.usesAuthentication()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@ -114,23 +125,23 @@ index 4d7124ae7cefcc8c65bf74ac9d3c103fe6817c42..9d7e1b306f8c96883dbe1adbf7e77825
- if (org.spigotmc.SpigotConfig.bungee) {
- DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.");
- DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information.");
+ // Paper start
+ // Paper start - Add Velocity IP Forwarding Support
+ if (usingProxy) {
+ DedicatedServer.LOGGER.warn("Whilst this makes it possible to use " + proxyFlavor + ", unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.");
+ DedicatedServer.LOGGER.warn("Please see " + proxyLink + " for further information.");
+ // Paper end
+ // Paper end - Add Velocity IP Forwarding Support
} else {
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
}
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 6121a3879eeb1d13653e93da02ecdbbcb2a866ac..b9117be53b8b8b37af54621f54480f275546f0fd 100644
index 6121a3879eeb1d13653e93da02ecdbbcb2a866ac..a9f5af48c1f97b2e635727b48f4383502b17d82f 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -64,6 +64,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
private final String serverId;
private ServerPlayer player; // CraftBukkit
public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding
+ private int velocityLoginMessageId = -1; // Paper - Velocity support
+ private int velocityLoginMessageId = -1; // Paper - Add Velocity IP Forwarding Support
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) {
this.state = ServerLoginPacketListenerImpl.State.HELLO;
@ -138,7 +149,7 @@ index 6121a3879eeb1d13653e93da02ecdbbcb2a866ac..b9117be53b8b8b37af54621f54480f27
this.state = ServerLoginPacketListenerImpl.State.KEY;
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge));
} else {
+ // Paper start - Velocity support
+ // Paper start - Add Velocity IP Forwarding Support
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) {
+ this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt();
+ net.minecraft.network.FriendlyByteBuf buf = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.buffer());
@ -147,7 +158,7 @@ index 6121a3879eeb1d13653e93da02ecdbbcb2a866ac..b9117be53b8b8b37af54621f54480f27
+ this.connection.send(packet1);
+ return;
+ }
+ // Paper end
+ // Paper end - Add Velocity IP Forwarding Support
// CraftBukkit start
// Paper start - Cache authenticator threads
authenticatorPool.execute(new Runnable() {
@ -155,12 +166,12 @@ index 6121a3879eeb1d13653e93da02ecdbbcb2a866ac..b9117be53b8b8b37af54621f54480f27
// CraftBukkit start
private GameProfile callPlayerPreLoginEvents(GameProfile gameprofile) throws Exception { // Paper - Add more fields to AsyncPlayerPreLoginEvent
+ // Paper start - Velocity support
+ // Paper start - Add Velocity IP Forwarding Support
+ if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) {
+ disconnect("This server requires you to connect with Velocity.");
+ return gameprofile;
+ }
+ // Paper end - Velocity support
+ // Paper end - Add Velocity IP Forwarding Support
String playerName = gameprofile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
java.util.UUID uniqueId = gameprofile.getId();
@ -168,7 +179,7 @@ index 6121a3879eeb1d13653e93da02ecdbbcb2a866ac..b9117be53b8b8b37af54621f54480f27
@Override
public void handleCustomQueryPacket(ServerboundCustomQueryAnswerPacket packet) {
+ // Paper start - Velocity support
+ // Paper start - Add Velocity IP Forwarding Support
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && packet.transactionId() == this.velocityLoginMessageId) {
+ ServerboundCustomQueryAnswerPacket.QueryAnswerPayload payload = (ServerboundCustomQueryAnswerPacket.QueryAnswerPayload)packet.payload();
+ if (payload == null) {
@ -212,12 +223,12 @@ index 6121a3879eeb1d13653e93da02ecdbbcb2a866ac..b9117be53b8b8b37af54621f54480f27
+ });
+ return;
+ }
+ // Paper end
+ // Paper end - Add Velocity IP Forwarding Support
this.disconnect(ServerLoginPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 84d6b1b3ec3972281218cbe5e72c9d4ce6419c59..56e5dff13323068ad2911649e6285aa915d787bd 100644
index 7749d9740c965baf901512b242426f9a15aca24f..7f238c76a57c9d26c0bafa3f7b4f0436c0a1b93b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -803,7 +803,7 @@ public final class CraftServer implements Server {
@ -225,7 +236,7 @@ index 84d6b1b3ec3972281218cbe5e72c9d4ce6419c59..56e5dff13323068ad2911649e6285aa9
public long getConnectionThrottle() {
// Spigot Start - Automatically set connection throttle for bungee configurations
- if (org.spigotmc.SpigotConfig.bungee) {
+ if (org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { // Paper - Velocity support
+ if (org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { // Paper - Add Velocity IP Forwarding Support
return -1;
} else {
return this.configuration.getInt("settings.connection-throttle");

Datei anzeigen

@ -49,18 +49,18 @@ index 002511a54565aab9eb4552fecdf974fe0eab9122..7c9f7aefc59ae1a785b261f80f25d330
// Paper end - move final shutdown items here
}
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 37faa5ce82ae9ca2893250d86cc2eb21c00cc81f..aca49044899f65d7e91e5762fb58dbaffbfbd4c9 100644
index 37faa5ce82ae9ca2893250d86cc2eb21c00cc81f..39f361e2d3b31dc2587042df225132884a9156c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -18,6 +18,12 @@ public class Main {
public static boolean useJline = true;
public static boolean useConsole = true;
+ // Paper start - Hijack log manager to ensure logging on shutdown
+ // Paper start - Reset loggers after shutdown
+ static {
+ System.setProperty("java.util.logging.manager", "io.papermc.paper.log.CustomLogManager");
+ }
+ // Paper end
+ // Paper end - Reset loggers after shutdown
+
public static void main(String[] args) {
// Paper start

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fire EntityChangeBlockEvent in more places
Co-authored-by: ChristopheG <61288881+chrisgdt@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java
index 09c981e2573305bd7f5c3cbcc8f240fa8705a9f2..17f664f75aaaea042477e4b467c17c17d1024e3d 100644
index 09c981e2573305bd7f5c3cbcc8f240fa8705a9f2..0db0d67f9ac15372becc1166c37f7f0aede4a4da 100644
--- a/src/main/java/net/minecraft/world/entity/LightningBolt.java
+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java
@@ -97,7 +97,7 @@ public class LightningBolt extends Entity {
@ -14,7 +14,7 @@ index 09c981e2573305bd7f5c3cbcc8f240fa8705a9f2..17f664f75aaaea042477e4b467c17c17
this.powerLightningRod();
- LightningBolt.clearCopperOnLightningStrike(this.level(), this.getStrikePosition());
+ LightningBolt.clearCopperOnLightningStrike(this.level(), this.getStrikePosition(), this); // Paper - transmit LightningBolt instance to call EntityChangeBlockEvent
+ LightningBolt.clearCopperOnLightningStrike(this.level(), this.getStrikePosition(), this); // Paper - Call EntityChangeBlockEvent
this.gameEvent(GameEvent.LIGHTNING_STRIKE);
}
}
@ -23,7 +23,7 @@ index 09c981e2573305bd7f5c3cbcc8f240fa8705a9f2..17f664f75aaaea042477e4b467c17c17
}
- private static void clearCopperOnLightningStrike(Level world, BlockPos pos) {
+ private static void clearCopperOnLightningStrike(Level world, BlockPos pos, Entity lightning) { // Paper - transmit LightningBolt instance to call EntityChangeBlockEvent
+ private static void clearCopperOnLightningStrike(Level world, BlockPos pos, Entity lightning) { // Paper - Call EntityChangeBlockEvent
BlockState iblockdata = world.getBlockState(pos);
BlockPos blockposition1;
BlockState iblockdata1;
@ -32,12 +32,12 @@ index 09c981e2573305bd7f5c3cbcc8f240fa8705a9f2..17f664f75aaaea042477e4b467c17c17
if (iblockdata1.getBlock() instanceof WeatheringCopper) {
- world.setBlockAndUpdate(blockposition1, WeatheringCopper.getFirst(world.getBlockState(blockposition1)));
+ // Paper start - call EntityChangeBlockEvent
+ // Paper start - Call EntityChangeBlockEvent
+ BlockState newBlock = WeatheringCopper.getFirst(world.getBlockState(blockposition1));
+ if (CraftEventFactory.callEntityChangeBlockEvent(lightning, blockposition1, newBlock)) {
+ world.setBlockAndUpdate(blockposition1, newBlock);
+ }
+ // Paper end
+ // Paper end - Call EntityChangeBlockEvent
BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable();
int i = world.random.nextInt(3) + 3;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Missing eating regain reason
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
index 40af8405c6f3ecc5a8168bb62607eb79862cefa6..de51ce9875e12961e6e549e87d76f492d2f19787 100644
index 40af8405c6f3ecc5a8168bb62607eb79862cefa6..ff32fb9e2302cf34f6ddd5647706d37980342657 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
@@ -387,7 +387,7 @@ public class Cat extends TamableAnimal implements VariantHolder<CatVariant> {
@ -13,12 +13,12 @@ index 40af8405c6f3ecc5a8168bb62607eb79862cefa6..de51ce9875e12961e6e549e87d76f492
if (item.isEdible() && this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) {
this.usePlayerItem(player, hand, itemstack);
- this.heal((float) item.getFoodProperties().getNutrition());
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper - Add missing regain reason
return InteractionResult.CONSUME;
}
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 3aa98f7c282cb4884589cb83b1546b924e66f096..faf3e31f23d71bbc345bf98d4240490ac4677843 100644
index 3aa98f7c282cb4884589cb83b1546b924e66f096..570b39592e7e3a24828c233ec2a2f113b9ef5868 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -384,7 +384,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
@ -26,12 +26,12 @@ index 3aa98f7c282cb4884589cb83b1546b924e66f096..faf3e31f23d71bbc345bf98d4240490a
boolean bl = this.getHealth() < this.getMaxHealth();
if (bl) {
- this.heal(2.0F);
+ this.heal(2.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper
+ this.heal(2.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper - Add missing regain reason
}
boolean bl2 = this.isTamed() && this.getAge() == 0 && this.canFallInLove();
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 91fb62807b3c5600c83d4dc8d3fadf36e94e2133..5f61c97478f005aaaaad1b027118079db7275cf7 100644
index 91fb62807b3c5600c83d4dc8d3fadf36e94e2133..9b5b894d43f25566ab9c3698705e978ab823a0d2 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -196,7 +196,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
@ -39,7 +39,7 @@ index 91fb62807b3c5600c83d4dc8d3fadf36e94e2133..5f61c97478f005aaaaad1b027118079d
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
- this.heal(f);
+ this.heal(f, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper
+ this.heal(f, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper - Add missing regain reason
flag = true;
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Missing effect cause
diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index af5db5da4e5b2fd90a5cf0ca3c92e87ba82d4779..387006271c246362b0df1bfcadca7b7096660003 100644
index af5db5da4e5b2fd90a5cf0ca3c92e87ba82d4779..b21e180641d17438997a80e5bcb0ec7998d24a2e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -419,7 +419,7 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder<Axolo
@ -13,12 +13,12 @@ index af5db5da4e5b2fd90a5cf0ca3c92e87ba82d4779..387006271c246362b0df1bfcadca7b70
}
- player.removeEffect(MobEffects.DIG_SLOWDOWN);
+ player.removeEffect(MobEffects.DIG_SLOWDOWN, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // Paper
+ player.removeEffect(MobEffects.DIG_SLOWDOWN, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // Paper - Add missing effect cause
}
@Override
diff --git a/src/main/java/net/minecraft/world/item/HoneyBottleItem.java b/src/main/java/net/minecraft/world/item/HoneyBottleItem.java
index c8e783014a6a09d59e85715a7fbf2a5f65201e77..5cba503c7342f66018af568be200999e14aa8d6e 100644
index c8e783014a6a09d59e85715a7fbf2a5f65201e77..92266e56200815aa88ebf91bc1ff1a440788275d 100644
--- a/src/main/java/net/minecraft/world/item/HoneyBottleItem.java
+++ b/src/main/java/net/minecraft/world/item/HoneyBottleItem.java
@@ -28,7 +28,7 @@ public class HoneyBottleItem extends Item {
@ -26,12 +26,12 @@ index c8e783014a6a09d59e85715a7fbf2a5f65201e77..5cba503c7342f66018af568be200999e
if (!world.isClientSide) {
- user.removeEffect(MobEffects.POISON);
+ user.removeEffect(MobEffects.POISON, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper
+ user.removeEffect(MobEffects.POISON, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause
}
if (stack.isEmpty()) {
diff --git a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
index 8a7ab376a260bd70a799ce182a03450b3916f733..ba6dc881343148a17ed02486650e51b1e3bdd73c 100644
index 8a7ab376a260bd70a799ce182a03450b3916f733..06ef78580de95bfa0e86f307997664e7b3addaea 100644
--- a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
+++ b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
@@ -66,7 +66,7 @@ public class SuspiciousStewItem extends Item {
@ -39,7 +39,7 @@ index 8a7ab376a260bd70a799ce182a03450b3916f733..ba6dc881343148a17ed02486650e51b1
ItemStack itemStack = super.finishUsingItem(stack, world, user);
listPotionEffects(itemStack, (effect) -> {
- user.addEffect(effect.createEffectInstance());
+ user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper
+ user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause
});
return user instanceof Player && ((Player)user).getAbilities().instabuild ? itemStack : new ItemStack(Items.BOWL);
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Call BlockPhysicsEvent more often
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
index 7d54abc2553f4b319df4d533a0b689c1807b6102..598dc0d3a2b9387e76d7e4e19e54c4573a24bc54 100644
index 7d54abc2553f4b319df4d533a0b689c1807b6102..395bb163fb1d62dd2e6949e1146c337c0bbc626f 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -119,7 +119,27 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
@ -13,7 +13,7 @@ index 7d54abc2553f4b319df4d533a0b689c1807b6102..598dc0d3a2b9387e76d7e4e19e54c457
BlockPos blockPos = this.sourcePos.relative(NeighborUpdater.UPDATE_ORDER[this.idx++]);
BlockState blockState = world.getBlockState(blockPos);
- NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, this.sourcePos, false);
+ // Paper start
+ // Paper start - Call BlockPhysicsEvent
+ try {
+ boolean cancelled = false;
+ org.bukkit.craftbukkit.CraftWorld cworld = world.getWorld();
@ -33,7 +33,7 @@ index 7d54abc2553f4b319df4d533a0b689c1807b6102..598dc0d3a2b9387e76d7e4e19e54c457
+ } catch (StackOverflowError ex) {
+ world.lastPhysicsProblem = new BlockPos(blockPos);
+ }
+ // Paper end
+ // Paper end - Call BlockPhysicsEvent
if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) {
++this.idx;
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] fix Jigsaw block kicking user
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
index 72d89e8999825b43a36ed9ee8f4545bde3927690..3a210e138b6ae065fd32e1b1e0e49999e20c4667 100644
index 72d89e8999825b43a36ed9ee8f4545bde3927690..e2e31d6383c7de4f2eede46987d51978a5692639 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
@@ -133,7 +133,12 @@ public class JigsawBlockEntity extends BlockEntity {
@ -18,7 +18,7 @@ index 72d89e8999825b43a36ed9ee8f4545bde3927690..3a210e138b6ae065fd32e1b1e0e49999
+ if (holder == null) {
+ return;
+ }
+ // Paper end
+ // Paper end - Replace getHolderOrThrow with a null check
JigsawPlacement.generateJigsaw(world, holder, this.target, maxDepth, blockPos, keepJigsaws);
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] use BlockFormEvent for mud converting into clay
diff --git a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
index e59f9b83606da83f15924477ea2a2c4b74e7d892..bd22d3fdecbc992b11073a74d854b7d1b43c3f6a 100644
index e59f9b83606da83f15924477ea2a2c4b74e7d892..e310abaca79615caaa75d92183a57242734266a3 100644
--- a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
@@ -220,10 +220,13 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate
@ -13,13 +13,13 @@ index e59f9b83606da83f15924477ea2a2c4b74e7d892..bd22d3fdecbc992b11073a74d854b7d1
BlockState iblockdata1 = Blocks.CLAY.defaultBlockState();
- world.setBlockAndUpdate(((PointedDripstoneBlock.FluidInfo) optional.get()).pos, iblockdata1);
+ // Paper start
+ // Paper start - Call BlockFormEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, ((PointedDripstoneBlock.FluidInfo) optional.get()).pos, iblockdata1)) {
Block.pushEntitiesUp(((PointedDripstoneBlock.FluidInfo) optional.get()).sourceState, iblockdata1, world, ((PointedDripstoneBlock.FluidInfo) optional.get()).pos);
world.gameEvent(GameEvent.BLOCK_CHANGE, ((PointedDripstoneBlock.FluidInfo) optional.get()).pos, GameEvent.Context.of(iblockdata1));
world.levelEvent(1504, blockposition1, 0);
+ }
+ //Paper end
+ // Paper end - Call BlockFormEvent
} else {
BlockPos blockposition2 = PointedDripstoneBlock.findFillableCauldronBelowStalactiteTip(world, blockposition1, fluidtype);

Datei anzeigen

@ -64,6 +64,12 @@ https://bugs.mojang.com/browse/MC-153086
https://bugs.mojang.com/browse/MC-200092
Fix yaw being ignored for a player's first spawn pos
https://bugs.mojang.com/browse/MC-158900
Fix error when joining after tempban expired
https://bugs.mojang.com/browse/MC-259571
Fix last gamemode not being saved on death or reload
== AT ==
public net/minecraft/world/entity/Mob leashInfoTag
@ -136,7 +142,7 @@ index 2bfa9d1abf7a777b588314d314d06be3b4d2c6a5..0a4586d1b847de49d9e6faa16dba6de4
if (!list.isEmpty()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 08acf8c6e6c624016ca97eef15da29d338433411..e6b6dcdb08e71fbcb27757413816c1329510eadc 100644
index f2677922cb97c9aa34f2e80769ac9cccc3dc8089..958b013cc4805704cec9a87835f3541e7d3c7faa 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -468,14 +468,14 @@ public class ServerPlayer extends Player {
@ -157,7 +163,7 @@ index 08acf8c6e6c624016ca97eef15da29d338433411..e6b6dcdb08e71fbcb27757413816c132
while (!world.noCollision(this, this.getBoundingBox(), true) && this.getY() < (double) (world.getMaxBuildHeight() - 1)) { // Paper - make sure this loads chunks, we default to NOT loading now
this.setPos(this.getX(), this.getY() + 1.0D, this.getZ());
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 4e1ed252bf400ec991f95b02984f01a9689f2989..805c9b9b0e89002b97e1e11e1e6e2435315b8f2c 100644
index c29ac2fd8dd08fe0c87abc3efb92e539dfdfd739..08a013310970c8223b2e942992a0df2e99fb419b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -92,7 +92,7 @@ public class ServerPlayerGameMode {
@ -279,7 +285,7 @@ index 19540fd4a7f992888fadb6501d0c8a5a7e71fcf6..e241ae250f4f04a17ef2c583d00b065a
public void start() {
this.creeper.getNavigation().stop();
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index 363892e0c26bab89d2abaa44d8736e2fd84d292f..111a244087e24f25ba8524a46a228da10cd9498a 100644
index cafea947d49b729268c0fce98ce7fcf4b0c69478..2e631060d1b46c4cfeb8a64b879e995e7109fee8 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -239,9 +239,10 @@ public class Goat extends Animal {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Remove unnecessary onTrackingStart during navigation warning
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0a4586d1b847de49d9e6faa16dba6de4a6a7cca6..c3ee52f2ad47c6f92b0e8cb284a14a3376fabba7 100644
index 0a4586d1b847de49d9e6faa16dba6de4a6a7cca6..a1411657b226c3eb3fb68bbf7f7afe8524fd96b2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2641,7 +2641,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -13,7 +13,7 @@ index 0a4586d1b847de49d9e6faa16dba6de4a6a7cca6..c3ee52f2ad47c6f92b0e8cb284a14a33
Mob entityinsentient = (Mob) entity;
- if (ServerLevel.this.isUpdatingNavigations) {
+ if (false && ServerLevel.this.isUpdatingNavigations) { // Paper
+ if (false && ServerLevel.this.isUpdatingNavigations) { // Paper - Remove unnecessary onTrackingStart during navigation warning
String s = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
@ -22,7 +22,7 @@ index 0a4586d1b847de49d9e6faa16dba6de4a6a7cca6..c3ee52f2ad47c6f92b0e8cb284a14a33
Mob entityinsentient = (Mob) entity;
- if (ServerLevel.this.isUpdatingNavigations) {
+ if (false && ServerLevel.this.isUpdatingNavigations) { // Paper
+ if (false && ServerLevel.this.isUpdatingNavigations) { // Paper - Remove unnecessary onTrackingStart during navigation warning
String s = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));

Datei anzeigen

@ -12,7 +12,7 @@ Fires the event when a Raider tries to pick up a raid banner
to become raid leader.
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
index 1c42425b9211bea7cb189e967e566ad80fd278c2..6407ddef8442fce4f310ac4babf3e3de0dd5fc9a 100644
index 1c42425b9211bea7cb189e967e566ad80fd278c2..7c1715c9f29eda23b9b517769fdd338c94ecbf8d 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -424,7 +424,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@ -20,12 +20,12 @@ index 1c42425b9211bea7cb189e967e566ad80fd278c2..6407ddef8442fce4f310ac4babf3e3de
@Override
protected void pickUpItem(ItemEntity item) {
- this.onItemPickup(item);
+ // this.onItemPickup(item); // Paper - call in PiglinAi#pickUpItem after EntityPickupItemEvent is fired
+ // this.onItemPickup(item); // Paper - EntityPickupItemEvent fixes; call in PiglinAi#pickUpItem after EntityPickupItemEvent is fired
PiglinAi.pickUpItem(this, item);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index f0059bd69705ecc7964867b103c93e1df9985803..372d084609216d5437b92ee60810a9efbb0b6f31 100644
index f0059bd69705ecc7964867b103c93e1df9985803..abf3d76c3f50536ba9b4e0acdc6f654bba7dd5e8 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -241,11 +241,16 @@ public class PiglinAi {
@ -33,32 +33,32 @@ index f0059bd69705ecc7964867b103c93e1df9985803..372d084609216d5437b92ee60810a9ef
// CraftBukkit start
- if (drop.getItem().is(Items.GOLD_NUGGET) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled()) {
+ // Paper start - fix event firing twice
+ // Paper start - EntityPickupItemEvent fixes; fix event firing twice
+ if (drop.getItem().is(Items.GOLD_NUGGET) /* && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled() */) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled()) return;
+ piglin.onItemPickup(drop); // Paper - moved from Piglin#pickUpItem - call prior to item entity modification
+ // Paper end
+ // Paper end - EntityPickupItemEvent fixes
piglin.take(drop, drop.getItem().getCount());
itemstack = drop.getItem();
drop.discard();
} else if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, drop.getItem().getCount() - 1, false).isCancelled()) {
+ piglin.onItemPickup(drop); // Paper - moved from Piglin#pickUpItem - call prior to item entity modification
+ piglin.onItemPickup(drop); // Paper - EntityPickupItemEvent fixes; moved from Piglin#pickUpItem - call prior to item entity modification
piglin.take(drop, 1);
itemstack = PiglinAi.removeOneItemFromItemEntity(drop);
} else {
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index 5538f7a9024d8708b70de836aa78a4015656a828..cdbc925ef61b8b439415f0a89368227890bcecb2 100644
index 5538f7a9024d8708b70de836aa78a4015656a828..0df80ba3af983c0947aca64e6940df1e584f14db 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -245,6 +245,11 @@ public abstract class Raider extends PatrollingMonster {
boolean flag = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null;
if (this.hasActiveRaid() && !flag && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance())) {
+ // Paper start
+ // Paper start - EntityPickupItemEvent fixes
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, item, 0, false).isCancelled()) {
+ return;
+ }
+ // Paper end
+ // Paper end - EntityPickupItemEvent fixes
EquipmentSlot enumitemslot = EquipmentSlot.HEAD;
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
double d0 = (double) this.getEquipmentDropChance(enumitemslot);

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Correctly handle interactions with items on cooldown
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 805c9b9b0e89002b97e1e11e1e6e2435315b8f2c..f58386e952d29a16d160b628a23efbe102791277 100644
index 08a013310970c8223b2e942992a0df2e99fb419b..9fcac4412d7af04b233e34bd4b5501bcb61855e2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -516,6 +516,7 @@ public class ServerPlayerGameMode {
@ -25,7 +25,7 @@ index 805c9b9b0e89002b97e1e11e1e6e2435315b8f2c..f58386e952d29a16d160b628a23efbe1
}
- PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, hand, hitResult.getLocation());
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, cancelledItem, hand, hitResult.getLocation()); // Paper
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, cancelledItem, hand, hitResult.getLocation()); // Paper - correctly handle items on cooldown
this.firedInteract = true;
this.interactResult = event.useItemInHand() == Event.Result.DENY;
this.interactPosition = blockposition.immutable();

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Add PlayerInventorySlotChangeEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index e6b6dcdb08e71fbcb27757413816c1329510eadc..24e6808e325bd80a55c94309aeab835804b03973 100644
index 958b013cc4805704cec9a87835f3541e7d3c7faa..8c7356f06e4e7fcaac6fd04fbfd7b471e3bbeaef 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -379,6 +379,25 @@ public class ServerPlayer extends Player {
}
}
+ // Paper start
+ // Paper start - Add PlayerInventorySlotChangeEvent
+ @Override
+ public void slotChanged(AbstractContainerMenu handler, int slotId, ItemStack oldStack, ItemStack stack) {
+ Slot slot = handler.getSlot(slotId);
@ -30,12 +30,12 @@ index e6b6dcdb08e71fbcb27757413816c1329510eadc..24e6808e325bd80a55c94309aeab8358
+ }
+ }
+ }
+ // Paper end
+ // Paper end - Add PlayerInventorySlotChangeEvent
@Override
public void dataChanged(AbstractContainerMenu handler, int property, int value) {}
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index b22cf4636108794092d8e289368b72a10a16d3cd..c18348f4ea79b15b081cf7ba3bd9d77212aa086e 100644
index b22cf4636108794092d8e289368b72a10a16d3cd..2a73cdc6b347aa31a74c2372b0bdc7b00706004a 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -302,7 +302,7 @@ public abstract class AbstractContainerMenu {
@ -43,23 +43,23 @@ index b22cf4636108794092d8e289368b72a10a16d3cd..c18348f4ea79b15b081cf7ba3bd9d772
ContainerListener icrafting = (ContainerListener) iterator.next();
- icrafting.slotChanged(this, slot, itemstack2);
+ icrafting.slotChanged(this, slot, itemstack1, itemstack2); // Paper
+ icrafting.slotChanged(this, slot, itemstack1, itemstack2); // Paper - Add PlayerInventorySlotChangeEvent
}
}
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerListener.java b/src/main/java/net/minecraft/world/inventory/ContainerListener.java
index 0e19cc55646625bf32a354d3df2dc2d6bcff96f4..8ca9c14310b1e809662dd4ca6d35668992c2fc8d 100644
index 0e19cc55646625bf32a354d3df2dc2d6bcff96f4..eba024c9aadef8902aacccea1584ffbee6c04e44 100644
--- a/src/main/java/net/minecraft/world/inventory/ContainerListener.java
+++ b/src/main/java/net/minecraft/world/inventory/ContainerListener.java
@@ -5,5 +5,11 @@ import net.minecraft.world.item.ItemStack;
public interface ContainerListener {
void slotChanged(AbstractContainerMenu handler, int slotId, ItemStack stack);
+ // Paper start
+ // Paper start - Add PlayerInventorySlotChangeEvent
+ default void slotChanged(AbstractContainerMenu handler, int slotId, ItemStack oldStack, ItemStack stack) {
+ slotChanged(handler, slotId, stack);
+ }
+ // Paper end
+ // Paper end - Add PlayerInventorySlotChangeEvent
+
void dataChanged(AbstractContainerMenu handler, int property, int value);
}

Datei anzeigen

@ -27,14 +27,14 @@ index 6bd0afddbcc461149dfe9a5c7a86fff6ea13a5f1..148d233f4f5278ff39eacdaa0f4f0e7d
+ }
}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 9b0bbaf23b90a04b6e6f6c97d9174fe31af557ce..786104fb12f02f493619dfc0d81ab98140d70912 100644
index 9b0bbaf23b90a04b6e6f6c97d9174fe31af557ce..a2d7ed6c68729d1d46b1ac949b7e98cd6badedba 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -175,6 +175,18 @@ public class Main {
return;
}
+ // Paper start - Warn on headless
+ // Paper start - Detect headless JRE
+ String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck();
+ if (awtException != null) {
+ Main.LOGGER.error("You are using a headless JRE distribution.");
@ -44,7 +44,7 @@ index 9b0bbaf23b90a04b6e6f6c97d9174fe31af557ce..786104fb12f02f493619dfc0d81ab981
+ Main.LOGGER.error(awtException);
+ return;
+ }
+ // Paper end
+ // Paper end - Detect headless JRE
+
org.spigotmc.SpigotConfig.disabledAdvancements = spigotConfiguration.getStringList("advancements.disabled"); // Paper - fix SPIGOT-5885, must be set early in init
// Paper start - fix SPIGOT-5824

Datei anzeigen

@ -47,7 +47,7 @@ index 90e4e0ec0c7b0ece23c4b53f5f12b1f24e1c18ad..295769d039f2a1e4f48912a60f9dbe26
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 36b3945832733b5ad66d25aa3a31335234d2acff..47a5125e44cea1ece84657cdb874807f13ee824f 100644
index 0e85e3ab58d848b119212fa7d2eb4f92d3efe29b..0a5b953bd8c0c7f181da4090b950e9e6524b6d61 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -347,11 +347,16 @@ public class Sniffer extends Animal {
@ -65,9 +65,9 @@ index 36b3945832733b5ad66d25aa3a31335234d2acff..47a5125e44cea1ece84657cdb874807f
entityitem.setDefaultPickUpDelay();
- this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob) null);
+ this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob) null, result.getExperience()); // Paper - Add EntityFertilizeEggEvent event
if (this.spawnAtLocation(entityitem) != null) { // Paper - call EntityDropItemEvent
if (this.spawnAtLocation(entityitem) != null) { // Paper - Call EntityDropItemEvent
this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F);
} // Paper
} // Paper - Call EntityDropItemEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index f5a1ff50e8943d7ea75f8b8534b17f7788d094e2..5b95d95c89b962315dd07afb2a426c01c77fc4ab 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] Configure sniffer egg hatch time
diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
index 77952da3134d782609c66e93f5d52ec5c10d499d..f11f52c76dea7acb30bf6cc314c533f1dc0f3f0d 100644
index 7be4e32a4409b539839a480ef83750ed4b5359a6..03da13d1fdf22b425addf0b1b7a82803f6a35b60 100644
--- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
@@ -63,7 +63,7 @@ public class SnifferEggBlock extends Block {
// Paper start
// Paper start - Call BlockFadeEvent
private void rescheduleTick(ServerLevel world, BlockPos pos) {
- int baseDelay = hatchBoost(world, pos) ? BOOSTED_HATCH_TIME_TICKS : REGULAR_HATCH_TIME_TICKS;
+ int baseDelay = hatchBoost(world, pos) ? world.paperConfig().entities.sniffer.boostedHatchTime.or(BOOSTED_HATCH_TIME_TICKS) : world.paperConfig().entities.sniffer.hatchTime.or(REGULAR_HATCH_TIME_TICKS); // Paper - Configure sniffer egg hatch time

Datei anzeigen

@ -9,7 +9,7 @@ on dropping the item instead of generalizing it for all dropped
items like CB does.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index daa42371a100928c399d3684e101707386198f72..0a1977905de97522cf3311f59a2cdc6c0a5f98f9 100644
index ab8129da3d41c9e64897f66d0f6de24dc6d697d1..d186a46f9195d45aa91e3a2712e583ba024487f4 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -944,22 +944,20 @@ public class ServerPlayer extends Player {
@ -50,7 +50,7 @@ index daa42371a100928c399d3684e101707386198f72..0a1977905de97522cf3311f59a2cdc6c
if (entityitem == null) {
return null;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b240dc6a1e45b534a017806b41ddb76423691ee7..14fbaef2215f7de4acb5303ad6f677b348f855d8 100644
index 8a7fc07a8500c25b427c13d38da005b56f0892c0..36e94a6afef269007384938aa0a2c25af212ec7c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2703,6 +2703,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -100,7 +100,7 @@ index b240dc6a1e45b534a017806b41ddb76423691ee7..14fbaef2215f7de4acb5303ad6f677b3
- entityitem.setDefaultPickUpDelay();
+ entityitem.setDefaultPickUpDelay(); // Paper - diff on change (in dropConsumer)
// Paper start
// Paper start - Call EntityDropItemEvent
return this.spawnAtLocation(entityitem);
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java

Datei anzeigen

@ -8,7 +8,7 @@ In general, the client now has an acknowledgment system which will prevent block
It should be noted that this system does not yet support block entities, so those still need to resynced when needed.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 921d9d8bc6265631073d105fb8de68562f902778..3c567a9ea921a6ae36f4dc5e16a8394ab62460a8 100644
index be74f1360170c529b13979d865d7016f7f3ae5e8..8172449e198094d959d46d262c1136ec7e25a6da 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -199,7 +199,7 @@ public class ServerPlayerGameMode {
@ -18,7 +18,7 @@ index 921d9d8bc6265631073d105fb8de68562f902778..3c567a9ea921a6ae36f4dc5e16a8394a
- this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos));
+ // this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); // Paper - Don't resync blocks
// Update any tile entity data for this block
capturedBlockEntity = true; // Paper - send block entity after predicting
capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
return;
@@ -214,7 +214,7 @@ public class ServerPlayerGameMode {
// Spigot start - handle debug stick left click for non-creative
@ -102,7 +102,7 @@ index 921d9d8bc6265631073d105fb8de68562f902778..3c567a9ea921a6ae36f4dc5e16a8394a
+ // Paper end - Don't resync blocks
// Update any tile entity data for this block
if (!captureSentBlockEntities) { // Paper - Toggle this location for capturing as this is used for api
if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction
@@ -539,16 +543,18 @@ public class ServerPlayerGameMode {
if (event.useInteractedBlock() == Event.Result.DENY) {
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.