Archiviert
13
0
Dieser Commit ist enthalten in:
Bjarne Koll 2024-10-25 12:28:34 +02:00
Ursprung 227caac7f0
Commit afbb0d88dd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27F6CCCF55D2EE62
15 geänderte Dateien mit 156 neuen und 145 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Item serialization as json
diff --git a/src/main/java/net/minecraft/world/item/component/CustomData.java b/src/main/java/net/minecraft/world/item/component/CustomData.java
index 6b7245cf05ea4b6ce05462eb3164bce7f5d76a03..ac1914438307e8a7cc3a3b6352e88a0638f8a33b 100644
index c80fd4960dfbb0fde37363e7df25b0a5411bdb11..ff7f6916f65466c25a7bde35d64682c15b211697 100644
--- a/src/main/java/net/minecraft/world/item/component/CustomData.java
+++ b/src/main/java/net/minecraft/world/item/component/CustomData.java
@@ -28,7 +28,17 @@ import org.slf4j.Logger;
@ -28,7 +28,7 @@ index 6b7245cf05ea4b6ce05462eb3164bce7f5d76a03..ac1914438307e8a7cc3a3b6352e88a06
public static final Codec<CustomData> CODEC_WITH_ID = CODEC.validate(
component -> component.getUnsafe().contains("id", 8) ? DataResult.success(component) : DataResult.error(() -> "Missing id for entity in: " + component)
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 8b2dbdfcdc4e98602f6bfd48d2c53840730f4691..d06aab9bd5cd901c8367f9680f5d27ddb17b3dc4 100644
index 293757b8e96ae7b0e807d807affa3fdab5181d39..f880bf91155b017c954e3e321c5a203c05c2162f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -511,6 +511,39 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -9,7 +9,7 @@ the setSlot method, making a validation necessary over simply silently
ignoring invalid slot values.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
index eafa54c870c3e2aef30c3f9f96f516607a7cae24..8dea4321e41080829b474ad7b5a12c6a622181fd 100644
index 656c9a6d8cd42891141ee29ec91ab5d166051ed6..df847c9897f209700a79aa1a8254b708ef7bf260 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
@@ -70,6 +70,11 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i

Datei anzeigen

@ -30,7 +30,7 @@ completely unnecessary, which also rids paper of the previous described
incompatibility with non-ticking chunks.
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 03cfa29bdb426a9fb6b1b6be6e897da48d4f2f3e..4423973d4d9a2c3879d98d1d4c8b8c117c677ac5 100644
index 246b5649883e4f305afa5a887b9df0f3735f7593..5d8885bca55503bf7e1a2a4e1bb9b3bd86d55391 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -60,7 +60,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@ -60,7 +60,7 @@ index 03cfa29bdb426a9fb6b1b6be6e897da48d4f2f3e..4423973d4d9a2c3879d98d1d4c8b8c11
this.xo = this.getX();
this.yo = this.getY();
@@ -211,7 +210,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -212,7 +211,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
this.mergeWithNeighbours();
}
@ -69,7 +69,7 @@ index 03cfa29bdb426a9fb6b1b6be6e897da48d4f2f3e..4423973d4d9a2c3879d98d1d4c8b8c11
if (this.age != -32768) {
++this.age;
}
@@ -242,12 +241,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -243,12 +242,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
// Spigot start - copied from above
@Override
public void inactiveTick() {
@ -91,10 +91,10 @@ index 03cfa29bdb426a9fb6b1b6be6e897da48d4f2f3e..4423973d4d9a2c3879d98d1d4c8b8c11
if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate
// CraftBukkit start - fire ItemDespawnEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 2280004638fd19ed018cb3e77d53a018b34ec516..2b43337ac63d051718a2074fcc46e128a1d65129 100644
index 17974f85d3c1db549ea11e8809954cd9d2af063e..5a6e119d29ecdc45dee40d5984e502fb8e4d1543 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -96,7 +96,7 @@ public class Zombie extends Monster {
@@ -98,7 +98,7 @@ public class Zombie extends Monster {
private boolean canBreakDoors;
private int inWaterTime;
public int conversionTime;
@ -103,7 +103,7 @@ index 2280004638fd19ed018cb3e77d53a018b34ec516..2b43337ac63d051718a2074fcc46e128
private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
public Zombie(EntityType<? extends Zombie> type, Level world) {
@@ -219,10 +219,7 @@ public class Zombie extends Monster {
@@ -217,10 +217,7 @@ public class Zombie extends Monster {
public void tick() {
if (!this.level().isClientSide && this.isAlive() && !this.isNoAi()) {
if (this.isUnderWaterConverting()) {
@ -115,7 +115,7 @@ index 2280004638fd19ed018cb3e77d53a018b34ec516..2b43337ac63d051718a2074fcc46e128
if (this.conversionTime < 0) {
this.doUnderWaterConversion();
}
@@ -239,7 +236,7 @@ public class Zombie extends Monster {
@@ -237,7 +234,7 @@ public class Zombie extends Monster {
}
super.tick();
@ -124,7 +124,7 @@ index 2280004638fd19ed018cb3e77d53a018b34ec516..2b43337ac63d051718a2074fcc46e128
}
@Override
@@ -280,7 +277,7 @@ public class Zombie extends Monster {
@@ -278,7 +275,7 @@ public class Zombie extends Monster {
}
// Paper end - Add more Zombie API
public void startUnderWaterConversion(int ticksUntilWaterConversion) {
@ -134,10 +134,10 @@ index 2280004638fd19ed018cb3e77d53a018b34ec516..2b43337ac63d051718a2074fcc46e128
this.getEntityData().set(Zombie.DATA_DROWNED_CONVERSION_ID, true);
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
index a2fafef89d5354e2cb02f5672810909950a57777..bf2c303a314205590a2839e0f729af3a9ff40a86 100644
index 2bafacd7bc56186d9105d2031180f8c4a6940018..4ea29e8f2b39d7b44e0461d6a2cdd3fc257abd44 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
@@ -54,7 +54,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
@@ -55,7 +55,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
public int fuel;
protected final ContainerData dataAccess;
// CraftBukkit start - add fields and methods
@ -146,7 +146,7 @@ index a2fafef89d5354e2cb02f5672810909950a57777..bf2c303a314205590a2839e0f729af3a
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
private int maxStack = MAX_STACK;
@@ -169,12 +169,10 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
@@ -170,12 +170,10 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
boolean flag1 = blockEntity.brewTime > 0;
ItemStack itemstack1 = (ItemStack) blockEntity.items.get(3);

Datei anzeigen

@ -8,7 +8,7 @@ Not sure why advancements even had pretty printing enabled.
My best guess was by accident on mojang's part, especially since stats json files don't have pretty printing.
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 9fabf9322acd663c4452b562494e74aa42eb19da..862a4bf003b7f810fb57dbcd150a1417c902b633 100644
index 1dcb8a287be7df2a59b5b4c1345be80637a7f679..8e2eb7b61421ceb063654826941f1a81f6f50bdf 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix PlayerCommandPreprocessEvent on signed commands
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index fcccf989c25f0a259b160c4ff7873f7009e64d14..befeaac4786760f6847a5945da2296a3e68dbb17 100644
index 1722f11ad070715077f5dcaff008b98f7ee104ab..cae9682df8795c5f73e86c27d717b6f72e7e8592 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2245,24 +2245,32 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2195,24 +2195,32 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command, new LazyPlayerSet(this.server));
this.cserver.getPluginManager().callEvent(event);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add enchantWithLevels with enchantment registry set
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index fef91dbede067f1ab99a9c7d463a2c55cc6cae3a..4abd939223a9d5a0c52a64e22c29fe1de85500e9 100644
index 944dcc1126c947b4c8c3b4fdd174eb57320abbba..260fb93e71812698beb475bab7a05b9b860c6cbd 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -319,6 +319,22 @@ public final class CraftItemFactory implements ItemFactory {
@@ -322,6 +322,22 @@ public final class CraftItemFactory implements ItemFactory {
);
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Improve entity effect API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index cd789c235acf740ec29c30b180e7fbe1a140caa9..89c8713d2c2206d1b0d8c0a392c9d13b3e736f0c 100644
index ca95a36b0149d4b8a67c3b42316c5d9d0415f5dd..64c6f54cc4d0c22bc972b808cb92925cc7526db2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1299,4 +1299,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1300,4 +1300,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return this.getHandle().getScoreboardName();
}
// Paper end - entity scoreboard name
@ -25,10 +25,10 @@ index cd789c235acf740ec29c30b180e7fbe1a140caa9..89c8713d2c2206d1b0d8c0a392c9d13b
+ // Paper end - broadcast hurt animation
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ad740739437be632fc7fedec488a7d0c49534688..42d7660efe5baa6f796f2a7606686c765b6f2478 100644
index 8d16575c74b81ada4e4efe70e8f077f07cd0a3f0..852cadccfbd22d535f26ac781aea2fe99686947e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1277,6 +1277,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1294,6 +1294,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendHurtAnimation(float yaw) {
@ -40,7 +40,7 @@ index ad740739437be632fc7fedec488a7d0c49534688..42d7660efe5baa6f796f2a7606686c76
if (this.getHandle().connection == null) {
return;
}
@@ -1286,7 +1291,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1303,7 +1308,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
* This makes no sense. We'll add 90 to it so that 0 = front, clockwise from there.
*/
float actualYaw = yaw + 90;
@ -49,9 +49,9 @@ index ad740739437be632fc7fedec488a7d0c49534688..42d7660efe5baa6f796f2a7606686c76
}
@Override
@@ -3553,4 +3558,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
((ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer)this.getHandle())
.moonrise$getViewDistanceHolder().setSendViewDistance(viewDistance);
@@ -3545,4 +3550,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setSendViewDistance(final int viewDistance) {
throw new UnsupportedOperationException("Not implemented yet");
}
+
+ // Paper start - entity effect API

Datei anzeigen

@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..84dead75191634c3aa6031781a2ff308
+ }
+}
diff --git a/src/main/java/net/minecraft/world/inventory/BrewingStandMenu.java b/src/main/java/net/minecraft/world/inventory/BrewingStandMenu.java
index 68c529cb38d61cd3a0f39bef0f666057fc219c9b..6ec207e91f93b3ab625515dc75367ba399818876 100644
index 182c87a0b7081f6a777c4c7969961c30438b0d86..3be46ecfa382e15d09a88912c498abb6034c3a90 100644
--- a/src/main/java/net/minecraft/world/inventory/BrewingStandMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/BrewingStandMenu.java
@@ -41,14 +41,14 @@ public class BrewingStandMenu extends AbstractContainerMenu {
@@ -42,14 +42,14 @@ public class BrewingStandMenu extends AbstractContainerMenu {
// CraftBukkit end
public BrewingStandMenu(int syncId, Inventory playerInventory) {
@ -44,7 +44,7 @@ index 68c529cb38d61cd3a0f39bef0f666057fc219c9b..6ec207e91f93b3ab625515dc75367ba3
this.brewingStand = inventory;
this.brewingStandData = propertyDelegate;
PotionBrewing potionbrewer = playerInventory.player.level().potionBrewing();
@@ -60,7 +60,20 @@ public class BrewingStandMenu extends AbstractContainerMenu {
@@ -61,7 +61,20 @@ public class BrewingStandMenu extends AbstractContainerMenu {
// Paper end - custom potion mixes
this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionbrewer, inventory, 3, 79, 17));
this.addSlot(new BrewingStandMenu.FuelSlot(inventory, 4, 17, 17));
@ -63,14 +63,14 @@ index 68c529cb38d61cd3a0f39bef0f666057fc219c9b..6ec207e91f93b3ab625515dc75367ba3
+ }
+ });
+ // Paper end - Add recipeBrewTime
int j;
this.addStandardInventorySlots(playerInventory, 8, 84);
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
index bf2c303a314205590a2839e0f729af3a9ff40a86..0a93bacd62249bae1800ff306b8a7c765b0e5a8b 100644
index 4ea29e8f2b39d7b44e0461d6a2cdd3fc257abd44..02fc9ce21c7d367055da350d21be4870d4242f3a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
@@ -49,6 +49,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
@@ -50,6 +50,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
public static final int NUM_DATA_VALUES = 2;
private NonNullList<ItemStack> items;
public int brewTime;
@ -78,7 +78,7 @@ index bf2c303a314205590a2839e0f729af3a9ff40a86..0a93bacd62249bae1800ff306b8a7c76
private boolean[] lastPotionCount;
private Item ingredient;
public int fuel;
@@ -99,6 +100,11 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
@@ -100,6 +101,11 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
case 1:
j = BrewingStandBlockEntity.this.fuel;
break;
@ -90,7 +90,7 @@ index bf2c303a314205590a2839e0f729af3a9ff40a86..0a93bacd62249bae1800ff306b8a7c76
default:
j = 0;
}
@@ -114,13 +120,18 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
@@ -115,13 +121,18 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
break;
case 1:
BrewingStandBlockEntity.this.fuel = value;
@ -110,7 +110,7 @@ index bf2c303a314205590a2839e0f729af3a9ff40a86..0a93bacd62249bae1800ff306b8a7c76
}
};
}
@@ -188,7 +199,8 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
@@ -189,7 +200,8 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
// CraftBukkit start
BrewingStartEvent event = new BrewingStartEvent(CraftBlock.at(world, pos), CraftItemStack.asCraftMirror(itemstack1), 400);
world.getCraftServer().getPluginManager().callEvent(event);

Datei anzeigen

@ -5,24 +5,24 @@ Subject: [PATCH] Call bucket events for cauldrons
diff --git a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java
index f301c20e808b77cb3fcffd9a7c8102928306456e..b584cfe44fbb93d470ca56c091423833c4007d16 100644
index df76185d42075834a39c79515917e03beb938a06..ee2c4c5265d96afe592c5007b0b6ad7649ce5190 100644
--- a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java
+++ b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java
@@ -60,7 +60,7 @@ public interface CauldronInteraction {
@@ -53,7 +53,7 @@ public interface CauldronInteraction {
static CauldronInteraction.InteractionMap newInteractionMap(String name) {
Object2ObjectOpenHashMap<Item, CauldronInteraction> object2objectopenhashmap = new Object2ObjectOpenHashMap();
- object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
return InteractionResult.TRY_WITH_EMPTY_HAND;
});
CauldronInteraction.InteractionMap cauldroninteraction_a = new CauldronInteraction.InteractionMap(name, object2objectopenhashmap);
@@ -69,13 +69,13 @@ public interface CauldronInteraction {
@@ -62,13 +62,13 @@ public interface CauldronInteraction {
return cauldroninteraction_a;
}
- ItemInteractionResult interact(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack);
+ ItemInteractionResult interact(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection); // Paper - add hitDirection
- InteractionResult interact(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack);
+ InteractionResult interact(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection); // Paper - add hitDirection
static void bootStrap() {
Map<Item, CauldronInteraction> map = CauldronInteraction.EMPTY.map();
@ -33,7 +33,7 @@ index f301c20e808b77cb3fcffd9a7c8102928306456e..b584cfe44fbb93d470ca56c091423833
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
if (potioncontents != null && potioncontents.is(Potions.WATER)) {
@@ -103,12 +103,12 @@ public interface CauldronInteraction {
@@ -96,12 +96,12 @@ public interface CauldronInteraction {
Map<Item, CauldronInteraction> map1 = CauldronInteraction.WATER.map();
CauldronInteraction.addDefaultInteractions(map1);
@ -49,17 +49,17 @@ index f301c20e808b77cb3fcffd9a7c8102928306456e..b584cfe44fbb93d470ca56c091423833
if (!world.isClientSide) {
// CraftBukkit start
if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
@@ -127,7 +127,7 @@ public interface CauldronInteraction {
@@ -120,7 +120,7 @@ public interface CauldronInteraction {
return ItemInteractionResult.sidedSuccess(world.isClientSide);
return InteractionResult.SUCCESS;
});
- map1.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ map1.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection
if ((Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) == 3) {
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
return InteractionResult.TRY_WITH_EMPTY_HAND;
} else {
@@ -194,15 +194,15 @@ public interface CauldronInteraction {
map1.put(Items.YELLOW_SHULKER_BOX, CauldronInteraction.SHULKER_BOX);
@@ -187,18 +187,18 @@ public interface CauldronInteraction {
map1.put(Items.YELLOW_SHULKER_BOX, CauldronInteraction::shulkerBoxInteraction);
Map<Item, CauldronInteraction> map2 = CauldronInteraction.LAVA.map();
- map2.put(Items.BUCKET, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
@ -76,40 +76,44 @@ index f301c20e808b77cb3fcffd9a7c8102928306456e..b584cfe44fbb93d470ca56c091423833
+ map3.put(Items.BUCKET, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection
return CauldronInteraction.fillBucket(iblockdata, world, blockposition, entityhuman, enumhand, itemstack, new ItemStack(Items.POWDER_SNOW_BUCKET), (iblockdata1) -> {
return (Integer) iblockdata1.getValue(LayeredCauldronBlock.LEVEL) == 3;
}, SoundEvents.BUCKET_FILL_POWDER_SNOW);
@@ -217,10 +217,24 @@ public interface CauldronInteraction {
- }, SoundEvents.BUCKET_FILL_POWDER_SNOW);
+ }, SoundEvents.BUCKET_FILL_POWDER_SNOW, hitDirection); // Paper - add hitDirection
});
CauldronInteraction.addDefaultInteractions(map3);
}
@@ -210,10 +210,24 @@ public interface CauldronInteraction {
}
static ItemInteractionResult fillBucket(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, ItemStack output, Predicate<BlockState> fullPredicate, SoundEvent soundEvent) {
static InteractionResult fillBucket(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, ItemStack output, Predicate<BlockState> fullPredicate, SoundEvent soundEvent) {
+ // Paper start - add hitDirection
+ return fillBucket(state, world, pos, player, hand, stack, output, fullPredicate, soundEvent, null); // Paper - add hitDirection
+ }
+ static ItemInteractionResult fillBucket(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, ItemStack output, Predicate<BlockState> fullPredicate, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) {
+ static InteractionResult fillBucket(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, ItemStack output, Predicate<BlockState> fullPredicate, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) {
+ // Paper end - add hitDirection
if (!fullPredicate.test(state)) {
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
return InteractionResult.TRY_WITH_EMPTY_HAND;
} else {
if (!world.isClientSide) {
+ // Paper start - fire PlayerBucketFillEvent
+ if (hitDirection != null) {
+ org.bukkit.event.player.PlayerBucketEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerBucketFillEvent((net.minecraft.server.level.ServerLevel) world, player, pos, pos, hitDirection, stack, output.getItem(), hand);
+ if (event.isCancelled()) {
+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
+ return InteractionResult.PASS;
+ }
+ output = event.getItemStack() != null ? org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY;
+ }
+ // Paper end - fire PlayerBucketFillEvent
// CraftBukkit start
if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChangeEvent
return ItemInteractionResult.SUCCESS;
@@ -241,7 +255,22 @@ public interface CauldronInteraction {
return InteractionResult.SUCCESS;
@@ -234,7 +248,22 @@ public interface CauldronInteraction {
}
static ItemInteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent) {
static InteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent) {
+ // Paper start - add hitDirection
+ return emptyBucket(world, pos, player, hand, stack, state, soundEvent, null);
+ }
+ static ItemInteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) {
+ static InteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) {
+ // Paper end - add hitDirection
if (!world.isClientSide) {
+ // Paper start - fire PlayerBucketEmptyEvent
@ -117,15 +121,15 @@ index f301c20e808b77cb3fcffd9a7c8102928306456e..b584cfe44fbb93d470ca56c091423833
+ if (hitDirection != null) {
+ org.bukkit.event.player.PlayerBucketEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerBucketEmptyEvent((net.minecraft.server.level.ServerLevel) world, player, pos, pos, hitDirection, stack, hand);
+ if (event.isCancelled()) {
+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
+ return InteractionResult.PASS;
+ }
+ output = event.getItemStack() != null ? org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY;
+ }
+ // Paper end - fire PlayerBucketEmptyEvent
// CraftBukkit start
if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
return ItemInteractionResult.SUCCESS;
@@ -249,7 +278,7 @@ public interface CauldronInteraction {
return InteractionResult.SUCCESS;
@@ -242,7 +271,7 @@ public interface CauldronInteraction {
// CraftBukkit end
Item item = stack.getItem();
@ -134,54 +138,63 @@ index f301c20e808b77cb3fcffd9a7c8102928306456e..b584cfe44fbb93d470ca56c091423833
player.awardStat(Stats.FILL_CAULDRON);
player.awardStat(Stats.ITEM_USED.get(item));
// world.setBlockAndUpdate(blockposition, iblockdata); // CraftBukkit
@@ -267,16 +296,16 @@ public interface CauldronInteraction {
CauldronInteraction.InteractionMap WATER = CauldronInteraction.newInteractionMap("water");
CauldronInteraction.InteractionMap LAVA = CauldronInteraction.newInteractionMap("lava");
CauldronInteraction.InteractionMap POWDER_SNOW = CauldronInteraction.newInteractionMap("powder_snow");
- CauldronInteraction FILL_WATER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
- return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, (BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY);
+ CauldronInteraction FILL_WATER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection
+ return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, (BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY, hitDirection); // Paper - add hitDirection
};
- CauldronInteraction FILL_LAVA = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
- return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA);
+ CauldronInteraction FILL_LAVA = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection
+ return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA, hitDirection); // Paper - add hitDirection
};
- CauldronInteraction FILL_POWDER_SNOW = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ CauldronInteraction FILL_POWDER_SNOW = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection
return CauldronInteraction.emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, (BlockState) Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY_POWDER_SNOW);
};
- CauldronInteraction SHULKER_BOX = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ CauldronInteraction SHULKER_BOX = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection
// CraftBukkit end
Block block = Block.byItem(itemstack.getItem());
@@ -253,19 +282,19 @@ public interface CauldronInteraction {
return InteractionResult.SUCCESS;
}
@@ -299,7 +328,7 @@ public interface CauldronInteraction {
return ItemInteractionResult.sidedSuccess(world.isClientSide);
}
};
- CauldronInteraction BANNER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { // CraftBukkit - decompile error
+ CauldronInteraction BANNER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // CraftBukkit - decompile error // Paper - add hitDirection
BannerPatternLayers bannerpatternlayers = (BannerPatternLayers) itemstack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY);
- private static InteractionResult fillWaterInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) {
- return CauldronInteraction.emptyBucket(world, pos, player, hand, stack, (BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY);
+ private static InteractionResult fillWaterInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection
+ return CauldronInteraction.emptyBucket(world, pos, player, hand, stack, (BlockState) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY, hitDirection); // Paper - add hitDirection
}
if (bannerpatternlayers.layers().isEmpty()) {
@@ -322,7 +351,7 @@ public interface CauldronInteraction {
return ItemInteractionResult.sidedSuccess(world.isClientSide);
- private static InteractionResult fillLavaInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) {
- return (InteractionResult) (CauldronInteraction.isUnderWater(world, pos) ? InteractionResult.CONSUME : CauldronInteraction.emptyBucket(world, pos, player, hand, stack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA));
+ private static InteractionResult fillLavaInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection
+ return (InteractionResult) (CauldronInteraction.isUnderWater(world, pos) ? InteractionResult.CONSUME : CauldronInteraction.emptyBucket(world, pos, player, hand, stack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEvents.BUCKET_EMPTY_LAVA, hitDirection)); // Paper - add hitDirection
}
- private static InteractionResult fillPowderSnowInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) {
- return (InteractionResult) (CauldronInteraction.isUnderWater(world, pos) ? InteractionResult.CONSUME : CauldronInteraction.emptyBucket(world, pos, player, hand, stack, (BlockState) Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY_POWDER_SNOW));
+ private static InteractionResult fillPowderSnowInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection
+ return (InteractionResult) (CauldronInteraction.isUnderWater(world, pos) ? InteractionResult.CONSUME : CauldronInteraction.emptyBucket(world, pos, player, hand, stack, (BlockState) Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEvents.BUCKET_EMPTY_POWDER_SNOW, hitDirection)); // Paper - add hitDirection
}
- private static InteractionResult shulkerBoxInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) {
+ private static InteractionResult shulkerBoxInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection
Block block = Block.byItem(stack.getItem());
if (!(block instanceof ShulkerBoxBlock)) {
@@ -283,12 +312,11 @@ public interface CauldronInteraction {
player.awardStat(Stats.CLEAN_SHULKER_BOX);
// LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
}
};
- CauldronInteraction DYED_ITEM = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { // CraftBukkit - decompile error
+ CauldronInteraction DYED_ITEM = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // CraftBukkit - decompile error // Paper - add hitDirection
if (!itemstack.is(ItemTags.DYEABLE)) {
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
} else if (!itemstack.has(DataComponents.DYED_COLOR)) {
-
return InteractionResult.SUCCESS;
}
}
- private static InteractionResult bannerInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) {
+ private static InteractionResult bannerInteraction(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection
BannerPatternLayers bannerpatternlayers = (BannerPatternLayers) stack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY);
if (bannerpatternlayers.layers().isEmpty()) {
@@ -312,7 +340,7 @@ public interface CauldronInteraction {
}
}
- private static InteractionResult dyedItemIteration(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) {
+ private static InteractionResult dyedItemIteration(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, final net.minecraft.core.Direction hitDirection) { // Paper - add hitDirection
if (!stack.is(ItemTags.DYEABLE)) {
return InteractionResult.TRY_WITH_EMPTY_HAND;
} else if (!stack.has(DataComponents.DYED_COLOR)) {
diff --git a/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java
index 20f2b575c8131621edea0e75fbf38a9fe20a36c4..4fdef6d7bcea0cf6b7d90324398af597660c80e3 100644
index 173fc110217307e225b4951c92ab22a1bef48dd4..e00ab1ed8088a1970249313ed63e09070fc6192d 100644
--- a/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java
@@ -58,7 +58,7 @@ public abstract class AbstractCauldronBlock extends Block {
ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit
) {
@@ -56,7 +56,7 @@ public abstract class AbstractCauldronBlock extends Block {
@Override
protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
CauldronInteraction cauldronInteraction = this.interactions.map().get(stack.getItem());
- return cauldronInteraction.interact(state, world, pos, player, hand, stack);
+ return cauldronInteraction.interact(state, world, pos, player, hand, stack, hit.getDirection()); // Paper - pass hit direction

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerInsertLecternBookEvent
diff --git a/src/main/java/net/minecraft/world/level/block/LecternBlock.java b/src/main/java/net/minecraft/world/level/block/LecternBlock.java
index ebb79907391fe3128d3d16fbe9d8cb0b22bcc9f7..3a1e2f62b297f384cc0dcfb828e523a37c703d6f 100644
index ec6ff0b192ae2f1586095519ad2472e76b2b5589..53f388dd0ba6b77fe49a584883e8c9d49d5a5fba 100644
--- a/src/main/java/net/minecraft/world/level/block/LecternBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LecternBlock.java
@@ -157,7 +157,24 @@ public class LecternBlock extends BaseEntityBlock {
@@ -158,7 +158,24 @@ public class LecternBlock extends BaseEntityBlock {
BlockEntity tileentity = world.getBlockEntity(pos);
if (tileentity instanceof LecternBlockEntity tileentitylectern) {

Datei anzeigen

@ -5,26 +5,25 @@ Subject: [PATCH] Void damage configuration API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bc45c74987974b4828201e06fc8b1f3fbc0af8b4..4b54d0ea31062972e68ee8fafe3cfaf68f65a5cd 100644
index 4f0ff0d333d2de1b4f6beac1ce25e214b971e387..2cf9490a116d70c00f00d41005b78d5b510f2162 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -931,8 +931,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -853,8 +853,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void checkBelowWorld() {
+ if (!this.level.getWorld().isVoidDamageEnabled()) return; // Paper - check if void damage is enabled on the world
+
// Paper start - Configurable nether ceiling damage
- if (this.getY() < (double) (this.level.getMinBuildHeight() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
+ if (this.getY() < (double) (this.level.getMinBuildHeight() + this.level.getWorld().getVoidDamageMinBuildHeightOffset()) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER // Paper - use configured min build height offset
- if (this.getY() < (double) (this.level.getMinY() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
+ if (this.getY() < (double) (this.level.getMinY() + this.level.getWorld().getVoidDamageMinBuildHeightOffset()) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER // Paper - use configured min build height offset
&& this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
&& (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
// Paper end - Configurable nether ceiling damage
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 30f4f1254fc295442d72d50479e8af635f2fe983..2aa6374cd4a96efd85899be8cd3172a8257bfe6b 100644
index f57c830a7286eb8cab1061c8ddebe6abab1fcced..ed624f54bbd7f9fd5a1ddc12a856f41f03571ac9 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2625,7 +2625,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2702,7 +2702,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
protected void onBelowWorld() {
@ -34,10 +33,10 @@ index 30f4f1254fc295442d72d50479e8af635f2fe983..2aa6374cd4a96efd85899be8cd3172a8
protected void updateSwingTime() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 38b046da5acac8633db8618a2957187d291f5e73..33e4818ba5a90d78d69baad9f6b1be1b1382e9f3 100644
index 36c3024c188197a777c8077704e1b64552c02d0a..38565ee35799bc8cdf3f224e0f92592a4a11300f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -163,6 +163,41 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -167,6 +167,41 @@ public class CraftWorld extends CraftRegionAccessor implements World {
private final Object2IntOpenHashMap<SpawnCategory> spawnCategoryLimit = new Object2IntOpenHashMap<>();
private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftWorld.DATA_TYPE_REGISTRY);
private net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers
@ -79,7 +78,7 @@ index 38b046da5acac8633db8618a2957187d291f5e73..33e4818ba5a90d78d69baad9f6b1be1b
// Paper start - Provide fast information methods
@Override
@@ -271,6 +306,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -275,6 +310,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
}
// Paper end - per world spawn limits

Datei anzeigen

@ -8,10 +8,10 @@ maximum level. The added API enables plugins to disable this behaviour,
allowing enchantments that are overleveled to be applied via the anvil.
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index d685511104ac552dfc9ae2111e1bfb60fa812102..362278407679f245ebcea778f2199b357339e1fe 100644
index cc5aae32f34305965847ade8b530272b1126b5c9..dc2bc53f6fa84fa09bd86450060ad9878307001c 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -53,6 +53,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -54,6 +54,7 @@ public class AnvilMenu extends ItemCombinerMenu {
public int maximumRepairCost = 40;
private CraftAnvilView bukkitEntity;
// CraftBukkit end
@ -19,7 +19,7 @@ index d685511104ac552dfc9ae2111e1bfb60fa812102..362278407679f245ebcea778f2199b35
public AnvilMenu(int syncId, Inventory inventory) {
this(syncId, inventory, ContainerLevelAccess.NULL);
@@ -231,7 +232,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -233,7 +234,7 @@ public class AnvilMenu extends ItemCombinerMenu {
flag2 = true;
} else {
flag1 = true;

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add proper async player disconnections
Blocking can cause performance problems
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 3e550f8e7cd4f4e16f499a8a2a4b95420270f07a..4a8356a714ed50d4a32bcf046a2e16491bef014b 100644
index 90a2c61c42cba7e38f167eccdd7a951a947963c4..fff8d15d44613a075b9793c2a41520212166eb3b 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -850,6 +850,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -844,6 +844,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
@ -25,10 +25,10 @@ index 3e550f8e7cd4f4e16f499a8a2a4b95420270f07a..4a8356a714ed50d4a32bcf046a2e1649
if (compressionThreshold >= 0) {
com.velocitypowered.natives.compression.VelocityCompressor compressor = com.velocitypowered.natives.util.Natives.compress.get().create(io.papermc.paper.configuration.GlobalConfiguration.get().misc.compressionLevel.or(-1)); // Paper - Use Velocity cipher
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 6998f32f8d79dbdb6b31ffaa126602fc4a428616..7174f8c89a7cdcf40ff28f6636ecfb23b13ccdaa 100644
index fc242acade3ff06c9213428cde103cf078216382..b0bc66dc7248aae691dcab68b925b52a1695e63f 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -136,11 +136,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -143,11 +143,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.latency = (this.latency * 3 + i) / 4;
this.keepAlivePending = false;
} else if (!this.isSingleplayerOwner()) {
@ -41,7 +41,7 @@ index 6998f32f8d79dbdb6b31ffaa126602fc4a428616..7174f8c89a7cdcf40ff28f6636ecfb23
}
}
@@ -404,6 +400,31 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -411,6 +407,31 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
minecraftserver.scheduleOnMain(networkmanager::handleDisconnection); // Paper
}
@ -74,19 +74,19 @@ index 6998f32f8d79dbdb6b31ffaa126602fc4a428616..7174f8c89a7cdcf40ff28f6636ecfb23
return this.server.isSingleplayerOwner(this.playerProfile());
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index befeaac4786760f6847a5945da2296a3e68dbb17..064d52d4479727c6a32bf357be8da32d1760e7fc 100644
index cae9682df8795c5f73e86c27d717b6f72e7e8592..bffbf87a546cf8b5ffc0a58d853bacd5d7759abf 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -791,7 +791,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -769,7 +769,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
if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - configurable tab spam limits
- this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause
+ this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect
return;
}
// CraftBukkit end
@@ -803,7 +803,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -781,7 +781,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start
final int index;
if (packet.getCommand().length() > 64 && ((index = packet.getCommand().indexOf(' ')) == -1 || index >= 64)) {
@ -95,7 +95,7 @@ index befeaac4786760f6847a5945da2296a3e68dbb17..064d52d4479727c6a32bf357be8da32d
return;
}
// Paper end
@@ -1190,14 +1190,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1171,14 +1171,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (byteTotal > byteAllowed) {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to send a book too large. Book size: {} - Allowed: {} - Pages: {}", this.player.getScoreboardName(), byteTotal, byteAllowed, pageList.size());
@ -112,7 +112,7 @@ index befeaac4786760f6847a5945da2296a3e68dbb17..064d52d4479727c6a32bf357be8da32d
return;
}
this.lastBookTick = MinecraftServer.currentTick;
@@ -2354,7 +2354,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2304,7 +2304,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit
if (ServerGamePacketListenerImpl.isChatMessageIllegal(s)) {
@ -121,7 +121,7 @@ index befeaac4786760f6847a5945da2296a3e68dbb17..064d52d4479727c6a32bf357be8da32d
} 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 {
@@ -2377,7 +2377,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2327,7 +2327,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (optional.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -130,16 +130,16 @@ index befeaac4786760f6847a5945da2296a3e68dbb17..064d52d4479727c6a32bf357be8da32d
}
return optional;
@@ -2550,7 +2550,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// this.chatSpamTickCount += 20;
if (counted && this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - exclude from SpigotConfig.spamExclusions
@@ -2498,7 +2498,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// this.chatSpamThrottler.increment();
if (counted && !this.chatSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - exclude from SpigotConfig.spamExclusions
// CraftBukkit end
- this.disconnect((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
+ this.disconnectAsync((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause // Paper - add proper async disconnect
}
}
@@ -2562,7 +2562,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2510,7 +2510,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());
@ -148,7 +148,7 @@ index befeaac4786760f6847a5945da2296a3e68dbb17..064d52d4479727c6a32bf357be8da32d
}
}
@@ -2710,7 +2710,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2658,7 +2658,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (i > 4096) {
@ -157,10 +157,10 @@ index befeaac4786760f6847a5945da2296a3e68dbb17..064d52d4479727c6a32bf357be8da32d
}
}
@@ -3314,7 +3314,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3267,7 +3267,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) {
if (!this.recipeSpamPackets.isIncrementAndUnderThreshold()) {
- this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
+ this.disconnectAsync(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause // Paper - add proper async disconnect
return;

Datei anzeigen

@ -9,16 +9,16 @@ flow for them, this is not all too surprising. So, we shall resort to always
sending the patterns over the network for update packets.
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
index 60c26076e7acf869fa0e20fdc14eeec341387d99..60a9f3c7f007d268f24a4fe9e87029fdbc8360f9 100644
index 98bc87fe5d153cc4927f7e1b4a02f61d9dd019a0..9528935a120f7d5a1fdb1a796854478e8a83f833 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
@@ -63,7 +63,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
@Override
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
super.saveAdditional(nbt, registryLookup);
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
super.saveAdditional(nbt, registries);
- if (!this.patterns.equals(BannerPatternLayers.EMPTY)) {
+ if (!this.patterns.equals(BannerPatternLayers.EMPTY) || serialisingForNetwork.get()) { // Paper - always send patterns to client
nbt.put("patterns", (Tag) BannerPatternLayers.CODEC.encodeStart(registryLookup.createSerializationContext(NbtOps.INSTANCE), this.patterns).getOrThrow());
nbt.put("patterns", (Tag) BannerPatternLayers.CODEC.encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), this.patterns).getOrThrow());
}
@@ -95,9 +95,18 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
@ -28,12 +28,11 @@ index 60c26076e7acf869fa0e20fdc14eeec341387d99..60a9f3c7f007d268f24a4fe9e87029fd
+ // Paper start - always send patterns to client
+ ThreadLocal<Boolean> serialisingForNetwork = ThreadLocal.withInitial(() -> Boolean.FALSE);
@Override
public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) {
- return this.saveWithoutMetadata(registryLookup);
public CompoundTag getUpdateTag(HolderLookup.Provider registries) {
+ final Boolean wasSerialisingForNetwork = serialisingForNetwork.get();
+ try {
+ serialisingForNetwork.set(Boolean.TRUE);
+ return this.saveWithoutMetadata(registryLookup);
return this.saveWithoutMetadata(registries);
+ } finally {
+ serialisingForNetwork.set(wasSerialisingForNetwork);
+ }