Patches!!!!!!!

This commit is contained in:
Owen1212055 2024-04-24 10:29:12 -04:00
parent 2d9d0d8b1d
commit a403a8d085
No known key found for this signature in database
GPG Key ID: 2133292072886A30
32 changed files with 354 additions and 375 deletions

View File

@ -5,193 +5,193 @@ Subject: [PATCH] Add EntityInsideBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
index 839469c1249829b42e752e5a1b613550c3f65bba..ceb5f9867f714b3b6a4602c787574dfa83c006f6 100644
index da4fd07f75aefb53b03e40c668f6c4a23693ffcb..b18c1ca558e4005354ff42cde3056df9408f7fdc 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
@@ -124,6 +124,7 @@ public abstract class BaseFireBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!entity.fireImmune()) {
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
if (entity.getRemainingFireTicks() == 0) {
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
index 040e55edea53a2ebab7cc8fe6f85206c9301e11a..0d573c05f4f8838d4492f749ca473f7a9e8d60dd 100644
index 2b6e126f57cf67cd719f67e925fee97b2485f73f..8b33e35c843e5c0b8988a2ef2a38a2673035292f 100644
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
@@ -76,6 +76,7 @@ public abstract class BasePressurePlateBlock extends Block {
@@ -77,6 +77,7 @@ public abstract class BasePressurePlateBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
int i = this.getSignalForState(state);
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
index 546dbe28edbba32ab2aede1260fbd2c9baa9fe1a..0d92bd6f1e4f3470a62f573add3490220e60ef7a 100644
index c1f020efdc5a1170fc43b2579531be8bdcacc83b..8240c32d676a88aa23dcd052ee0136767e54fb0d 100644
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -177,6 +177,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
@@ -178,6 +178,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) {
// CraftBukkit start - tilt dripleaf
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
index e4e80844ad447536c7f53bcbc721f73880414a76..addd8b3758254e4f4cd4e951cd065f83ad5dcdf8 100644
index 7c70c98ee27a6a09e73942ff4dc0f88ceb77936f..4c1f20fafdbd86011959cc2d4983b6c2f8e87a5f 100644
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
@@ -47,6 +47,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
BlockState blockState = world.getBlockState(pos.above());
if (blockState.isAir()) {
entity.onAboveBubbleCol(state.getValue(DRAG_DOWN));
diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
index 3356f327c9adae6c2f3354b4417f3954012c945a..0118c4ef4f5ed0e724b379b5a563e2b6976803a2 100644
index dc9dca35ec406b8046372719392d20acc3f5dac9..776357342c76127af0868591a56a059f89a55f20 100644
--- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
@@ -206,6 +206,7 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide && this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) {
this.checkPressed(state, world, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
index 0e8c337dde0cfa2ac289c79904ecd2affc86d70a..ba4aaf850af36a84517c70581e141157c4f15b99 100644
index fd344c5cf0d6d523abe34d5e3f8d939106942cbb..ff4dda48116a2969704b355ff96407ba869b466e 100644
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
@@ -121,6 +121,7 @@ public class CactusBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
entity.hurt(world.damageSources().cactus().directBlock(world, pos), 1.0F); // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
index a139cf0c584719e8e360ea83bdc107dfe3c577ea..9c7ee02d3aa3c33b45db4dc5c079495a69d60b15 100644
index 47f1f2fec847ff19b994c98d0f5b01d063f37067..d6fffb0953494e8667cc456137cac0f5deebfbb6 100644
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
@@ -105,6 +105,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
entity.hurt(world.damageSources().inFire().directBlock(world, pos), (float) this.fireDamage); // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index a7809bb2a468c7ad7ef7ba795afd93dd2a63cadc..aa029bee9839497e48ff639e286a024280150362 100644
index fcaf6b4bb7371ce9f00a7d4306f7b2b6884b7c4c..73595922dcff8e7a8595fcf033ab238bc4096630 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -174,6 +174,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
world.destroyBlock(pos, true, entity);
}
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index 17242c24d73c9ffb1c976a45925f85d1aa9e96b3..57e542d5c8b887acecedf76c08c8d4379d712c0f 100644
index 55a97da8786ec0ae98abe56876c00f4678ba0007..9d69e439ff853465303c2abd896e6c5314752e1e 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -51,6 +51,7 @@ public class DetectorRailBlock extends BaseRailBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) {
this.checkPressed(world, pos, state);
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index 07629f6106f384751c376d2a99ba2e8b905e49c6..9ee2fd0914ff7836517ca143d51db6150967cb0e 100644
index 6845beea2a10adf5eab08744c7eef63c0bd42254..a2de13a366e4a462b746dab035372838127f4994 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -52,6 +52,7 @@ public class EndPortalBlock extends BaseEntityBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (world instanceof ServerLevel && entity.canChangeDimensions() && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) {
ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey);
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 166ed5bb0ecd66a70b970e1df77c27f2069d2808..6e283e8c3db31f03dd95c94887e647b8d82a3604 100644
index d7a6d4f11325791767be8fcb2355916ca2f63f11..a3339b47165814238351d307c729af14d5e5d1ff 100644
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
@@ -79,6 +79,7 @@ public class FrogspawnBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity.getType().equals(EntityType.FALLING_BLOCK)) {
this.destroyBlock(world, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
index 517bd00234892d53300d5a902fda4eed4b8bef66..409b4818840916a8ddbfc1ee87c8c22902939f38 100644
index 1ed883c62be357d32365ef182e391e96172d2b56..c6f7815b5fad3aad4635208aa2e5c6739e13cb45 100644
--- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
@@ -60,6 +60,7 @@ public class HoneyBlock extends HalfTransparentBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (this.isSlidingDown(pos, entity)) {
this.maybeDoSlideAchievement(entity, pos);
this.doSlideMovement(entity);
diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
index 004f37120e079465aef40830d3086a820d5752c3..4f86e3d2aec246ff0be258885128086e21457a70 100644
index 089ead2d55c4fbe361255391f553822715269c38..86e5617d445ce762aa374e236a0ccdfe5901fce5 100644
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
@@ -200,6 +200,7 @@ public class HopperBlock extends BaseEntityBlock {
@@ -187,6 +187,7 @@ public class HopperBlock extends BaseEntityBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof HopperBlockEntity) {
HopperBlockEntity.entityInside(world, pos, state, entity, (HopperBlockEntity)blockEntity);
diff --git a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
index 1e6a51f7679af81a00d9f55a926baeed80ed24d3..25b3f2550a099e9938a82f2c0ff31da4e5f23614 100644
index 7bf2c33a194517d4e52511fe32a8434cbed0361f..d29a62775913922ffb8e3c58ae0db7e37f77226e 100644
--- a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
@@ -32,6 +32,7 @@ public class LavaCauldronBlock extends AbstractCauldronBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (this.isEntityInsideContent(state, pos, entity)) {
entity.lavaHurt();
}
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
index 64247c3a81273277b95656885c78eca3e883ef13..18ca086e28f4295cb9303919222d7c8ae0ca5d9a 100644
index 5f778ea22efa76ced1ba4455d50b94b3519113fc..7c67efa6e344870b764eb39d5508190349e2e911 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -65,6 +65,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@@ -66,6 +66,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) {
// CraftBukkit start
if (entity.mayInteract(world, pos)) {
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index 2a8f97d97ae7f268da920b5e3b9719743fa9a8e0..1b5cc5d6aa0b4313da980ce175c54145852d0db0 100644
index d3f2c0e3107a781b462a2b67c10cd1e5f05feefb..a9e3078cefcae8cc4672d514a7add162590d48df 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -90,6 +90,7 @@ public class NetherPortalBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity.canChangeDimensions()) {
// CraftBukkit start - Entity in portal
@ -209,73 +209,73 @@ index 15696602249465fa1d13eaec3b8b06574ec06f07..c9ed129db2cadd0a33d69993961f4308
world.destroyBlock(pos, true, entity);
}
diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
index b38658b84e821435ba5a3fc7218b72406da00e47..0dfcac8cfcbb09fe04486bff60119f7985714454 100644
index 1f9cab69fb19c96fb01fff0d7a5ecfdfff46a5d4..a6e6545402904141ffc6218a0158b0e9c67217c8 100644
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
@@ -63,6 +63,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!(entity instanceof LivingEntity) || entity.getFeetBlockState().is((Block) this)) {
if (!(entity instanceof LivingEntity) || entity.getInBlockState().is((Block) this)) {
entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D));
if (world.isClientSide) {
diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
index 53d39c5557bd1a68f39aaf7950f42cc1aadc3337..62ed86114c1a6e724ccfea119a331356d0a22600 100644
index 49fce6000ffafc6f53767c971db951b20261b91d..6008c634c408c4eed563815da4d57b2eef69835c 100644
--- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
@@ -83,6 +83,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock
@@ -85,6 +85,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity instanceof LivingEntity && entity.getType() != EntityType.FOX && entity.getType() != EntityType.BEE) {
entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D));
if (!world.isClientSide && (Integer) state.getValue(SweetBerryBushBlock.AGE) > 0 && (entity.xOld != entity.getX() || entity.zOld != entity.getZ())) {
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
index d092ee2aa4a37c89642133dca7049737c55a4245..003fd247b12323cca5fd82a6cdf31bd897afd682 100644
index 65b30286020b65e23d05307aade344cde827fcf2..e032d8907045c653c3dd449f65e93e40fd0bb6be 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -134,6 +134,7 @@ public class TripWireBlock extends Block {
@@ -135,6 +135,7 @@ public class TripWireBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
if (!(Boolean) state.getValue(TripWireBlock.POWERED)) {
this.checkPressed(world, pos);
diff --git a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
index d89a4c30599cedcb8ce17899631cb58c8a6a2195..61abbcfe97e3d3e3da5ee658672549d14594ad17 100644
index 7f5e092e400c3a8422b677ca246031a945a0d359..edc20745649b0837f1371c8d29e71fc0c8e5528f 100644
--- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
@@ -34,6 +34,7 @@ public class WaterlilyBlock extends BushBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
super.entityInside(state, world, pos, entity);
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (world instanceof ServerLevel && entity instanceof Boat) {
// CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) {
diff --git a/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java
index 313ac5d2e2dbc9afcfcef8c97f85e56243825ab0..709d5002ad7a1004286bf2749c82e25d7f0d0133 100644
index 4b621793da3d6fbc44f90df863b099ba992930fb..fc209fab3ed1ccb35706a5529ec23ad8b902e491 100644
--- a/src/main/java/net/minecraft/world/level/block/WebBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WebBlock.java
@@ -22,6 +22,7 @@ public class WebBlock extends Block {
@@ -24,6 +24,7 @@ public class WebBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
entity.makeStuckInBlock(state, new Vec3(0.25, 0.05F, 0.25));
}
}
Vec3 vec3 = new Vec3(0.25, 0.05F, 0.25);
if (entity instanceof LivingEntity livingEntity && livingEntity.hasEffect(MobEffects.WEAVING)) {
vec3 = new Vec3(0.5, 0.25, 0.5);
diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
index c10a01013f8393c677834136babed15817b45611..a49027c73ca461e0610914138cc660c89965f956 100644
index e861cf48aae27a8299437d76f6a84336cdcaddb7..3445916c2915b42967eb396b50b62d1912e3a49f 100644
--- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
@@ -61,6 +61,7 @@ public class WitherRoseBlock extends FlowerBlock {
@@ -62,6 +62,7 @@ public class WitherRoseBlock extends FlowerBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide && world.getDifficulty() != Difficulty.PEACEFUL) {
if (entity instanceof LivingEntity) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Attributes API for item defaults
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 79977c677b4348bbfc8dcd4cb5e4c01c6fceb354..31898e8425c524277bd07b139a898fe5f9fe344d 100644
index a82f21809b14d36fd8e440dcc7fd11f57cdbd3dc..81e4ba5afba072f0a3b139538e2b146b9bafad6a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -564,6 +564,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -561,6 +561,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0f6a34776482a7eef638911fe01db819962b3ce8..9e4453878246a22e320a6f8eb7aa08cb17438faf 100644
index 93d66d85be2dcc52e8f3fa138561f2126d91c732..f4b884a7c9e20823e626f7f5604cc4e0b2edd570 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -434,8 +434,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -440,8 +440,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setClearWeatherTime(clearDuration);
this.serverLevelData.setRainTime(rainDuration);
this.serverLevelData.setThunderTime(rainDuration);
@ -19,7 +19,7 @@ index 0f6a34776482a7eef638911fe01db819962b3ce8..9e4453878246a22e320a6f8eb7aa08cb
}
@Override
@@ -868,8 +868,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -874,8 +874,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setThunderTime(j);
this.serverLevelData.setRainTime(k);
this.serverLevelData.setClearWeatherTime(i);
@ -30,7 +30,7 @@ index 0f6a34776482a7eef638911fe01db819962b3ce8..9e4453878246a22e320a6f8eb7aa08cb
}
this.oThunderLevel = this.thunderLevel;
@@ -936,14 +936,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -942,14 +942,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
@VisibleForTesting
public void resetWeatherCycle() {
// CraftBukkit start
@ -48,10 +48,10 @@ index 0f6a34776482a7eef638911fe01db819962b3ce8..9e4453878246a22e320a6f8eb7aa08cb
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
diff --git a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..59ba982dc96ce47e47399514e8f74d2b972dbe1e 100644
index e50ad48658193f889d65d37c57b1e30ce46758b7..efd0bcfebb3b4f63018d4e20a6a89f79192898d1 100644
--- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
+++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
@@ -373,6 +373,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -337,6 +337,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setThundering(boolean thundering) {
@ -63,7 +63,7 @@ index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..59ba982dc96ce47e47399514e8f74d2b
// CraftBukkit start
if (this.thundering == thundering) {
return;
@@ -380,7 +385,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -344,7 +349,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
@ -72,7 +72,7 @@ index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..59ba982dc96ce47e47399514e8f74d2b
Bukkit.getServer().getPluginManager().callEvent(thunder);
if (thunder.isCancelled()) {
return;
@@ -407,6 +412,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -371,6 +376,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setRaining(boolean raining) {
@ -85,7 +85,7 @@ index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..59ba982dc96ce47e47399514e8f74d2b
// CraftBukkit start
if (this.raining == raining) {
return;
@@ -414,7 +425,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -378,7 +389,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
@ -95,10 +95,10 @@ index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..59ba982dc96ce47e47399514e8f74d2b
if (weather.isCancelled()) {
return;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index fc117c5c3ab09c24600fdbdbff56356e7ad64473..685851278af7ae0afe2009592d8c57bd01f92267 100644
index 20c1e6f485a4067b04e39479ae2b122332c94c27..ee2a685d8cb8754a6f5fbed0d43cfbc0b5f2bbb7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1197,7 +1197,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1206,7 +1206,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setStorm(boolean hasStorm) {
@ -107,7 +107,7 @@ index fc117c5c3ab09c24600fdbdbff56356e7ad64473..685851278af7ae0afe2009592d8c57bd
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
@@ -1219,7 +1219,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1228,7 +1228,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setThundering(boolean thundering) {

View File

@ -5,12 +5,12 @@ Subject: [PATCH] More Lidded Block API
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java
index 08a84f66478d765080367a1c1acd77908ce605a8..7a09fde1a6fbd460548b43ff52301c51d8f5afbc 100644
index f4b480e3041fc79060c5fa6ce517047104b280d5..6063f0e1fdc232d063105971359ae688168a2bc4 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java
@@ -67,4 +67,11 @@ public class CraftBarrel extends CraftLootable<BarrelBlockEntity> implements Bar
public CraftBarrel copy() {
return new CraftBarrel(this);
@@ -73,4 +73,11 @@ public class CraftBarrel extends CraftLootable<BarrelBlockEntity> implements Bar
public CraftBarrel copy(Location location) {
return new CraftBarrel(this, location);
}
+
+ // Paper start - More Lidded Block API
@ -21,12 +21,12 @@ index 08a84f66478d765080367a1c1acd77908ce605a8..7a09fde1a6fbd460548b43ff52301c51
+ // Paper end - More Lidded Block API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index b742d9d231bf79ed53d3fe4deaa81e64c6801c4c..b5d9e750965b21c27ec4aa12b0997176adbad527 100644
index 29df470d6706a33dad4317a9aa599456d5c7f6ee..c7d19cef79dbe39edc8cddf0c60c7b59d656e581 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -87,4 +87,11 @@ public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest
public CraftChest copy() {
return new CraftChest(this);
@@ -93,4 +93,11 @@ public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest
public CraftChest copy(Location location) {
return new CraftChest(this, location);
}
+
+ // Paper start - More Lidded Block API
@ -37,12 +37,12 @@ index b742d9d231bf79ed53d3fe4deaa81e64c6801c4c..b5d9e750965b21c27ec4aa12b0997176
+ // Paper end - More Lidded Block API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
index 79fafa30e4f09dc375cc3fcb1d95a9ab6c8fb9f4..872a579460ebe8d6085188a6be9c9eb9b8d4bfa2 100644
index 07b63ce5f5e152f6a644134989ffa03af8a12cdf..b64adbba3e52d32d439e64a243cb74f3fbca2ce3 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
@@ -45,4 +45,11 @@ public class CraftEnderChest extends CraftBlockEntityState<EnderChestBlockEntity
public CraftEnderChest copy() {
return new CraftEnderChest(this);
@@ -51,4 +51,11 @@ public class CraftEnderChest extends CraftBlockEntityState<EnderChestBlockEntity
public CraftEnderChest copy(Location location) {
return new CraftEnderChest(this, location);
}
+
+ // Paper start - More Lidded Block API
@ -53,10 +53,10 @@ index 79fafa30e4f09dc375cc3fcb1d95a9ab6c8fb9f4..872a579460ebe8d6085188a6be9c9eb9
+ // Paper end - More Lidded Block API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
index a8120eb14e111b134a1496b91f8341f8e14a2a9b..07c428e5b3673e4028fe303dde5f30040b5ec3d7 100644
index 7676313493bcb6327c2a9c026645fe060733c6ac..f7b199fbc7a740de3ee6952ce12ef2c35f057d7a 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
@@ -58,7 +58,7 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
@@ -59,7 +59,7 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
if (this.getTileEntity().opened && this.getWorldHandle() instanceof net.minecraft.world.level.Level) {
net.minecraft.world.level.Level world = this.getTileEntity().getLevel();
world.blockEvent(this.getPosition(), this.getTileEntity().getBlockState().getBlock(), 1, 0);
@ -65,9 +65,9 @@ index a8120eb14e111b134a1496b91f8341f8e14a2a9b..07c428e5b3673e4028fe303dde5f3004
}
this.getTileEntity().opened = false;
}
@@ -67,4 +67,11 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
public CraftShulkerBox copy() {
return new CraftShulkerBox(this);
@@ -73,4 +73,11 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
public CraftShulkerBox copy(Location location) {
return new CraftShulkerBox(this, location);
}
+
+ // Paper start - More Lidded Block API

View File

@ -5,26 +5,26 @@ Subject: [PATCH] Limit item frame cursors on maps
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 0ca0808c5eeeba969c048b422af37a273217ff52..ed57ce12d4d1cc632431a654cad648a8015402b1 100644
index 38c0855a6f9398f8d075f304288cf9e9f695770a..ad24a79e190d07c75d8e29e816fc398894771c2c 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -299,8 +299,10 @@ public class MapItemSavedData extends SavedData {
@@ -321,8 +321,10 @@ public class MapItemSavedData extends SavedData {
MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId());
+ if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper - Limit item frame cursors on maps
this.addDecoration(MapDecoration.Type.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null);
this.addDecoration(MapDecorationTypes.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null);
this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1);
+ } // Paper - Limit item frame cursors on maps
}
CompoundTag nbttagcompound = stack.getTag();
@@ -482,7 +484,7 @@ public class MapItemSavedData extends SavedData {
MapDecorations mapdecorations = (MapDecorations) stack.getOrDefault(DataComponents.MAP_DECORATIONS, MapDecorations.EMPTY);
@@ -487,7 +489,7 @@ public class MapItemSavedData extends SavedData {
return true;
}
- if (!this.isTrackedCountOverLimit(256)) {
+ if (!this.isTrackedCountOverLimit(((Level) world).paperConfig().maps.itemFrameCursorLimit)) { // Paper - Limit item frame cursors on maps
this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, mapiconbanner.getName());
this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, (Component) mapiconbanner.name().orElse(null)); // CraftBukkit - decompile error
return true;

View File

@ -5,53 +5,48 @@ Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
index e15d740275d265c460c1771cdad5556bcec9d798..0af9ed92824ccf30814eceb6a2c2e5c12661c991 100644
index dbcf183483766f39334d7f7e8336033906625f3f..300929a406905f5ff1ede664d5b99fb0938d4d2e 100644
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
@@ -34,16 +34,16 @@ public class SignedMessageChain {
return (signature, body) -> {
SignedMessageLink signedMessageLink = this.advanceLink();
if (signedMessageLink == null) {
- throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.chain_broken"), false);
+ throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.chain_broken"), false); // Paper - diff on change (if disconnects, need a new kick event cause)
@@ -40,14 +40,14 @@ public class SignedMessageChain {
if (signature == null) {
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.MISSING_PROFILE_KEY);
} else if (playerPublicKey.data().hasExpired()) {
- throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.expiredProfileKey"), false);
+ throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.expiredProfileKey"), false, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
} else if (body.timeStamp().isBefore(this.lastTimeStamp)) {
- throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.out_of_order_chat"), true);
+ throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.out_of_order_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.EXPIRED_PROFILE_KEY);
+ throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.EXPIRED_PROFILE_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
} else {
this.lastTimeStamp = body.timeStamp();
SignedMessageLink signedMessageLink = SignedMessageChain.this.nextLink;
if (signedMessageLink == null) {
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN);
} else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) {
this.setChainBroken();
- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT);
+ throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
} else {
SignedMessageChain.this.lastTimeStamp = body.timeStamp();
PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH);
if (!playerChatMessage.verify(signatureValidator)) {
- throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true);
+ throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes
} else {
if (playerChatMessage.hasExpiredServer(Instant.now())) {
LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content());
@@ -67,10 +67,17 @@ public class SignedMessageChain {
@@ -80,8 +80,15 @@ public class SignedMessageChain {
static final Component INVALID_SIGNATURE = Component.translatable("chat.disabled.invalid_signature");
static final Component OUT_OF_ORDER_CHAT = Component.translatable("chat.disabled.out_of_order_chat");
public static class DecodeException extends ThrowingComponent {
private final boolean shouldDisconnect;
+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause; // Paper - kick event causes
public DecodeException(Component message, boolean shouldDisconnect) {
+ // Paper start - kick event causes
+ this(message, shouldDisconnect, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+ public DecodeException(Component message, boolean shouldDisconnect, org.bukkit.event.player.PlayerKickEvent.Cause kickCause) {
+ // Paper end - kick event causes
- public DecodeException(Component message) {
+ // Paper start
+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause;
+ public DecodeException(Component message, org.bukkit.event.player.PlayerKickEvent.Cause event) {
super(message);
this.shouldDisconnect = shouldDisconnect;
+ this.kickCause = kickCause; // Paper - kick event causes
+ this.kickCause = event;
+ }
+ // Paper end
+ public DecodeException(Component message) {
+ this(message, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // Paper
}
}
public boolean shouldDisconnect() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d972e82ce41ec0c1ff4f9c55646ed3c21c6381d2..86283e9b7c3ad18e4deb8fcd3de624be92908c55 100644
index 5e3566e911194ee0f3552d612b63bb5922a98815..00a83b766f9e32b6403296901e806b07d4e4818e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2167,7 +2167,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2269,7 +2269,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)
@ -100,10 +95,10 @@ index d1caaecfdfba1cdeba032f0bc38c06541fa61633..6468b3a25c7527a2fde6899e4812b5cb
i++;
}
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef03b6207a0 100644
index d947eb533ba4dfd3b711e644d2a68238d1ec007a..b9767aff520d32d4615e3cb9e24a294553c70b97 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -95,7 +95,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -116,7 +116,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
@ -112,7 +107,7 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
});
// Paper end - This needs to be handled on the main thread for plugins
}
@@ -131,7 +131,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -152,7 +152,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -121,7 +116,7 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
}
} else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) {
try {
@@ -141,7 +141,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -162,7 +162,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -130,7 +125,7 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
}
} else {
try {
@@ -159,7 +159,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -180,7 +180,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@ -139,7 +134,7 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
}
}
@@ -175,7 +175,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -196,7 +196,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server);
if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id());
@ -148,16 +143,25 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
}
// Paper start - adventure pack callbacks
// call the callbacks before the previously-existing event so the event has final say
@@ -207,7 +207,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
@@ -238,7 +238,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected
if (this.keepAlivePending && !this.processedDisconnect) { // Paper
- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
} else if (this.checkIfClosed(currentTime)) { // Paper
this.keepAlivePending = true;
this.keepAliveTime = currentTime;
@@ -254,7 +254,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private boolean checkIfClosed(long time) {
if (this.closed) {
if (time - this.closedListenerTime >= 15000L) {
- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
}
} else {
if (elapsedTime >= 15000L) { // 15 seconds
@@ -260,18 +260,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
return false;
@@ -305,18 +305,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
// CraftBukkit start
@ -190,7 +194,7 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
// Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
@@ -281,7 +291,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -326,7 +336,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
@ -199,7 +203,7 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
return null;
}
};
@@ -300,7 +310,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -345,7 +355,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
@ -209,28 +213,28 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e521c64144 100644
index bac22822c69c4e58d0010e7675dc0d8e957cdb18..9b2abc64556acf9547e5927847f0a02c4ff66001 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -341,7 +341,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -355,7 +355,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
if (++this.aboveGroundTickCount > 80) {
if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
- this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message
+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause
return;
}
} else {
@@ -360,7 +360,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > 80) {
@@ -374,7 +374,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
- this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message
+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause
return;
}
} else {
@@ -391,7 +391,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -405,7 +405,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) {
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
@ -239,7 +243,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
}
}
@@ -461,7 +461,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -487,7 +487,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
@ -248,7 +252,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
} else {
Entity entity = this.player.getRootVehicle();
@@ -663,7 +663,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -689,7 +689,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
@ -257,7 +261,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
return;
}
@@ -721,7 +721,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -747,7 +747,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async
// CraftBukkit start
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits
@ -266,7 +270,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
return;
}
// CraftBukkit end
@@ -881,7 +881,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -912,7 +912,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start - validate pick item position
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -275,7 +279,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
return;
}
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1066,7 +1066,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1091,7 +1091,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
@ -284,7 +288,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
return;
}
byteTotal += byteLength;
@@ -1089,14 +1089,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1114,14 +1114,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (byteTotal > byteAllowed) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
@ -301,7 +305,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
return;
}
this.lastBookTick = MinecraftServer.currentTick;
@@ -1240,7 +1240,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1233,7 +1233,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
@ -310,7 +314,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
} else {
ServerLevel worldserver = this.player.serverLevel();
@@ -1660,7 +1660,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1662,7 +1662,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.dropCount++;
if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -319,7 +323,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
return;
}
}
@@ -1943,7 +1943,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1945,7 +1945,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -328,34 +332,16 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
}
}
@@ -1956,7 +1956,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// CraftBukkit end
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) {
- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.lastSeenMessages());
@@ -2143,7 +2143,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1988,7 +1988,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleChatCommand(ServerboundChatCommandPacket packet) {
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit
if (ServerGamePacketListenerImpl.isChatMessageIllegal(s)) {
- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.lastSeenMessages());
@@ -2044,7 +2044,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString());
if (exception.shouldDisconnect()) {
- this.disconnect(exception.getComponent());
+ this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes
} else {
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
}
@@ -2092,7 +2092,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2166,7 +2166,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (optional.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -364,7 +350,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
}
return optional;
@@ -2278,7 +2278,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2352,7 +2352,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// this.chatSpamTickCount += 20;
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
// CraftBukkit end
@ -373,7 +359,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
}
}
@@ -2290,7 +2290,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2364,7 +2364,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
synchronized (this.lastSeenMessages) {
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -382,7 +368,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
}
}
@@ -2443,7 +2443,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2512,7 +2512,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (i > 4096) {
@ -391,7 +377,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
}
}
@@ -2504,7 +2504,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2574,7 +2574,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -400,16 +386,16 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
return;
}
// Spigot End
@@ -2603,7 +2603,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// CraftBukkit end
@@ -2688,7 +2688,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
} else {
}
- ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"));
+ ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -3001,7 +3001,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
});
@@ -3085,7 +3085,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start - auto recipe limit
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@ -418,7 +404,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
return;
}
}
@@ -3243,7 +3243,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3327,7 +3327,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@ -427,7 +413,7 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
} else {
try {
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
@@ -3256,7 +3256,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3340,7 +3340,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
@ -437,10 +423,10 @@ index e2fc392afd6fa8fbb9d464262f12bb6a0c81f7f8..08f502452dc1c6ee83e04650b08a08e5
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e913acef00c0a1a2f49779800b46997588b46253..dcb8de1c28b767068aa10f044bd8cf72ef6cfcaf 100644
index 454abe63a51e6d39a672778382842bdddeba3d9b..4d32c917c3a5455e4ba028fef49ec483bd5b0ad8 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -683,7 +683,7 @@ public abstract class PlayerList {
@@ -681,7 +681,7 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
entityplayer = (ServerPlayer) iterator.next();
this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
@ -449,7 +435,7 @@ index e913acef00c0a1a2f49779800b46997588b46253..dcb8de1c28b767068aa10f044bd8cf72
}
// Instead of kicking then returning, we need to store the kick reason
@@ -1319,8 +1319,8 @@ public abstract class PlayerList {
@@ -1318,8 +1318,8 @@ public abstract class PlayerList {
// Paper end
// CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) {
@ -491,10 +477,10 @@ index f472dea0bd4f834c0c8f0aa59ae7cdae082b14af..2fa51c3a70f43cd23b8f494fc643d66c
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7212d6f8fc7653983aa66d3731d7559a24b026ba..423e599e703723ce038c85c5d42e18a633e130f5 100644
index e38d8d7e4c114fa00dbc30ce409991d8ec8c8975..5a1d8386e12842f36c07dac6211f961c95ecd8ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -557,7 +557,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -632,7 +632,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
if (this.getHandle().connection == null) return;
@ -503,7 +489,7 @@ index 7212d6f8fc7653983aa66d3731d7559a24b026ba..423e599e703723ce038c85c5d42e18a6
}
// Paper start
@@ -569,10 +569,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -644,10 +644,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kick(final net.kyori.adventure.text.Component message) {
@ -520,7 +506,7 @@ index 7212d6f8fc7653983aa66d3731d7559a24b026ba..423e599e703723ce038c85c5d42e18a6
}
}
@@ -631,7 +636,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -706,7 +711,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start - Improve chat handling
if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {

View File

@ -5,22 +5,22 @@ Subject: [PATCH] Add PufferFishStateChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
index 50ffcbb50e061f0b3307a5b963bbab81427cac3e..a197337f2e09f53cf382022569c8836745d78769 100644
index 9498bac12196637c187961424ef23ecb77eddff8..3f0fad476fe573c3ba946a9436d1b3f7c5260ee2 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
@@ -95,25 +95,39 @@ public class Pufferfish extends AbstractFish {
@@ -101,25 +101,39 @@ public class Pufferfish extends AbstractFish {
public void tick() {
if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) {
if (this.inflateCounter > 0) {
+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
if (this.getPuffState() == 0) {
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent
this.playSound(SoundEvents.PUFFER_FISH_BLOW_UP, this.getSoundVolume(), this.getVoicePitch());
this.makeSound(SoundEvents.PUFFER_FISH_BLOW_UP);
this.setPuffState(1);
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
} else if (this.inflateCounter > 40 && this.getPuffState() == 1) {
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 2).callEvent()) { // Paper - Add PufferFishStateChangeEvent
this.playSound(SoundEvents.PUFFER_FISH_BLOW_UP, this.getSoundVolume(), this.getVoicePitch());
this.makeSound(SoundEvents.PUFFER_FISH_BLOW_UP);
this.setPuffState(2);
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
}
@ -32,12 +32,12 @@ index 50ffcbb50e061f0b3307a5b963bbab81427cac3e..a197337f2e09f53cf382022569c88367
+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
if (this.deflateTimer > 60 && this.getPuffState() == 2) {
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent
this.playSound(SoundEvents.PUFFER_FISH_BLOW_OUT, this.getSoundVolume(), this.getVoicePitch());
this.makeSound(SoundEvents.PUFFER_FISH_BLOW_OUT);
this.setPuffState(1);
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
} else if (this.deflateTimer > 100 && this.getPuffState() == 1) {
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 0).callEvent()) { // Paper - Add PufferFishStateChangeEvent
this.playSound(SoundEvents.PUFFER_FISH_BLOW_OUT, this.getSoundVolume(), this.getVoicePitch());
this.makeSound(SoundEvents.PUFFER_FISH_BLOW_OUT);
this.setPuffState(0);
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix PlayerBucketEmptyEvent result itemstack
Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..4b9e726e6ac255e743479d5c2e0cdb98464399a4 100644
index b20263db1988529dd6e7969d65ee30096f10d591..6d494b80ae002aea00afa44adf83dad1ae5bbbc1 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -39,6 +39,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
@@ -40,6 +40,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
public class BucketItem extends Item implements DispensibleContainerItem {
@ -18,7 +18,7 @@ index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..4b9e726e6ac255e743479d5c2e0cdb98
public final Fluid content;
public BucketItem(Fluid fluid, Item.Properties settings) {
@@ -122,6 +124,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -123,6 +125,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
}
public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
@ -29,10 +29,10 @@ index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..4b9e726e6ac255e743479d5c2e0cdb98
+ return itemInHand;
+ }
+ // Paper end - Fix PlayerBucketEmptyEvent result itemstack
return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
return !player.hasInfiniteMaterials() ? new ItemStack(Items.BUCKET) : stack;
}
@@ -181,6 +190,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -180,6 +189,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
return false;
}

View File

@ -14,7 +14,7 @@ contention situations.
And this is extremely a low contention situation.
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 6b37d460a76156162743d77d192f34366b29e5f9..268752a0b939abcaa9c7a302d2642b0c0fa2d331 100644
index 2e5afbd2a69c4eeabd9a48bff6a37a7004565716..2fa0097a9374a89177e4f1068d1bfed30b8ff122 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -30,14 +30,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to fix items merging through walls
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 e67e8d0593e3ba3fc8e9da59ad6494ea589ab337..78acc580d66917e52d89632e3f0b7c1e979714d4 100644
index a6dc7c7aab40a9b21c7debd0f9a1619238cff94c..1817e8876f13695578b0a5b2f75e738b3286db48 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -277,6 +277,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -283,6 +283,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
ItemEntity entityitem = (ItemEntity) iterator.next();
if (entityitem.isMergable()) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add BellRevealRaiderEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
index d21f7e9712ac2d9088ce19d415e4ba7863d8cebf..cc511deaca0e2c1a5a255f3125f691c851101401 100644
index 86dac3f82da065bf79d94da9df192f51ce4665e2..946c9dbfabf154db53d811906fd98d17992167d1 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
@@ -156,7 +156,7 @@ public class BellBlockEntity extends BlockEntity {
@ -17,7 +17,7 @@ index d21f7e9712ac2d9088ce19d415e4ba7863d8cebf..cc511deaca0e2c1a5a255f3125f691c8
// CraftBukkit end
}
@@ -192,6 +192,13 @@ public class BellBlockEntity extends BlockEntity {
@@ -189,6 +189,13 @@ public class BellBlockEntity extends BlockEntity {
}
private static void glow(LivingEntity entity) {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix invulnerable end crystals
MC-108513
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index e7e01effab5f727d9b84a0575d165127e3dfe4c9..036640d49a5e891e9a0f767abe33f1f51d6d4cde 100644
index dd0c441fef3b4db28d6ba52118095600512ffe9c..d8e440e14b72dc48ae97244f1bed2c06abd997ab 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -30,6 +30,7 @@ public class EndCrystal extends Entity {
@ -43,7 +43,7 @@ index e7e01effab5f727d9b84a0575d165127e3dfe4c9..036640d49a5e891e9a0f767abe33f1f5
}
@Override
@@ -88,6 +101,7 @@ public class EndCrystal extends Entity {
@@ -85,6 +98,7 @@ public class EndCrystal extends Entity {
if (nbt.contains("ShowBottom", 1)) {
this.setShowBottom(nbt.getBoolean("ShowBottom"));
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add ElderGuardianAppearanceEvent
diff --git a/src/main/java/net/minecraft/world/effect/MobEffectUtil.java b/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
index fd803cbdad0e75f43279c5d5049b0152c2d013c3..fcc60a419c6dade50848d4c1e6e8daf0d3095d70 100644
index f8026eb1d9b10e468d28ee2e1296653e873c87db..23977c2074b920b646a639bef79c0f625b284bea 100644
--- a/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
+++ b/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
@@ -54,10 +54,23 @@ public final class MobEffectUtil {
@@ -55,10 +55,23 @@ public final class MobEffectUtil {
}
public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) {
@ -19,11 +19,11 @@ index fd803cbdad0e75f43279c5d5049b0152c2d013c3..fcc60a419c6dade50848d4c1e6e8daf0
+ public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause, @Nullable java.util.function.Predicate<ServerPlayer> playerPredicate) {
+ // Paper end - Add ElderGuardianAppearanceEvent
// CraftBukkit end
MobEffect mobeffectlist = mobeffect.getEffect();
Holder<MobEffect> holder = mobeffect.getEffect();
List<ServerPlayer> list = worldserver.getPlayers((entityplayer) -> {
- return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1));
- return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1));
+ // Paper start - Add ElderGuardianAppearanceEvent
+ boolean condition = entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1));
+ boolean condition = entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1));
+ if (condition) {
+ return playerPredicate == null || playerPredicate.test(entityplayer); // Only test the player AFTER it is true
+ } else {
@ -34,10 +34,10 @@ index fd803cbdad0e75f43279c5d5049b0152c2d013c3..fcc60a419c6dade50848d4c1e6e8daf0
list.forEach((entityplayer) -> {
diff --git a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
index 1dfdb378a2491b0ae64a4152e4cd8b539dfdf65b..91ff663b2260d1cdd1388c93068e4cd9d0331aea 100644
index 4e4b68904151d0d851b13f14f89c1c305e95fd5a..fd995b1f29c47884e9db2cb92f1dd615d62ae032 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
@@ -70,7 +70,7 @@ public class ElderGuardian extends Guardian {
@@ -67,7 +67,7 @@ public class ElderGuardian extends Guardian {
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 1200 == 0) {
MobEffectInstance mobeffect = new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 6000, 2);

View File

@ -11,10 +11,10 @@ Move the tick logic into the post tick, where portaling was
designed to happen in the first place.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5b0502cfcc3d9317941d7444750a49832e1a52a1..53e2ca6ddba4936a7387e07a2aae4c282a305222 100644
index 04581cd90272775208a0192ef36f9c7458ad3a0c..aac47d2de2825b46e54ad936a48c96ef7f6703e1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -421,6 +421,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -423,6 +423,36 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.originWorld;
}
// Paper end - Entity origin API
@ -51,7 +51,7 @@ index 5b0502cfcc3d9317941d7444750a49832e1a52a1..53e2ca6ddba4936a7387e07a2aae4c28
public float getBukkitYaw() {
return this.yRot;
}
@@ -2798,6 +2828,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2828,6 +2858,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
this.processPortalCooldown();
@ -60,7 +60,7 @@ index 5b0502cfcc3d9317941d7444750a49832e1a52a1..53e2ca6ddba4936a7387e07a2aae4c28
}
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index 9ee2fd0914ff7836517ca143d51db6150967cb0e..4ba24bced9a2de4616a0418857d3738e0e322ea0 100644
index a2de13a366e4a462b746dab035372838127f4994..7272d70c672b54dcf595beafd7a2ed33c96e35cb 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -61,16 +61,13 @@ public class EndPortalBlock extends BaseEntityBlock {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning
Uses an EnumMap as well as a Set paired List for O(1) contains calls.
diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
index c376a6cc04faf8d8545c99c0815682ea7cad98db..ffa24b71400f2041c9154817c6c767bc7dffb176 100644
index d6ebd2ebc3a4a184f1237b00c6c4e709c61d2eec..cb7465ed9bdebe1b31f02d11725e75ff8b44ca66 100644
--- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
+++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
@@ -75,8 +75,40 @@ public class MobSpawnSettings {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Line Of Sight Changes
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 687f379a811ba46cb3cddda33a62039b3b329cb3..60c9bae18f277a90b464a6f1f55d074ed9046aff 100644
index 75ed2ed9fa3e620e48216840bafd9bcfe7123901..3541d5f4a0605415e1d7941fdf82e1ba3e5e2965 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3627,7 +3627,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3714,7 +3714,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
@ -19,7 +19,7 @@ index 687f379a811ba46cb3cddda33a62039b3b329cb3..60c9bae18f277a90b464a6f1f55d074e
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index b9262b681b51cb68024156b28d33624fddd17b26..af14244caba22e750ee7baba03bb7ce267795b21 100644
index 1e720b96f0367652db6924b8654deaa9467e3d2c..4932ba59a6b70b405f7dd05358f6bb00b629d34c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -516,5 +516,21 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
@ -45,10 +45,10 @@ index b9262b681b51cb68024156b28d33624fddd17b26..af14244caba22e750ee7baba03bb7ce2
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 646763f591e67e27c992663379fa3d4b322a3de3..e4a6cb02afdc6c0654ede24265d79092c998f828 100644
index ab4008a94ba622cbe423b0ce1d45333334850494..6e3bddcbf13eae3707f600fed35ca23873f515ea 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -628,6 +628,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -627,6 +627,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().hasLineOfSight(((CraftEntity) other).getHandle());
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] add per world spawn limits
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 685851278af7ae0afe2009592d8c57bd01f92267..95a5f2ef87252ab3fb684d1e04e2a3d05a3aa4bb 100644
index ee2a685d8cb8754a6f5fbed0d43cfbc0b5f2bbb7..28c027db9f017c35bfc0407dd1bd46fa685f58fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -222,6 +222,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -8,32 +8,31 @@ Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6
Fix splash events cancellation that still show particles/sound
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
index 6e921bf7101224d6b8261ab8d87724080c4095d7..0204257ca0245830534592922e400a362c347715 100644
index d7fe99e55b64b66af7795c2d0aeca69023f93bae..14444325c0ed62c5f0ec230a7e191b0904e7b1ae 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
@@ -106,56 +106,77 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
Potion potionregistry = PotionUtils.getPotion(itemstack);
List<MobEffectInstance> list = PotionUtils.getMobEffects(itemstack);
boolean flag = potionregistry == Potions.WATER && list.isEmpty();
+ boolean showParticles = true; // Paper - Fix potions splash events
@@ -104,55 +104,76 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
ItemStack itemstack = this.getItem();
PotionContents potioncontents = (PotionContents) itemstack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
if (flag) {
+ boolean showParticles = true; // Paper - Fix potions splash events
if (potioncontents.is(Potions.WATER)) {
- this.applyWater();
+ showParticles = this.applyWater(hitResult); // Paper - Fix potions splash events
} else if (true || !list.isEmpty()) { // CraftBukkit - Call event even if no effects to apply
} else if (true || potioncontents.hasEffects()) { // CraftBukkit - Call event even if no effects to apply
if (this.isLingering()) {
- this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition
+ showParticles = this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
- this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition
+ showParticles = this.makeAreaOfEffectCloud(itemstack, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
} else {
- this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition
- this.applySplash(potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition
+ showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
}
}
+ if (showParticles) { // Paper - Fix potions splash events
int i = potionregistry.hasInstantEffects() ? 2007 : 2002;
int i = potioncontents.potion().isPresent() && ((Potion) ((Holder) potioncontents.potion().get()).value()).hasInstantEffects() ? 2007 : 2002;
this.level().levelEvent(i, this.blockPosition(), PotionUtils.getColor(itemstack));
this.level().levelEvent(i, this.blockPosition(), potioncontents.getColor());
+ } // Paper - Fix potions splash events
this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
}
@ -99,12 +98,12 @@ index 6e921bf7101224d6b8261ab8d87724080c4095d7..0204257ca0245830534592922e400a36
}
- private void applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
+ private boolean applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events
- private void applySplash(Iterable<MobEffectInstance> iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
+ private boolean applySplash(Iterable<MobEffectInstance> iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<net.minecraft.world.entity.LivingEntity> list1 = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
@@ -173,6 +194,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
@@ -170,6 +191,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
if (d0 < 16.0D) {
double d1;
@ -112,7 +111,7 @@ index 6e921bf7101224d6b8261ab8d87724080c4095d7..0204257ca0245830534592922e400a36
if (entityliving == entity) {
d1 = 1.0D;
} else {
@@ -227,10 +249,11 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
@@ -225,10 +247,11 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
}
}
}
@ -120,30 +119,20 @@ index 6e921bf7101224d6b8261ab8d87724080c4095d7..0204257ca0245830534592922e400a36
}
- private void makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
+ private boolean makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean
- private void makeAreaOfEffectCloud(PotionContents potioncontents, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
+ private boolean makeAreaOfEffectCloud(PotionContents potioncontents, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
Entity entity = this.getOwner();
@@ -245,10 +268,12 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
entityareaeffectcloud.setPotion(potionregistry);
Iterator iterator = PotionUtils.getCustomEffects(itemstack).iterator();
+ boolean noEffects = potionregistry.getEffects().isEmpty(); // Paper - Fix potions splash events
while (iterator.hasNext()) {
MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
entityareaeffectcloud.addEffect(new MobEffectInstance(mobeffect));
+ noEffects = false; // Paper - Fix potions splash events
}
CompoundTag nbttagcompound = itemstack.getTag();
@@ -259,12 +284,13 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
@@ -241,14 +264,16 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
entityareaeffectcloud.setWaitTime(10);
entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration());
entityareaeffectcloud.setPotionContents(potioncontents);
+ boolean noEffects = potioncontents.hasEffects(); // Paper - Fix potions splash events
// CraftBukkit start
org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, position, entityareaeffectcloud);
- if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) {
+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && entityareaeffectcloud.effects.isEmpty() && entityareaeffectcloud.getPotion().getEffects().isEmpty()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling
+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && !entityareaeffectcloud.potionContents.hasEffects()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling
this.level().addFreshEntity(entityareaeffectcloud);
} else {
entityareaeffectcloud.discard(null); // CraftBukkit - add Bukkit remove cause
@ -154,10 +143,10 @@ index 6e921bf7101224d6b8261ab8d87724080c4095d7..0204257ca0245830534592922e400a36
public boolean isLingering() {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 5d4fe10d4e3a5d7a9430dbd5b3c850db482f5862..74df21363c96dbf82337550ae2d8525e82eaface 100644
index ea9a12ff01203072975bb2f22a077d1d2e46376f..11f9220c4a5d2481f3a52238b4d845bad1fd0867 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -876,6 +876,32 @@ public class CraftEventFactory {
@@ -875,6 +875,32 @@ public class CraftEventFactory {
return event;
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add more LimitedRegion API
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
index 50667138028ef6ae273ccbc351916e98ab5645ca..423a853192c87eb81b79cb6f17866c4665cc1655 100644
index e7266835946c3bf49dbd83fe677481e8eddd16e5..09c282b3fbbdec82f21ab97fe0a486eacc2c2e8b 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
@@ -254,4 +254,45 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 28baa63b9b750a7f03da364d9c1fe691d3ce1706..c917b271fb6325840bb791566e9dec607bdd819a 100644
index 50c6b668a8e915081007dfd9c9fc1aae179e16c9..a9130dd3097c31d91baaf1405a369881393d42d5 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2342,7 +2342,7 @@ public class ServerPlayer extends Player {
@@ -2424,7 +2424,7 @@ public class ServerPlayer extends Player {
if (retainOwnership) {
if (!itemstack1.isEmpty()) {
@ -18,10 +18,10 @@ index 28baa63b9b750a7f03da364d9c1fe691d3ce1706..c917b271fb6325840bb791566e9dec60
this.awardStat(Stats.DROP);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 8ab62f37c9e1eb1582fba4adc02c3404bebc80f4..4d967016ac34d21161f10217db494f5bb537bd07 100644
index 1f4351c1701465a3b5dfcb8d61aa5035956bbd42..44e2a0f36359ab914c9328b633dd8a360591751d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -727,6 +727,11 @@ public abstract class Player extends LivingEntity {
@@ -726,6 +726,11 @@ public abstract class Player extends LivingEntity {
}
double d0 = this.getEyeY() - 0.30000001192092896D;

View File

@ -42,7 +42,7 @@ Co-authored-by: FireInstall <kettnerl@hu-berlin.de>
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
index 8117578ced94aa6bf01871f6526a388385c4adf2..59699c59fdfc611177fdb3136f84ab539b17d9c9 100644
index e9683b5a76b2dd7fc90f1d2e4538b1abbbe27ef0..62a8957cf73c3101ade104f18834a73bf8d594c2 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
@@ -165,7 +165,7 @@ public class MobGoalHelper {
@ -113,10 +113,10 @@ index 0000000000000000000000000000000000000000..41bf71d116ffc5431586ce54abba7f8d
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
index 3982ddbd0fa133fa0ca0241c4fb68ce167ebcbed..59dbb4dd48f81cab5216d5d8edef6ccd6e7efd9e 100644
index 2cd61138dfaa82fa698ef8d32d690f51f621ee3b..957eb2ba3f647f70522243fedf36b921e58142bd 100644
--- a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
+++ b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
@@ -52,6 +52,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish {
@@ -51,6 +51,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish {
}
public void stopFollowing() {
@ -125,10 +125,10 @@ index 3982ddbd0fa133fa0ca0241c4fb68ce167ebcbed..59dbb4dd48f81cab5216d5d8edef6ccd
this.leader = null;
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 07ecc038a1000581335b8d18c094298f2f3b100f..91ea960ba223bae42655c581b9b6c0981f333c9b 100644
index d4389172c3c006ebec5d9cd8213cdd499ab39b68..d317b8500e8d2c280e52140440cf2b9cb61c3b28 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -553,11 +553,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -543,11 +543,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
this.setFlag(4, hasStung);
}
@ -143,10 +143,10 @@ index 07ecc038a1000581335b8d18c094298f2f3b100f..91ea960ba223bae42655c581b9b6c098
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
index 3eb83b6b76d12336d3fcee9e5ef19edc836eec7f..958816ce2166248b542c96c10c398a52d769b4db 100644
index 864cb9bd4c71e41cf2ed165e5d252ccb613de6cb..290d41136f5ec7671bc4990dfe50da0a770c124d 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -47,6 +47,7 @@ public class Tadpole extends AbstractFish {
@@ -50,6 +50,7 @@ public class Tadpole extends AbstractFish {
public int age;
protected static final ImmutableList<SensorType<? extends Sensor<? super Tadpole>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.HURT_BY, SensorType.FROG_TEMPTATIONS);
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.NEAREST_VISIBLE_ADULT, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.BREED_TARGET, MemoryModuleType.IS_PANICKING);
@ -154,7 +154,7 @@ index 3eb83b6b76d12336d3fcee9e5ef19edc836eec7f..958816ce2166248b542c96c10c398a52
public Tadpole(EntityType<? extends AbstractFish> type, Level world) {
super(type, world);
@@ -97,7 +98,7 @@ public class Tadpole extends AbstractFish {
@@ -100,7 +101,7 @@ public class Tadpole extends AbstractFish {
@Override
public void aiStep() {
super.aiStep();
@ -163,7 +163,7 @@ index 3eb83b6b76d12336d3fcee9e5ef19edc836eec7f..958816ce2166248b542c96c10c398a52
this.setAge(this.age + 1);
}
@@ -107,12 +108,14 @@ public class Tadpole extends AbstractFish {
@@ -110,12 +111,14 @@ public class Tadpole extends AbstractFish {
public void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
nbt.putInt("Age", this.age);
@ -178,15 +178,15 @@ index 3eb83b6b76d12336d3fcee9e5ef19edc836eec7f..958816ce2166248b542c96c10c398a52
}
@Nullable
@@ -165,6 +168,7 @@ public class Tadpole extends AbstractFish {
CompoundTag nbttagcompound = stack.getOrCreateTag();
@@ -167,6 +170,7 @@ public class Tadpole extends AbstractFish {
Bucketable.saveDefaultDataToBucketTag(this, stack);
CustomData.update(DataComponents.BUCKET_ENTITY_DATA, stack, (nbttagcompound) -> {
nbttagcompound.putInt("Age", this.getAge());
+ nbttagcompound.putBoolean("AgeLocked", this.ageLocked); // Paper
});
}
@Override
@@ -174,6 +178,7 @@ public class Tadpole extends AbstractFish {
@@ -177,6 +181,7 @@ public class Tadpole extends AbstractFish {
this.setAge(nbt.getInt("Age"));
}
@ -203,10 +203,10 @@ index 3eb83b6b76d12336d3fcee9e5ef19edc836eec7f..958816ce2166248b542c96c10c398a52
}
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 8fc65fd7347340a89dba0b9839497aadfcc67d79..56cc6ecf7f95687db7c7c062b4ee979bfe49844b 100644
index d53ef42e64d87790ea86d806153f047005accb9f..57952ad65c905265799ba2d8f99cc4cf4aa69f94 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -695,6 +695,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@@ -753,6 +753,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
}
@ -222,7 +222,7 @@ index 8fc65fd7347340a89dba0b9839497aadfcc67d79..56cc6ecf7f95687db7c7c062b4ee979b
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
if (!this.isVehicle() && !this.isBaby()) {
@@ -737,6 +746,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@@ -795,6 +804,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
this.setFlag(16, eatingGrass);
}
@ -235,7 +235,7 @@ index 8fc65fd7347340a89dba0b9839497aadfcc67d79..56cc6ecf7f95687db7c7c062b4ee979b
if (angry) {
this.setEating(false);
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 edbb933d1f6f7fc6432f7a8b074c5dc20f47adfb..91fb62807b3c5600c83d4dc8d3fadf36e94e2133 100644
index 37da58385ecf40baeb4665a0d9c262da03c01763..4fa1a12e7e5c23e1d902b59f2a315eac64134aa8 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
@@ -74,7 +74,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
@ -248,11 +248,11 @@ index edbb933d1f6f7fc6432f7a8b074c5dc20f47adfb..91fb62807b3c5600c83d4dc8d3fadf36
public Llama(EntityType<? extends Llama> type, Level world) {
super(type, world);
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index e3da459190625a037e5542aa6ba3365f05f9f532..bd9453a92e1b2eca0a6dc56aef921e31a18a20c3 100644
index b0ac85dc3c67d2e4d70dfb09d4e8fc349aba14d2..b5cb4e4682f66ac9423af8d1547d0f1a4f9e6c5d 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -85,6 +85,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
return entityliving.getMobType() != MobType.UNDEAD && entityliving.attackable();
@@ -88,6 +88,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
return !entityliving.getType().is(EntityTypeTags.WITHER_FRIENDS) && entityliving.attackable();
};
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR);
+ // Paper start
@ -263,7 +263,7 @@ index e3da459190625a037e5542aa6ba3365f05f9f532..bd9453a92e1b2eca0a6dc56aef921e31
public WitherBoss(EntityType<? extends WitherBoss> type, Level world) {
super(type, world);
@@ -597,7 +602,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@@ -594,7 +599,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@Override
public boolean canChangeDimensions() {
@ -273,10 +273,10 @@ index e3da459190625a037e5542aa6ba3365f05f9f532..bd9453a92e1b2eca0a6dc56aef921e31
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 9637c26a3c381869f0a4dfe9189c0095387009b4..c360135b923aa8d1ed2c7caf97ede981cb605cf2 100644
index 853d65025d5e049467c1f1e7322580880506c347..57f84a0eccbdb051adddc25a1a7126f60c7c274b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -457,6 +457,16 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -440,6 +440,16 @@ public class EnderMan extends Monster implements NeutralMob {
this.entityData.set(EnderMan.DATA_STARED_AT, true);
}
@ -294,10 +294,10 @@ index 9637c26a3c381869f0a4dfe9189c0095387009b4..c360135b923aa8d1ed2c7caf97ede981
public boolean requiresCustomPersistence() {
return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ghast.java b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
index e398a7d5c560b1d94b21fe3241365ef8592d9fc8..c135bc245f59a1af706f98b9d140dee77016b12f 100644
index ba7104784cbbbb6eeacf0ca333af20212f6c47b0..373a4f036157017b0d95e8f1849780582235a549 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ghast.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
@@ -67,6 +67,12 @@ public class Ghast extends FlyingMob implements Enemy {
@@ -65,6 +65,12 @@ public class Ghast extends FlyingMob implements Enemy {
return this.explosionPower;
}
@ -311,10 +311,10 @@ index e398a7d5c560b1d94b21fe3241365ef8592d9fc8..c135bc245f59a1af706f98b9d140dee7
protected boolean shouldDespawnInPeaceful() {
return true;
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
index c043f63ff861ccb0194fc8cf102c27af5bcfe491..d4ac3e566b47cfc8688bcc2ab08385b6de4693f8 100644
index b6653a942b07c2d1f7774054a68bf04d547d7cc0..deedc707971be0bd1b7757f4e9b6d2729cc669d0 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -201,6 +201,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
@@ -202,6 +202,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
}
public void startConverting(@Nullable UUID uuid, int delay) {
@ -327,7 +327,7 @@ index c043f63ff861ccb0194fc8cf102c27af5bcfe491..d4ac3e566b47cfc8688bcc2ab08385b6
this.conversionStarter = uuid;
this.villagerConversionTime = delay;
this.getEntityData().set(ZombieVillager.DATA_CONVERTING_ID, true);
@@ -208,7 +214,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
@@ -209,7 +215,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, delay, Math.min(this.level().getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
// CraftBukkit end
@ -337,10 +337,10 @@ index c043f63ff861ccb0194fc8cf102c27af5bcfe491..d4ac3e566b47cfc8688bcc2ab08385b6
@Override
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
index a2a7d465540a328bb2c231e00f97319374ab754f..870db6ab82ef2ecb989342bb6a66435f823a9263 100644
index 636638bfee54618b36b09d49a76a46d47e1d09b4..c75ac52f302e8e29e0bdea32c85ccf6713257a9b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
@@ -101,6 +101,20 @@ public class ThrownTrident extends AbstractArrow {
@@ -105,6 +105,20 @@ public class ThrownTrident extends AbstractArrow {
return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL);
}
@ -362,7 +362,7 @@ index a2a7d465540a328bb2c231e00f97319374ab754f..870db6ab82ef2ecb989342bb6a66435f
@Override
protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
index 264b3fb45c47fbb6be78262838a5c0438860915f..f9cd595ec28f0284d11bae6bfc5bf92d56526ef9 100644
index 3952e52b94c1cc97e1d2d3885f59d7690efb74ad..9bcc0931510607b8fbd01233e2b3c346369b214d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
@@ -114,4 +114,36 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@ -403,10 +403,10 @@ index 264b3fb45c47fbb6be78262838a5c0438860915f..f9cd595ec28f0284d11bae6bfc5bf92d
+ // Paper end - Horse API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
index 35580198ee9ea566dd2643a707653512c6cd938f..a46b2dfb2f1c0c7c3b55d81fc881e481348f98b8 100644
index 17f2a0dedb55a278c6ee310ba2943fc270f9d408..9f7c40e0529058c8d35acde00a54ad6575270df4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
@@ -244,4 +244,17 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
@@ -223,4 +223,17 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
this.getHandle().setOwner(null);
}
}
@ -502,11 +502,11 @@ index cfff1be6a4a4936a2dadb2590abc3d33c123d048..3dac93b0ab5d5acf5b33dc4b0efed603
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
index b49d1e5c7389e1c2ccfe3a196b5325e5f5b190e7..42342628227742aa7ee6b84caa0e1f13b498babe 100644
index 760e8a59fd1a13d3af722bc18999f943a05151fe..a565ac47b3dc9a27e043fc9cb00b6dea950f08cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
@@ -66,4 +66,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
return registry.get(CraftNamespacedKey.toMinecraft(bukkit.getKey()));
@@ -84,4 +84,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
+ ", this can happen if a plugin creates its own cat variant with out properly registering it.");
}
}
+
@ -671,10 +671,10 @@ index fc0f0e841dc974d080e1abb9bbafb5165801131f..d657fd2c507a5b215aeab0a5f3e9c2ee
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 524d3118663f5531e530dcdfa5da4ded2415468f..65ce8ab201e7e36f6d2637e906af325e11e425dd 100644
index d30e1dd1b4525674c8a52da9b677c09a251b2467..9edcdc71b28cf08e42fbe44723ba540e8d4f7808 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1057,4 +1057,27 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1067,4 +1067,27 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return set;
}
// Paper end - tracked players API
@ -703,7 +703,7 @@ index 524d3118663f5531e530dcdfa5da4ded2415468f..65ce8ab201e7e36f6d2637e906af325e
+ // Paper end - missing entity api
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
index 73cb7aa01af3eed71b05b1a539f082b26dcd8d60..e1a2f0924da6ebcdf332040f922226af5d8a2d45 100644
index 837ae825e00feafaea87aa9d318998b0f30791d8..3815b68e139702f3f97c4fa2a77a0314d83fa758 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@@ -59,6 +59,20 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
@ -796,10 +796,10 @@ index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad926
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index e4a6cb02afdc6c0654ede24265d79092c998f828..a3b9b512c4962c5d38598a504e8f0010304abdc0 100644
index 6e3bddcbf13eae3707f600fed35ca23873f515ea..f95e991f1cc7187fc1795af5a4d85a91dd6b66f8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -921,14 +921,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -906,14 +906,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean isInvisible() {
@ -899,10 +899,10 @@ index 17f5684cba9d3ed22d9925d1951520cc4751dfe2..3a3563a1bdbc0d84d973b3a04b50b78b
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index fc83dde12957e575a4f1d4bee73c320bab95606f..ae430c36ed433e337dd92f197f1717fbf00ac0e1 100644
index 60d09655c5b8b9ff289291ee6badfb5aadf8533e..fb29afb6517b009b81285adc9e6dca2eb7f74aee 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -148,4 +148,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
@@ -145,4 +145,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
return getHandle().getMaxHeadXRot();
}
// Paper end
@ -1171,10 +1171,10 @@ index 451a9bfd9b9b6945e224f1bb05c7951ed934b4e3..d7c6a0bbc5671ea8f2488230c94df514
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
index 0fa00ae2b8a84e1ba5a902c1e46e561a761c54b6..20f9735c7cb76024e15dbdca7684f5c560876175 100644
index 33d6e8121755ad6cddacb4fc69e795f9831c27bd..e374b9f40eddca13b30855d25a2030f8df98138f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
@@ -31,4 +31,27 @@ public class CraftTrident extends CraftArrow implements Trident {
@@ -31,4 +31,27 @@ public class CraftTrident extends CraftAbstractArrow implements Trident {
public String toString() {
return "CraftTrident";
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 08f502452dc1c6ee83e04650b08a08e521c64144..37a801668c2fa4e7eaf4839b2f69a92f9f91907f 100644
index 9b2abc64556acf9547e5927847f0a02c4ff66001..fa36a68eb28ab9600cdbfe26a2661f76d4ccb743 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1096,7 +1096,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1121,7 +1121,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper end - Book size limits
// CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {

View File

@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9e4453878246a22e320a6f8eb7aa08cb17438faf..60590ee30d2ff3b94c796bae2d7e9d9bc145fc0d 100644
index f4b884a7c9e20823e626f7f5604cc4e0b2edd570..e42d40654a2bb66c277daa36ee08b56696b8c6a4 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -225,7 +225,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -230,7 +230,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
public LevelChunk getChunkIfLoaded(int x, int z) {
@ -21,10 +21,10 @@ index 9e4453878246a22e320a6f8eb7aa08cb17438faf..60590ee30d2ff3b94c796bae2d7e9d9b
@Override
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 40f1b4ba266f96629b989590c7c81cd7534e93da..a1dbd23a5d8ea064f1b7909f3e285a4dadf34d88 100644
index 411841f2d8013ae9142b96c251aabd54d16c5b73..efda6fbe8d02477cf8251c68683ae8bf7c5f1667 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -182,6 +182,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -179,6 +179,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return (CraftServer) Bukkit.getServer();
}
@ -39,10 +39,10 @@ index 40f1b4ba266f96629b989590c7c81cd7534e93da..a1dbd23a5d8ea064f1b7909f3e285a4d
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config
diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
index 0d5ae91a9b43df7b412968ab5faf5498c09169f9..37ae0f928440af5b2fdfe68ad6c9c54e8c95c82c 100644
index 13b34e89bd3e55df1bb1d4d0cf013bafae43f502..df6c97be1b278c97a20390be5d3e60f429383702 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
+++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
@@ -55,7 +55,7 @@ public class GameEventDispatcher {
@@ -56,7 +56,7 @@ public class GameEventDispatcher {
for (int l1 = j; l1 <= i1; ++l1) {
for (int i2 = l; i2 <= k1; ++i2) {

View File

@ -58,10 +58,10 @@ index 0000000000000000000000000000000000000000..01a2bc1feec808790bb93618ce46adb9
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 9939cad5af2d7873f188f18978029663a8d785de..f3cea7a8de334419b4a2f6dc64ef0e20fd715e75 100644
index ddf101fd613c854f77971d97a5b0f9319f21242a..a55a2db66d8c8482c5b4107b21bb82d7e8ff4288 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -273,7 +273,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -274,7 +274,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
ClickEvent chatclickable = chatmodifier.getClickEvent();
if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
@ -80,7 +80,7 @@ index 9939cad5af2d7873f188f18978029663a8d785de..f3cea7a8de334419b4a2f6dc64ef0e20
flag1 = true;
}
}
@@ -310,8 +320,23 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -311,8 +321,23 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
String s = player == null ? "Sign" : player.getName().getString();
Object object = player == null ? Component.literal("Sign") : player.getDisplayName();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerArmSwingEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 37a801668c2fa4e7eaf4839b2f69a92f9f91907f..de6b8af2f586469cd97ad796ee9a841a83f8f068 100644
index fa36a68eb28ab9600cdbfe26a2661f76d4ccb743..89b4484154d25e8841e462982ca84f5025bfd016 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2328,7 +2328,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2402,7 +2402,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} // Paper end - Call interact event
// Arm swing animation

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix kick event leave message not being sent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c917b271fb6325840bb791566e9dec607bdd819a..5f69e743e2422bbcfd4678b550940960374ecabd 100644
index a9130dd3097c31d91baaf1405a369881393d42d5..fccc62d601680f7ed2765bb331667baf82e75a26 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -268,7 +268,6 @@ public class ServerPlayer extends Player {
@@ -284,7 +284,6 @@ public class ServerPlayer extends Player {
public boolean joining = true;
public boolean sentListPacket = false;
public boolean supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready
@ -17,10 +17,10 @@ index c917b271fb6325840bb791566e9dec607bdd819a..5f69e743e2422bbcfd4678b550940960
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index a65a1466dab52fca75cda16a4b22fef03b6207a0..0306771b8f90dcdd77f151c19c6c2d75c41f8feb 100644
index b9767aff520d32d4615e3cb9e24a294553c70b97..86af1b4b860a144462d856b4ef1702f7b811e4de 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -77,6 +77,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -98,6 +98,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void onDisconnect(Component reason) {
@ -32,7 +32,7 @@ index a65a1466dab52fca75cda16a4b22fef03b6207a0..0306771b8f90dcdd77f151c19c6c2d75
if (this.isSingleplayerOwner()) {
ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out");
this.server.halt(false);
@@ -320,7 +325,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -365,7 +370,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// Do not kick the player
return;
}
@ -40,7 +40,7 @@ index a65a1466dab52fca75cda16a4b22fef03b6207a0..0306771b8f90dcdd77f151c19c6c2d75
// Send the possibly modified leave message
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end
@@ -329,7 +333,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -374,7 +378,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
this.connection.disconnect(ichatbasecomponent);
}));
@ -50,10 +50,10 @@ index a65a1466dab52fca75cda16a4b22fef03b6207a0..0306771b8f90dcdd77f151c19c6c2d75
MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index de6b8af2f586469cd97ad796ee9a841a83f8f068..cb7d038b902c326d2ebec61f1dc40849c3cfbc63 100644
index 89b4484154d25e8841e462982ca84f5025bfd016..cc45bb947fbd6f2b7a7bc11a2bc66336a7bf3c9e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1882,6 +1882,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1884,6 +1884,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void onDisconnect(Component reason) {
@ -66,7 +66,7 @@ index de6b8af2f586469cd97ad796ee9a841a83f8f068..cb7d038b902c326d2ebec61f1dc40849
// CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) {
return;
@@ -1890,11 +1896,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1892,11 +1898,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), reason.getString());
@ -86,7 +86,7 @@ index de6b8af2f586469cd97ad796ee9a841a83f8f068..cb7d038b902c326d2ebec61f1dc40849
this.chatMessageChain.close();
// CraftBukkit start - Replace vanilla quit message handling with our own.
/*
@@ -1904,7 +1916,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1906,7 +1918,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.disconnect();
// Paper start - Adventure
@ -96,10 +96,10 @@ index de6b8af2f586469cd97ad796ee9a841a83f8f068..cb7d038b902c326d2ebec61f1dc40849
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
// Paper end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index dcb8de1c28b767068aa10f044bd8cf72ef6cfcaf..57e7ce227666a2e273c9e61a102152efd2c0ebd9 100644
index 4d32c917c3a5455e4ba028fef49ec483bd5b0ad8..6cc5bca80cdf1f70c5599026483625ef6c1b2bd9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -569,6 +569,11 @@ public abstract class PlayerList {
@@ -567,6 +567,11 @@ public abstract class PlayerList {
}
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component

View File

@ -11,10 +11,10 @@ It does not make a lot of sense to damage players if they get crammed,
For those who really want it a config option is provided.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5f69e743e2422bbcfd4678b550940960374ecabd..bb0a5e3cdfec18a71c30fde98d21affcd95a9885 100644
index fccc62d601680f7ed2765bb331667baf82e75a26..b9aadb3eea0a8910f58fa747c50959ebcf89292a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -95,6 +95,7 @@ import net.minecraft.util.Mth;
@@ -98,6 +98,7 @@ import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
import net.minecraft.world.damagesource.DamageSource;
@ -22,7 +22,7 @@ index 5f69e743e2422bbcfd4678b550940960374ecabd..bb0a5e3cdfec18a71c30fde98d21affc
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
@@ -1430,7 +1431,7 @@ public class ServerPlayer extends Player {
@@ -1497,7 +1498,7 @@ public class ServerPlayer extends Player {
@Override
public boolean isInvulnerableTo(DamageSource damageSource) {

View File

@ -28,7 +28,7 @@ index 4bd813161a5d76a83cdbd0a9209b9ea9e60ffe1b..e2764186bd6b838ed5cd86c15597a08d
* Get a named timer for the specified tile entity type to track type specific timings.
* @param entity
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
index f639cafa64d98a001e622882c647701547f5c3ac..03092417cd8ab5c6d266f3af9f20f47b34cfaba3 100644
index f639cafa64d98a001e622882c647701547f5c3ac..9379dd4056018b52c93ed4888dcdc94579bd9691 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
@@ -14,6 +14,10 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
@ -93,7 +93,7 @@ index f639cafa64d98a001e622882c647701547f5c3ac..03092417cd8ab5c6d266f3af9f20f47b
protected void tick(ServerLevel world, E entity, long time) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..9e90cb2f51d1bacacb287e912d14ab9152523205 100644
index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..85b4b24361e785acf75571ff98f924c00ae80748 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
@@ -26,8 +26,21 @@ public abstract class Sensor<E extends LivingEntity> {

View File

@ -19,30 +19,34 @@ index b9c2b41d9c46c871bab44cfb1d454f4141f1627b..d975b349aa81327c6b6c23e83e955215
}
}
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 4224e8e75613b6ec0228b2757cb98140d83bc2e2..4abd26c7baf8f198f13dd41a3146f9ece13a4164 100644
index fb4c7220c4edad54813036d62db7e3eefeda92a3..83d8a09980c4ab3c7c97b07c3dcdb3d7dab9e1aa 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -535,7 +535,9 @@ public class Panda extends Animal {
}
@@ -549,11 +549,13 @@ public class Panda extends Animal {
List<ItemStack> list1 = loottable.getRandomItems(lootparams);
Iterator iterator1 = list1.iterator();
if (!this.level().isClientSide() && this.random.nextInt(700) == 0 && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
this.spawnAtLocation((ItemLike) Items.SLIME_BALL);
while (iterator1.hasNext()) {
ItemStack itemstack = (ItemStack) iterator1.next();
this.spawnAtLocation(itemstack);
}
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
}
}
@@ -659,7 +661,9 @@ public class Panda extends Animal {
@@ -677,7 +679,9 @@ public class Panda extends Animal {
ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND);
if (!itemstack1.isEmpty() && !player.getAbilities().instabuild) {
if (!itemstack1.isEmpty() && !player.hasInfiniteMaterials()) {
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
this.spawnAtLocation(itemstack1);
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
}
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1));
@@ -941,7 +945,9 @@ public class Panda extends Animal {
@@ -959,7 +963,9 @@ public class Panda extends Animal {
ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
if (!itemstack.isEmpty()) {
@ -53,10 +57,10 @@ index 4224e8e75613b6ec0228b2757cb98140d83bc2e2..4abd26c7baf8f198f13dd41a3146f9ec
int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10;
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 8231b48a9e88adb2a1ca3441ee81e3d653c9ae78..ea0902b4ba68a89b1f51281b10c1dfd1bfb42833 100644
index e1f2425ae6d3737302f6a7e010b172a62b41a018..20d9690127aed9c8ae2632bcf497ba0e473b7bea 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
@@ -317,7 +317,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@@ -311,7 +311,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void finishConversion(ServerLevel world) {
PiglinAi.cancelAdmiring(this);
@ -67,7 +71,7 @@ index 8231b48a9e88adb2a1ca3441ee81e3d653c9ae78..ea0902b4ba68a89b1f51281b10c1dfd1
}
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 deabb58c4562b22d27e450c97812e18e30cbfde7..4a071dea48e86a962fd41a6ebecc5dfdaf9df78a 100644
index a3df3798ebbbc2ccdf29d9f5ddc62d5e395fb8e5..31bb652c7ef35e7d61df2b1b60589fbb5c845bb0 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
@@ -271,7 +271,9 @@ public class PiglinAi {
@ -91,10 +95,10 @@ index deabb58c4562b22d27e450c97812e18e30cbfde7..4a071dea48e86a962fd41a6ebecc5dfd
}
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 f696ae53bf1192b2ebfcd6406adfdb494ab2521c..d783b4d561e252af8928e4b1ea13c4e61598f8bf 100644
index 9f54e46b870e78d1d360ea79604708db08276ae3..d3fef00a351a6c6ae6af1f1dcf793c5954fd3485 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -253,7 +253,9 @@ public abstract class Raider extends PatrollingMonster {
@@ -272,7 +272,9 @@ public abstract class Raider extends PatrollingMonster {
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) {