Archiviert
13
0
Dieser Commit ist enthalten in:
Bjarne Koll 2024-06-14 10:56:28 +02:00
Ursprung 14c03366ed
Commit a399f23903
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27F6CCCF55D2EE62
36 geänderte Dateien mit 185 neuen und 186 gelöschten Zeilen

Datei anzeigen

@ -8,10 +8,10 @@ In general, the client now has an acknowledgment system which will prevent block
It should be noted that this system does not yet support block entities, so those still need to resynced when needed.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526695e1ba7 100644
index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672fa50c585f 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -202,7 +202,7 @@ public class ServerPlayerGameMode {
@@ -204,7 +204,7 @@ public class ServerPlayerGameMode {
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
if (event.isCancelled()) {
// Let the client know the block still exists
@ -20,7 +20,7 @@ index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526
// Update any tile entity data for this block
capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
return;
@@ -217,7 +217,7 @@ public class ServerPlayerGameMode {
@@ -219,7 +219,7 @@ public class ServerPlayerGameMode {
// Spigot start - handle debug stick left click for non-creative
if (this.player.getMainHandItem().is(net.minecraft.world.item.Items.DEBUG_STICK)
&& ((net.minecraft.world.item.DebugStickItem) net.minecraft.world.item.Items.DEBUG_STICK).handleInteraction(this.player, this.level.getBlockState(pos), this.level, pos, false, this.player.getMainHandItem())) {
@ -29,7 +29,7 @@ index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526
return;
}
// Spigot end
@@ -235,15 +235,17 @@ public class ServerPlayerGameMode {
@@ -237,15 +237,17 @@ public class ServerPlayerGameMode {
// CraftBukkit start - Swings at air do *NOT* exist.
if (event.useInteractedBlock() == Event.Result.DENY) {
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
@ -54,9 +54,9 @@ index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526
+ //}
+ // Paper end - Don't resync blocks
} else if (!iblockdata.isAir()) {
iblockdata.attack(this.level, pos, this.player);
f = iblockdata.getDestroyProgress(this.player, this.player.level(), pos);
@@ -252,7 +254,7 @@ public class ServerPlayerGameMode {
EnchantmentHelper.onHitBlock(this.level, this.player.getMainHandItem(), this.player, this.player, EquipmentSlot.MAINHAND, Vec3.atCenterOf(pos), iblockdata, (item) -> {
this.player.onEquippedItemBroken(item, EquipmentSlot.MAINHAND);
@@ -257,7 +259,7 @@ public class ServerPlayerGameMode {
if (event.useItemInHand() == Event.Result.DENY) {
// If we 'insta destroyed' then the client needs to be informed.
if (f > 1.0f) {
@ -65,7 +65,7 @@ index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526
}
return;
}
@@ -260,7 +262,7 @@ public class ServerPlayerGameMode {
@@ -265,7 +267,7 @@ public class ServerPlayerGameMode {
if (blockEvent.isCancelled()) {
// Let the client know the block still exists
@ -74,7 +74,7 @@ index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526
return;
}
@@ -351,7 +353,7 @@ public class ServerPlayerGameMode {
@@ -356,7 +358,7 @@ public class ServerPlayerGameMode {
// Tell client the block is gone immediately then process events
// Don't tell the client if its a creative sword break because its not broken!
@ -83,7 +83,7 @@ index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526
ClientboundBlockUpdatePacket packet = new ClientboundBlockUpdatePacket(pos, Blocks.AIR.defaultBlockState());
this.player.connection.send(packet);
}
@@ -377,13 +379,15 @@ public class ServerPlayerGameMode {
@@ -382,13 +384,15 @@ public class ServerPlayerGameMode {
if (isSwordNoBreak) {
return false;
}
@ -103,7 +103,7 @@ index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526
// Update any tile entity data for this block
if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction
@@ -532,16 +536,18 @@ public class ServerPlayerGameMode {
@@ -537,16 +541,18 @@ public class ServerPlayerGameMode {
if (event.useInteractedBlock() == Event.Result.DENY) {
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
if (iblockdata.getBlock() instanceof DoorBlock) {
@ -127,10 +127,10 @@ index dd78a1685bd841577aa9d5010fffda1468901baf..c5f3ba82b3ded415ff4bffc9eabf9526
} else if (iblockdata.is(Blocks.JIGSAW) || iblockdata.is(Blocks.STRUCTURE_BLOCK) || iblockdata.getBlock() instanceof net.minecraft.world.level.block.CommandBlock) {
player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId));
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
index 6d494b80ae002aea00afa44adf83dad1ae5bbbc1..49557d6f22c5725c663a231deab019d4f6fe95fa 100644
index 6caed156ed0cfe0017d578f58cb963ee68272d78..321188173918d0d60858a258400dfd682ccdb21c 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -78,7 +78,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -79,7 +79,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem(), hand);
if (event.isCancelled()) {
@ -139,7 +139,7 @@ index 6d494b80ae002aea00afa44adf83dad1ae5bbbc1..49557d6f22c5725c663a231deab019d4
((ServerPlayer) user).getBukkitEntity().updateInventory(); // SPIGOT-4541
return InteractionResultHolder.fail(itemstack);
}
@@ -185,7 +185,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -187,7 +187,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
if (flag2 && entityhuman != null) {
PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand);
if (event.isCancelled()) {
@ -149,10 +149,10 @@ index 6d494b80ae002aea00afa44adf83dad1ae5bbbc1..49557d6f22c5725c663a231deab019d4
return false;
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 4485199c90e3efbce3e6a18a75703e86a9bdde3c..3f6082b656ec8c9b96b40fbd1c926d5211ffe4c6 100644
index 1f2e6f57ffb827ef9bf3623bfdde07db21edf6ee..486c3769a0e6a1ecb5530a35e2591f78776619b9 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -479,10 +479,12 @@ public final class ItemStack implements DataComponentHolder {
@@ -500,10 +500,12 @@ public final class ItemStack implements DataComponentHolder {
world.preventPoiUpdated = false;
// Brute force all possible updates

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Improve Registry
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
index a644309edb612d97da290f86a1ef6fe597c7d85d..3adf18d5e736abff701a4866ee1f8403aeafca84 100644
index f8cf246913040ea4064f8addee0ec6927eb06237..334447e222d88bb24676bb154e7057a4147d0f41 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
@@ -143,6 +143,7 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
@@ -144,6 +144,7 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
private final Class<?> bukkitClass; // Paper - relax preload class
private final Map<NamespacedKey, B> cache = new HashMap<>();
@ -16,7 +16,7 @@ index a644309edb612d97da290f86a1ef6fe597c7d85d..3adf18d5e736abff701a4866ee1f8403
private final net.minecraft.core.Registry<M> minecraftRegistry;
private final BiFunction<NamespacedKey, M, B> minecraftToBukkit;
private final BiFunction<NamespacedKey, ApiVersion, NamespacedKey> serializationUpdater; // Paper - rename to make it *clear* what it is *only* for
@@ -191,6 +192,7 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
@@ -192,6 +193,7 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
}
this.cache.put(namespacedKey, bukkit);
@ -24,7 +24,7 @@ index a644309edb612d97da290f86a1ef6fe597c7d85d..3adf18d5e736abff701a4866ee1f8403
return bukkit;
}
@@ -213,4 +215,11 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
@@ -214,4 +216,11 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
return this.minecraftToBukkit.apply(namespacedKey, minecraft);
}

Datei anzeigen

@ -26,10 +26,10 @@ index a306b30af19277386a2f3e560b4902a8b5796f2a..54851f6cc0d5fddb32a9a1e84a4f5ae4
x = to.getX();
y = to.getY();
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cb07999629ba2d56602b3ae06ef06e350a8d1fb1..b7af45eac986097ef53fa90bb4edd67f8829f13c 100644
index 73a6ceef98f94ec801c14ca6d3c33f801b2ae442..0e8888ca5f8cde764efa9e2cda8c59e9ecb3190c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4173,7 +4173,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -4200,7 +4200,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!(this instanceof ServerPlayer)) {
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level().getWorld(), d3, d4, d5), new Location(this.level().getWorld(), d0, d6, d2));
this.level().getCraftServer().getPluginManager().callEvent(teleport);
@ -38,21 +38,21 @@ index cb07999629ba2d56602b3ae06ef06e350a8d1fb1..b7af45eac986097ef53fa90bb4edd67f
Location to = teleport.getTo();
this.teleportTo(to.getX(), to.getY(), to.getZ());
} else {
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
index 8fa9282acd87132516329083f774345df3310cf2..edd29c2f4d0151d512618115a8fb4b7423171491 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
@@ -130,7 +130,7 @@ public class FollowOwnerGoal extends Goal {
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
index 39adc89b35213d5d5fb71bb4b7e0c641f77e4a06..45224dc3867892b298b006c17f7f85741fcc96d6 100644
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
@@ -299,7 +299,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
} else {
// CraftBukkit start
EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this.tamable, (double) x + 0.5D, (double) y, (double) z + 0.5D);
EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this, (double) x + 0.5D, (double) y, (double) z + 0.5D);
- if (event.isCancelled()) {
+ if (event.isCancelled() || event.getTo() == null) { // Paper
+ if (event.isCancelled() || event.getTo() == null) { // Paper - prevent NP on null event to location
return false;
}
Location to = event.getTo();
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
index c2005b86ac9ff6aa03ef7937c2b7a228addc4f01..bd6171d75fbf4a0debef3892d6f67356dc811b4d 100644
index 632b74e84d6ee58da8806e30b75e16fb864afa64..bf58956379d0a5dbfdc34e8626847638b4111433 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
@@ -415,7 +415,7 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add experience points API
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 77624e34143dc37ca3b523a81b9a041ffb3199bd..32f6c029bf2f9a16d48ac73ff217c7462c64f175 100644
index 9706b0df7d0c617a181ba9f78b010e2e58c84454..a77c2847a3bc161f0bf25eb4c78305ce18afd904 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1855,7 +1855,7 @@ public abstract class Player extends LivingEntity {
@@ -1870,7 +1870,7 @@ public abstract class Player extends LivingEntity {
}
public int getXpNeededForNextLevel() {
@ -18,10 +18,10 @@ index 77624e34143dc37ca3b523a81b9a041ffb3199bd..32f6c029bf2f9a16d48ac73ff217c746
// Paper start - send while respecting visibility
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e9bd24861bca4554898306117bb533d19171cedf..68a0b6b8650e9e80e8e8c4037d92389cae899d72 100644
index 0865e088357757a253f73b492b43b6075b237e4f..35ff3eae4f68fd1fe9bacbeacfd826a5022f8899 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1902,6 +1902,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1915,6 +1915,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Preconditions.checkArgument(exp >= 0, "Total experience points must not be negative (%s)", exp);
this.getHandle().totalExperience = exp;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add drops to shear events
diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
index fbed5d57db0c0e79996f85571b9af0071fa953c7..a024c697a65bbab27408da1d6a75e531d9719b47 100644
index f32f8d5cb22feb885a53d3b56c04ad4219d2bafa..44b79a7c2f8b95a484d1999fa2167ce588f7985b 100644
--- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
@@ -104,11 +104,14 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
@@ -103,11 +103,14 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
if (entityliving instanceof Shearable ishearable) {
if (ishearable.readyForShearing()) {
// CraftBukkit start
@ -116,10 +116,10 @@ index aa125e3043b120935aaa015803f065f99eb8d050..0c21959f57ae88fcd0a4d6dc911c1ce3
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
index 784a89f39e0b243e2968dca33b60ae40e58d824e..3ce86f952a18cae7fda1903916903b31a63a40b4 100644
index 6b26af41423110bd982eb8c0eea0cba5e9fdc633..38ac2759894660be1ee7ba59b0bd1270158e9232 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
@@ -258,11 +258,18 @@ public class Sheep extends Animal implements Shearable {
@@ -256,11 +256,18 @@ public class Sheep extends Animal implements Shearable {
if (itemstack.is(Items.SHEARS)) {
if (!this.level().isClientSide && this.readyForShearing()) {
// CraftBukkit start
@ -141,7 +141,7 @@ index 784a89f39e0b243e2968dca33b60ae40e58d824e..3ce86f952a18cae7fda1903916903b31
this.gameEvent(GameEvent.SHEAR, player);
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
return InteractionResult.SUCCESS;
@@ -276,13 +283,30 @@ public class Sheep extends Animal implements Shearable {
@@ -274,13 +281,30 @@ public class Sheep extends Animal implements Shearable {
@Override
public void shear(SoundSource shearedSoundCategory) {
@ -233,7 +233,7 @@ index 2de1a2f666da9db1832907e1651dbff948e37252..5c2ed3c39c8eb850f3be1e2ea5b5a7ea
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
index 9c0bfddd479eef688d2509ad700371c3c860ff1a..e9f9b041ae7195e9d23bd446454b1d8c47a1ace1 100644
index 8420d75865b86e1d8afea2527b5521cac184e8b1..6e290d67b00c88ecd2cf2ce5f612f52ebda9e280 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
@@ -135,6 +135,15 @@ public class Bogged extends AbstractSkeleton implements Shearable {
@ -243,20 +243,20 @@ index 9c0bfddd479eef688d2509ad700371c3c860ff1a..e9f9b041ae7195e9d23bd446454b1d8c
+ // Paper start - shear drops API
+ this.generateShearedMushrooms(stack -> {
+ this.forceDrops = true;
+ this.spawnAtLocation(stack);
+ this.spawnAtLocation(stack, this.getBbHeight());
+ this.forceDrops = false;
+ });
+ }
+ private void generateShearedMushrooms(java.util.function.Consumer<ItemStack> stackConsumer) {
+ // Paper end - shear drops API
if (this.level() instanceof ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
if (this.level() instanceof ServerLevel serverLevel) {
LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.BOGGED_SHEAR);
LootParams lootParams = new LootParams.Builder(serverLevel)
@@ -143,11 +152,20 @@ public class Bogged extends AbstractSkeleton implements Shearable {
.create(LootContextParamSets.SHEARING);
for (ItemStack itemStack : lootTable.getRandomItems(lootParams)) {
- this.spawnAtLocation(itemStack);
- this.spawnAtLocation(itemStack, this.getBbHeight());
+ stackConsumer.accept(itemStack); // Paper
}
}
@ -275,10 +275,10 @@ index 9c0bfddd479eef688d2509ad700371c3c860ff1a..e9f9b041ae7195e9d23bd446454b1d8c
public boolean readyForShearing() {
return !this.isSheared() && this.isAlive();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 8b322ade83e8e571af7c2e91a3c0d0784a7b9fad..e20feab675d05ae5b5b19870546585936c757970 100644
index 54c9c19d773df01b0004da6587f7c7a388e61c21..a4ea5d942eb61ee733eb1b8b4a3c50fb93f037ea 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1666,20 +1666,20 @@ public class CraftEventFactory {
@@ -1667,20 +1667,20 @@ public class CraftEventFactory {
player.level().getCraftServer().getPluginManager().callEvent(event);
}
@ -306,7 +306,7 @@ index 8b322ade83e8e571af7c2e91a3c0d0784a7b9fad..e20feab675d05ae5b5b1987054658593
public static Cancellable handleStatisticsIncrease(net.minecraft.world.entity.player.Player entityHuman, net.minecraft.stats.Stat<?> statistic, int current, int newValue) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 776437ae42865baccab4fb5d3f2715c8f0519b8a..520b637e0f281d3d3018681ec7b48b06c47f621e 100644
index 0774711e3797c10526c65b7e5824a739c04597e7..94adc5c827c69f3cca08404faf0764ae91a9d1df 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -65,6 +65,16 @@ public final class CraftItemStack extends ItemStack {

Datei anzeigen

@ -16,10 +16,10 @@ sideeffects, meaning the disable event cannot share a handlerlist with
the cooldown event
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 32f6c029bf2f9a16d48ac73ff217c7462c64f175..9952da86af1a1a050e7485675ca2d6fb83d02422 100644
index a77c2847a3bc161f0bf25eb4c78305ce18afd904..ffb888262ba81073062f6f513c36108688d0f158 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -989,7 +989,7 @@ public abstract class Player extends LivingEntity {
@@ -1004,7 +1004,7 @@ public abstract class Player extends LivingEntity {
protected void blockUsingShield(LivingEntity attacker) {
super.blockUsingShield(attacker);
if (attacker.canDisableShield()) {
@ -28,7 +28,7 @@ index 32f6c029bf2f9a16d48ac73ff217c7462c64f175..9952da86af1a1a050e7485675ca2d6fb
}
}
@@ -1473,8 +1473,21 @@ public abstract class Player extends LivingEntity {
@@ -1499,8 +1499,21 @@ public abstract class Player extends LivingEntity {
this.attack(target);
}

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Validate ResourceLocation in NBT reading
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 1d7c20fe14882fdeddf315a8923669e3385652f5..f88dd37783b3c155c23b547c360b8d3c16e030c0 100644
index 4929bac8e476664086470f078efce6c0a6164413..f88dd37783b3c155c23b547c360b8d3c16e030c0 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -149,8 +149,10 @@ public final class NbtUtils {
if (!nbt.contains("Name", 8)) {
return Blocks.AIR.defaultBlockState();
} else {
- ResourceLocation resourceLocation = new ResourceLocation(nbt.getString("Name"));
- ResourceLocation resourceLocation = ResourceLocation.parse(nbt.getString("Name"));
- Optional<? extends Holder<Block>> optional = blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation));
+ // Paper start - Validate resource location
+ ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name"));
@ -22,13 +22,13 @@ index 1d7c20fe14882fdeddf315a8923669e3385652f5..f88dd37783b3c155c23b547c360b8d3c
return Blocks.AIR.defaultBlockState();
} else {
diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java
index d93b623ce973b63d4f3a77bfe459f51af7cb3c1c..2c4553312f2f37f8613ac813708b4b95f9675e9f 100644
index 87afe84791af2d5e9f869cd4c09eed4bb5fee75b..1967c43ee3a12e63365cc40ee6565307e2fd73cf 100644
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
@@ -37,6 +37,13 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
private final String path;
@@ -41,6 +41,13 @@ public final class ResourceLocation implements Comparable<ResourceLocation> {
assert isValidPath(path);
protected ResourceLocation(String namespace, String path, @Nullable ResourceLocation.Dummy extraData) {
+ // Paper start - Validate ResourceLocation
+ // Check for the max network string length (capped at Short.MAX_VALUE) as well as the max bytes of a StringTag (length written as an unsigned short)
+ final String resourceLocation = namespace + ":" + path;
@ -40,40 +40,39 @@ index d93b623ce973b63d4f3a77bfe459f51af7cb3c1c..2c4553312f2f37f8613ac813708b4b95
this.path = path;
}
diff --git a/src/main/java/net/minecraft/world/RandomizableContainer.java b/src/main/java/net/minecraft/world/RandomizableContainer.java
index 68fadc351464dde459eb4cc86660cf9add40d04e..a9a80f8bc4a6f250fe3c20482c395058f024fabd 100644
index 597cd5dbb4bb415a9b4d874c1c5dd621be1d6fc8..a9a80f8bc4a6f250fe3c20482c395058f024fabd 100644
--- a/src/main/java/net/minecraft/world/RandomizableContainer.java
+++ b/src/main/java/net/minecraft/world/RandomizableContainer.java
@@ -50,7 +50,7 @@ public interface RandomizableContainer extends Container {
default boolean tryLoadLootTable(CompoundTag nbt) {
if (nbt.contains("LootTable", 8)) {
- this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable"))));
- this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable"))));
+ this.setLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation
if (this.lootableData() != null && this.getLootTable() != null) this.lootableData().loadNbt(nbt); // Paper - LootTable API
if (nbt.contains("LootTableSeed", 4)) {
this.setLootTableSeed(nbt.getLong("LootTableSeed"));
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 8c7cc9c5af0b8d8bef9b6e2d3d3e723cd76f3212..56b51096ca4147363a843accf6ef2510f05e8f1a 100644
index b98f9246b60daf31460f41ce214dfa7c011f5684..842b0cec0397d7ae5166617627340ffac0e35db1 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -623,7 +623,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
}
public static Optional<EntityType<?>> by(CompoundTag nbt) {
- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id")));
- return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.parse(nbt.getString("id")));
+ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id"))); // Paper - Validate ResourceLocation
}
@Nullable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index b7af45eac986097ef53fa90bb4edd67f8829f13c..958b25e62b040943c346114ef19d56104ae0a844 100644
index 0e8888ca5f8cde764efa9e2cda8c59e9ecb3190c..d535bb7adff273c9d4cdaac73f7dfe5bbd663c15 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -911,12 +911,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -886,11 +886,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (nbt.contains("SleepingX", 99) && nbt.contains("SleepingY", 99) && nbt.contains("SleepingZ", 99)) {
BlockPos blockposition = new BlockPos(nbt.getInt("SleepingX"), nbt.getInt("SleepingY"), nbt.getInt("SleepingZ"));
-
+ if (this.position().distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 16 * 16) { // Paper - The sleeping pos will always also set the actual pos, so a desync suggests something is wrong
this.setSleepingPos(blockposition);
this.entityData.set(LivingEntity.DATA_POSE, Pose.SLEEPING);
@ -85,53 +84,53 @@ index b7af45eac986097ef53fa90bb4edd67f8829f13c..958b25e62b040943c346114ef19d5610
if (nbt.contains("Brain", 10)) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 5581fd6656fc13ea1d036d6caab2aba39c5320ac..748a6d81f409cf91a7aa2c88ded04f1d428cf0f6 100644
index 56873752ae1ae0d2a36cb171d2de6884e15c01a5..5bac748649f43d74b13e7c0b4d355e67654ad59e 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -645,7 +645,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
@@ -605,7 +605,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
this.leashData = this.readLeashData(nbt);
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
if (nbt.contains("DeathLootTable", 8)) {
- this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("DeathLootTable")));
- this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("DeathLootTable")));
+ this.lootTable = net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("DeathLootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl)); // Paper - Validate ResourceLocation
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index f1bf129aecb6840d79c537338e4057557f07790b..5bc4ba7c055992a32197db96d86a3906c11900d8 100644
index dfa44899529a7a9c32fe17fcb2091eab7d790f5a..56729d5c5f0cd383b22c127ebbb394c30bf95aa7 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -561,7 +561,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -642,7 +642,7 @@ public abstract class AbstractArrow extends Projectile {
this.setCritArrow(nbt.getBoolean("crit"));
this.setPierceLevel(nbt.getByte("PierceLevel"));
if (nbt.contains("SoundEvent", 8)) {
- this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(new ResourceLocation(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent());
- this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(ResourceLocation.parse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent());
+ this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(ResourceLocation.tryParse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); // Paper - Validate resource location
}
this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow"));
if (nbt.contains("item", 10)) {
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
index d976a6e3a79a01392a5033b05864d82782a30916..845eff7401b811c179dc9dee70eca0d724be5c80 100644
index ccc7367ab2740bea0f2b907223a0920b11665092..845eff7401b811c179dc9dee70eca0d724be5c80 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
@@ -73,7 +73,7 @@ public interface ContainerEntity extends Container, MenuProvider {
default void readChestVehicleSaveData(CompoundTag nbt, HolderLookup.Provider registriesLookup) {
this.clearItemStacks();
if (nbt.contains("LootTable", 8)) {
- this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable"))));
- this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable"))));
+ this.setLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation
// Paper start - LootTable API
if (this.getLootTable() != null) {
this.lootableData().loadNbt(nbt);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index f40b2582d9087f9dbb5cab950304698f33fdd879..a99fe191c429bb528209dd0f31b509acf9cccbb5 100644
index 86667e93a86d84aabd05aa40a0a37a454ce7d290..2ebaf72d795b1d2f1f1ecebb2dae21a035f60d90 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -295,7 +295,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
while (iterator.hasNext()) {
String s = (String) iterator.next();
- this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
- this.recipesUsed.put(ResourceLocation.parse(s), nbttagcompound1.getInt(s));
+ // Paper start - Validate ResourceLocation
+ final ResourceLocation resourceLocation = ResourceLocation.tryParse(s);
+ if (resourceLocation != null) {
@ -142,14 +141,14 @@ index f40b2582d9087f9dbb5cab950304698f33fdd879..a99fe191c429bb528209dd0f31b509ac
// Paper start - cook speed multiplier API
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
index f78a9698afc87408fc46de2d3d00c923500885f4..dc02a3d84b397f634f77f4df9c06e245cc4dcb75 100644
index 32de29c385c784ab87e29b2e072f3992386cd775..dc02a3d84b397f634f77f4df9c06e245cc4dcb75 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
@@ -202,7 +202,7 @@ public class BrushableBlockEntity extends BlockEntity {
private boolean tryLoadLootTable(CompoundTag nbt) {
if (nbt.contains("LootTable", 8)) {
- this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable")));
- this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable")));
+ this.lootTable = net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl)); // Paper - Validate ResourceLocation
this.lootTableSeed = nbt.getLong("LootTableSeed");
return true;

Datei anzeigen

@ -7,10 +7,10 @@ This causes spawnAfterBreak to spawn xp by default, removing the need to manuall
For classes that use custom xp amounts, they can drop the resources with disabling
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 2f018922fb12dc4c3c9c28c7b0597a2b97d1cb02..51c4877ffb77ece41e90d9c6ac06c04dc941e35c 100644
index ffaf6e65a7314479a129fed41f58bf2d75ea5dae..16478e2b2368636394cec8a9b30c6fb03e190851 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -618,7 +618,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -619,7 +619,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (drop) {
BlockEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(pos) : null;
@ -21,10 +21,10 @@ index 2f018922fb12dc4c3c9c28c7b0597a2b97d1cb02..51c4877ffb77ece41e90d9c6ac06c04d
boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth);
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index a757a45d423e1729c9374391df4186ae0522e1ac..7f0c0ca49e7575c18935b71e3180d112440289f7 100644
index c083dc8b2a69c3747b250d13f1a28ad22b5e6119..bf52c36f31992a01a7403d8c85151327c9e944c4 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -313,23 +313,31 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -312,23 +312,31 @@ public class Block extends BlockBehaviour implements ItemLike {
for (ItemStack drop : Block.getDrops(state, serverLevel, pos, blockEntity)) {
items.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(drop));
}
@ -58,7 +58,7 @@ index a757a45d423e1729c9374391df4186ae0522e1ac..7f0c0ca49e7575c18935b71e3180d112
}
}
@@ -413,7 +421,7 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -412,7 +420,7 @@ public class Block extends BlockBehaviour implements ItemLike {
player.awardStat(Stats.BLOCK_MINED.get(this));
player.causeFoodExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED); // CraftBukkit - EntityExhaustionEvent
if (includeDrops) { // Paper - fix drops not preventing stats/food exhaustion
@ -68,10 +68,10 @@ index a757a45d423e1729c9374391df4186ae0522e1ac..7f0c0ca49e7575c18935b71e3180d112
}
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index c762a006b3f586b32209c20e85f6b8bf169dbd06..f87d9cb38caf3bf92fd32f2118f76799ede418db 100644
index d261649aa1b7b351f325f9b752bb792f952f7b25..936b56c116de63b38a416d5bab4223a88d0469d0 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -1118,6 +1118,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -1124,6 +1124,7 @@ public abstract class BlockBehaviour implements FeatureElement {
public void spawnAfterBreak(ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {
this.getBlock().spawnAfterBreak(this.asState(), world, pos, tool, dropExperience);

Datei anzeigen

@ -39,7 +39,7 @@ index 4f3f6ea43030853bd9df067358a1f4d16c40e6d4..531336c44c46555fef8c001fe8ca00c9
player.containerMenu.sendAllDataToRemote();
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
index 209c6b64e79c29ea3bb84ddbe89a8bff66f81d0f..1f90f4b3f310b8cf5750c3a581be178f19b979d2 100644
index e34deaf398dc6722c3128bdd6b9bc16da2d33bf7..f028daa4f23a1f1868c9922991259739cadc5da2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
@@ -38,7 +38,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
@ -52,10 +52,10 @@ index 209c6b64e79c29ea3bb84ddbe89a8bff66f81d0f..1f90f4b3f310b8cf5750c3a581be178f
public static NamespacedKey minecraftToBukkitKey(ResourceKey<LootTable> minecraft) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
index 3adf18d5e736abff701a4866ee1f8403aeafca84..4a5778d1751b774c825bbce0e870e2998278afe3 100644
index 334447e222d88bb24676bb154e7057a4147d0f41..d21b7e39d71c785f47f790e1ad4be33a8e8e6e51 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
@@ -110,6 +110,16 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
@@ -111,6 +111,16 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
+ ", this can happen if a plugin creates its own registry entry with out properly registering it.");
}
@ -156,7 +156,7 @@ index 82a50b06c08b632f77d73745e1fa9bd22dfd950a..f1d8ed4a2b8959873b02d57f6a40323a
// Now also convert from when keys where saved
return CraftRegistry.get(Registry.POTION, key, ApiVersion.CURRENT);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java
index 5f40d240b879e3989897b6e45725a8e5a6a7f194..5014192edb9616ce725fc1592832034789527b6f 100644
index dc88ba24ed3b0024c39a30c2d90628fc708d63cf..944bed9b6c803df1a312383fed9de7d61e7d2c70 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java
@@ -13,7 +13,7 @@ public final class CraftNamespacedKey {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker
diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
index a3d247c93ac1a2d872ff0e3841efc3d7b84fcbc1..23fe7c4c1844d321efed6b7b886c422761ad6594 100644
index a043ac10834562d357ef0b5aded2e916e2a0d056..74276c368016fcc4dbf9579b2ecbadc9614baf15 100644
--- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
+++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
@@ -5,7 +5,7 @@ import org.jetbrains.annotations.VisibleForTesting;
@ -18,10 +18,10 @@ index a3d247c93ac1a2d872ff0e3841efc3d7b84fcbc1..23fe7c4c1844d321efed6b7b886c4227
@VisibleForTesting
static long encode(double value) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 027f2734b0ff226437f4c94430215929b6ea2219..35f627c58e93c03ee58b44877398432bba57dc2d 100644
index cf4517e57169856acd0782e5ced4eb8c045b8d78..6129720c9da217745fcd281186de7894597c267c 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1748,10 +1748,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1587,10 +1587,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) {
@ -39,10 +39,10 @@ index 027f2734b0ff226437f4c94430215929b6ea2219..35f627c58e93c03ee58b44877398432b
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
// Paper start - Configurable entity tracking range by Y
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 0373b2de2b992b648f346d6df3960a3586a54567..22eec853588ded2d255ab69d408f8e987832abe2 100644
index a2fbbbd7a66d4e7b1063638f8467e8887a417282..0e7ace92522fbd4cef7b2c2b8a0f8b86c2cce192 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -164,7 +164,13 @@ public class ServerEntity {
@@ -163,7 +163,13 @@ public class ServerEntity {
i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F);
j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F);
Vec3 vec3d = this.entity.trackingPosition();
@ -56,4 +56,4 @@ index 0373b2de2b992b648f346d6df3960a3586a54567..22eec853588ded2d255ab69d408f8e98
+ // Paper end - reduce allocation of Vec3D here
Packet<?> packet1 = null;
boolean flag2 = flag1 || this.tickCount % 60 == 0;
boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;
boolean flag3 = Math.abs(i - this.lastSentYRot) >= 1 || Math.abs(j - this.lastSentXRot) >= 1;

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerTradeEvent and PlayerPurchaseEvent
Co-authored-by: Alexander <protonull@protonmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 6e29b5729b8184d13065c9c4e18f6e450c9d88a6..d323cf157f2a910916baa9ce3f7e5bc81648c47d 100644
index 6139361c0e733f981506abdd7101e5ca20eeb88f..49b35fab8ee98a384ee12d36bbe2ac813342f1d6 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -139,11 +139,24 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
@@ -143,11 +143,24 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
@Override
public void overrideXp(int experience) {}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add ShulkerDuplicateEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
index bd6171d75fbf4a0debef3892d6f67356dc811b4d..e03119f88719c8d6d44793a6b3706ae97b2da307 100644
index bf58956379d0a5dbfdc34e8626847638b4111433..920c7a92643e83598f39bf984cca430d9deed2cd 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
@@ -491,6 +491,11 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add api for spawn egg texture colors
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b5abf9c7e5e09c670ae2435c23587e0482fbe917..b485a14a11f468e16d1da672f981e678c7a1522e 100644
index 17caf21e23aa7f5a5216923e73aae94a59bcac44..3e74e449e5674be3a84168d24f58b108ac334513 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -654,6 +654,15 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -707,10 +707,10 @@ index 2e96308696e131f3f013469a395e5ddda2c5d529..65a66e484c1c39c5f41d97db52f31c67
} catch (Throwable e) {
LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index cce628673b6173f17ac81bce5469a7dbd8a2c648..fd4417e2863fb028a1b22b4f5c00d585dd127ad1 100644
index 4aa8c742411fe9ae1312f3663859eb107fcf68ef..6509b1026980abce194c2703dc2c6243fd5d37b4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1035,6 +1035,11 @@ public final class CraftServer implements Server {
@@ -1038,6 +1038,11 @@ public final class CraftServer implements Server {
@Override
public void reload() {
@ -739,7 +739,7 @@ index d96399e9bf1a58db5a4a22e58abb99e7660e0694..66bdac50130f523f9dc4379b103b7a46
+ // Paper end - lifecycle events
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b485a14a11f468e16d1da672f981e678c7a1522e..5143b8f81ce31e5d88f5de6b2856c3b7e3676048 100644
index 3e74e449e5674be3a84168d24f58b108ac334513..dabda356cdd4928c306feaace5bf03924b310613 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -663,6 +663,13 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack Tooltip API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 5143b8f81ce31e5d88f5de6b2856c3b7e3676048..f6c33a9e2900890e4f6cb19784e01ff438cce83d 100644
index dabda356cdd4928c306feaace5bf03924b310613..be56e7a7607d3119e560f38e800ad4bbfe1e7714 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -639,6 +639,21 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add getChunkSnapshot includeLightData parameter
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index f8c2d91958d6e4a1452fcf32c16fa8b97ea271a2..36a611d06131be00197c915871b8323544bb4972 100644
index d6eab2a0fdbafc35efa7ed5b404357391565f4f3..69c7fe5bf5b914276a9f7a0e57ce668e569d91f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -328,12 +328,21 @@ public class CraftChunk implements Chunk {

Datei anzeigen

@ -173,10 +173,10 @@ index 0000000000000000000000000000000000000000..c0c2805cb045cdd835b402776a6923fe
+
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 5cdc44c73b536f2ed2dcd49dbeccf0f69f614dba..ef1bfab74e93f48c621e7b4a3a54f59b84bdd064 100644
index a14d3e6c43b94c543790571b13808713444a239f..284234fcdd15c4c7a4567c7c887d47bf0b7967f4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -107,6 +107,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
@@ -108,6 +108,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
return CraftBlock.at(this.getHandle(), new BlockPos(x, y, z)).getState();
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] improve BanList types
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index fd4417e2863fb028a1b22b4f5c00d585dd127ad1..16a736e8327450712630b1659b156da879a57352 100644
index 6509b1026980abce194c2703dc2c6243fd5d37b4..3374795786ff6a50e56678a1b3b5098812936439 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2242,6 +2242,21 @@ public final class CraftServer implements Server {
@@ -2245,6 +2245,21 @@ public final class CraftServer implements Server {
};
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockBreakProgressUpdateEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 39cf7ae086108d8077121829368b81605d046fab..4616672c4be74421e2acbc9df96f7c8ff2782e55 100644
index 53fdf4e104f36a2bd88fdf26d8c68cd3daf61574..10063efb983dcef6dd0a9d55ecff49c26371bbb1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1322,6 +1322,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1320,6 +1320,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (entity instanceof Player) entityhuman = (Player) entity;
// CraftBukkit end

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Deprecate ItemStack#setType
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 520b637e0f281d3d3018681ec7b48b06c47f621e..7249ff939dfa786395595f687338315b779e0931 100644
index 94adc5c827c69f3cca08404faf0764ae91a9d1df..f6e84cccb0e805f73efe2c9625986c94099bb0d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -711,4 +711,24 @@ public final class CraftItemStack extends ItemStack {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add CartographyItemEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e13097ceba283fdf165d7e6327fe78590252fe94..bead9625a04a9c1139c54d6a56f055b80eb2d701 100644
index 9e57d0b1222b7dd4b9dd1d9f82b4c2f7fc7bcc3c..42d3bbfc39444e2a26adb0c72e5895acba0a45ed 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3092,6 +3092,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3109,6 +3109,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] More Raid API
public net.minecraft.world.entity.raid.Raid raidEvent
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
index 364d233ca318bbf8c1bc3acfbaf2d2420fdf922f..fdff9788eaf663be79214b2ca491f0f0444f6136 100644
index fe2a01ae8207c97203d331bbab51699502b977e2..dcbef04bbaab988096bf416163264833e84d1967 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
@@ -110,6 +110,11 @@ public class Raid {
@@ -107,6 +107,11 @@ public class Raid {
private Raid.RaidStatus status;
private int celebrationTicks;
private Optional<BlockPos> waveSpawnPos;
@ -22,7 +22,7 @@ index 364d233ca318bbf8c1bc3acfbaf2d2420fdf922f..fdff9788eaf663be79214b2ca491f0f0
public Raid(int id, ServerLevel world, BlockPos pos) {
this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10);
@@ -153,6 +158,11 @@ public class Raid {
@@ -150,6 +155,11 @@ public class Raid {
this.heroesOfTheVillage.add(NbtUtils.loadUUID(nbtbase));
}
}
@ -34,7 +34,7 @@ index 364d233ca318bbf8c1bc3acfbaf2d2420fdf922f..fdff9788eaf663be79214b2ca491f0f0
}
@@ -870,6 +880,11 @@ public class Raid {
@@ -867,6 +877,11 @@ public class Raid {
}
nbt.put("HeroesOfTheVillage", nbttaglist);
@ -86,7 +86,7 @@ index b8ce1c1c2447f9cff1717bfcfd6eb911ade0d4b3..51f21af9d75769abdcba713b9aa33392
+ // Paper end - more Raid API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 2536a37ab9e5a7aa7373b1880f55cdb8c32a6f53..44ed6bd76fb9e81f6c0d99fe46173685dbbfe2a7 100644
index cb0f59def0d5ad6e2f80ebe024f12efad9a8d164..951130f8d530b84c96fb8df15122fc570cfe2a47 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2398,6 +2398,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -29,10 +29,10 @@ index ab5089781b8866cd6ad1b9570634ba84d936cfe7..4de88f74182bb596c6b5ad0351cc0dac
return instance;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2a92268dfc8ee264e4ee6ffc56b40a87e334acc8..1a9e323659dcff12ce53919eb3d6d6f66f835292 100644
index b7254c342501f2d7fbbe8959a6e88a5d1f6e076e..837fc12dfc57f36f06bd8e49681bb4b98a87397c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1129,6 +1129,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1136,6 +1136,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long tickSection = Util.getNanos();
long currentTime;
// Paper end - further improve server tick loop

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block/fluid ticks
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4616672c4be74421e2acbc9df96f7c8ff2782e55..3a1ecdaebfd64f4703eafc92b5895e1dbddd8ee6 100644
index 10063efb983dcef6dd0a9d55ecff49c26371bbb1..4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -500,9 +500,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -501,9 +501,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!this.isDebug() && flag) {
j = this.getGameTime();
gameprofilerfiller.push("blockTicks");

Datei anzeigen

@ -5,15 +5,15 @@ Subject: [PATCH] Disable memory reserve allocating
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index 06c514b2d0674cd7df6692981f020437ea0f2f91..bcb6a3b3cd17ce5db9aaf6bd3ec7a0ec1b44b979 100644
index 268310642181a715815d3b2d1c0f090e6252971a..589a8bf75be6ccc59f1e5dd5d8d9afed41c4772d 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -250,7 +250,7 @@ public class CrashReport {
@@ -253,7 +253,7 @@ public class CrashReport {
}
public static void preload() {
- MemoryReserve.allocate();
+ // MemoryReserve.allocate(); // Paper - Disable memory reserve allocating
(new CrashReport("Don't panic!", new Throwable())).getFriendlyReport();
(new CrashReport("Don't panic!", new Throwable())).getFriendlyReport(ReportType.CRASH);
}
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fire EntityDamageByEntityEvent for unowned wither skulls
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
index 729aa0125479ab839792a3f35c981046899421b5..02931861de955352e71d6f5ffc720a17304815fe 100644
index 315610e95c91a0db096bf572789a40e746e72ebe..60eac9df10a9a395a1568925515d010eb51a64e5 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
@@ -72,7 +72,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
@@ -77,7 +77,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
}
}
} else {
@ -16,4 +16,4 @@ index 729aa0125479ab839792a3f35c981046899421b5..02931861de955352e71d6f5ffc720a17
+ flag = entity.hurt(this.damageSources().magic().customCausingEntity(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls
}
if (flag && entity instanceof LivingEntity) {
if (flag && entity instanceof LivingEntity entityliving) {

Datei anzeigen

@ -7,7 +7,7 @@ Uses the correct entity in the EntityDamageByEntity event
Returns the correct entity for API's DamageSource#getCausingEntity
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 533ea6cbb813c8d1dc2bb3f65fd94d4fa5dd591e..dd9638bdb228a53e72820e0e7cf6fe6fcc08fe4b 100644
index 10bee9b217fae9170af9d66dac9741046be1cab6..bb1a60180e58c1333e7bb33e8acf1b0225eda8a8 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -29,7 +29,8 @@ public class DamageSource {
@ -49,10 +49,10 @@ index 533ea6cbb813c8d1dc2bb3f65fd94d4fa5dd591e..dd9638bdb228a53e72820e0e7cf6fe6f
}
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
index abda6094e02ebd2589ba0e4760e574fcf44dc8e4..5ec8cbd07a1830876f58e1fd33de6df4466d7e95 100644
index caf1d79e2bbdd257a5439e2973653747e678805f..e34584e4780f343d6c946af5377088d53818e88e 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
@@ -258,13 +258,7 @@ public class DamageSources {
@@ -264,13 +264,7 @@ public class DamageSources {
}
public DamageSource explosion(@Nullable Entity source, @Nullable Entity attacker) {
@ -68,10 +68,10 @@ index abda6094e02ebd2589ba0e4760e574fcf44dc8e4..5ec8cbd07a1830876f58e1fd33de6df4
public DamageSource sonicBoom(Entity attacker) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d6ec2fe1a4a004a2d2f7d6e5bfd8fd45b27ebb7a..62363c09111aaa31220fb260940744c097af7b3c 100644
index 44c56b4e48d4d884db4bfed04d1b0f3fc64dc475..e91cf76a00f12581c8d14681188220f75fd6355b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3200,7 +3200,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3274,7 +3274,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return;
}
@ -81,7 +81,7 @@ index d6ec2fe1a4a004a2d2f7d6e5bfd8fd45b27ebb7a..62363c09111aaa31220fb260940744c0
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index b4d68a08ec1e4ec7bcc123bcb6c2dc90272430cf..ffffa53fcaa6ec8681b283fa20bb5a3320ad9c11 100644
index 2e5ef2a680e294b49f29e8d7ba8bd0ed023c393c..4bfa947531c4a67989e18032754dabf4c69e989c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -334,7 +334,7 @@ public class Turtle extends Animal {
@ -93,21 +93,21 @@ index b4d68a08ec1e4ec7bcc123bcb6c2dc90272430cf..ffffa53fcaa6ec8681b283fa20bb5a33
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 0ffff5329fa2c7833f9ec71528cb7f951cf78109..bf2d91bbb4bf401696f5f5d14a67e3920a179084 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -203,7 +203,7 @@ public abstract class HangingEntity extends Entity {
diff --git a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
index 7bc612890f941177da11da0ce047d5a74d8ebb33..270acce7411e5ada71eaa04c05efc888b295d9e3 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
@@ -96,7 +96,7 @@ public abstract class BlockAttachedEntity extends Entity {
} else {
if (!this.isRemoved() && !this.level().isClientSide) {
// CraftBukkit start - fire break events
- Entity damager = (source.isIndirect()) ? source.getEntity() : source.getDirectEntity();
+ Entity damager = (source.isIndirect() && source.getEntity() != null) ? source.getEntity() : source.getDirectEntity(); // Paper - fix DamageSource API
- Entity damager = (source.isDirect()) ? source.getDirectEntity() : source.getEntity();
+ Entity damager = (!source.isDirect() && source.getEntity() != null) ? source.getEntity() : source.getDirectEntity(); // Paper - fix DamageSource API
HangingBreakEvent event;
if (damager != null) {
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), source.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index 7db5de71b0353d9807978c0351870fd99b76ee67..0ae4ba060b2ce2c79e1235c939f3c1926eb6e33e 100644
index b3dd475b1c6cd10f89760e59cbba219df19948b6..cb1b19e2e0d8f0744b2355b8f4da0206b196b19c 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -271,7 +271,7 @@ public class Creeper extends Monster implements PowerableMob {
@ -116,14 +116,14 @@ index 7db5de71b0353d9807978c0351870fd99b76ee67..0ae4ba060b2ce2c79e1235c939f3c192
this.dead = true;
- this.level().explode(this, this.level().damageSources().explosion(this, this.entityIgniter, net.minecraft.world.damagesource.DamageTypes.EXPLOSION), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
+ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
this.spawnLingeringCloud();
// CraftBukkit start
this.triggerOnDeathMobEffects(Entity.RemovalReason.KILLED);
this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
index edc5cfd3f3eab176df9080cf932dac3905f1b26d..f8aa723f18e28b02d4b7055404922ff8d7a73f8d 100644
index c75433bb0fcd4264148950467bf6b700296aca7b..820965950c8b6c868ee261cf9613665e583f092e 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
@@ -133,7 +133,7 @@ public class EvokerFangs extends Entity implements TraceableEntity {
@@ -135,7 +135,7 @@ public class EvokerFangs extends Entity implements TraceableEntity {
if (target.isAlive() && !target.isInvulnerable() && target != entityliving1) {
if (entityliving1 == null) {
@ -133,23 +133,23 @@ index edc5cfd3f3eab176df9080cf932dac3905f1b26d..f8aa723f18e28b02d4b7055404922ff8
if (entityliving1.isAlliedTo((Entity) target)) {
return;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
index ced6bf2fc4556c9b2b32ac382058506e931c1475..519755b7f8bc7e8bb9fab135fc5bf7de3a9419f9 100644
index f43dd56182ced23cf1cf65c149c532a611cc933a..1aa5e57a4e6a4be60514d8808a2e6c973d93e798 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
@@ -85,7 +85,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
entityplayer.connection.teleport(teleEvent.getTo());
entity.resetFallDistance();
- entity.hurt(this.damageSources().fall().customEntityDamager(this), 5.0F); // CraftBukkit
+ entity.hurt(this.damageSources().fall().customEventDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
}
// CraftBukkit end
this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_TELEPORT, SoundSource.PLAYERS);
@@ -89,7 +89,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
// entity.changeDimension(new DimensionTransition(worldserver, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING)); // CraftBukkit - moved up
entity.resetFallDistance();
entityplayer.resetCurrentImpulseContext();
- entity.hurt(this.damageSources().fall().customEntityDamager(this), 5.0F); // CraftBukkit
+ entity.hurt(this.damageSources().fall().customEventDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
this.playSound(worldserver, this.position());
}
} else {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
index 02931861de955352e71d6f5ffc720a17304815fe..55b4b5ad5f084c9a271a716d076672478d6486ba 100644
index 60eac9df10a9a395a1568925515d010eb51a64e5..55fd997a4e894eeab24de269d59e486196ffbe8d 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
@@ -72,7 +72,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
@@ -77,7 +77,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
}
}
} else {
@ -157,9 +157,9 @@ index 02931861de955352e71d6f5ffc720a17304815fe..55b4b5ad5f084c9a271a716d07667247
+ flag = entity.hurt(this.damageSources().magic().customEventDamager(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls // Paper - fix DamageSource API
}
if (flag && entity instanceof LivingEntity) {
if (flag && entity instanceof LivingEntity entityliving) {
diff --git a/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
index ab67c5caaff6e8c7de293b528636f53254b805bd..6d92856b5089e946a85d519cadce080bc6c3574f 100644
index ab67c5caaff6e8c7de293b528636f53254b805bd..98e5ec1cc2dba2512650ba706393d1abe0c95591 100644
--- a/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
+++ b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
@@ -47,7 +47,7 @@ public class CraftDamageSource implements DamageSource {
@ -176,7 +176,7 @@ index ab67c5caaff6e8c7de293b528636f53254b805bd..6d92856b5089e946a85d519cadce080b
@Override
public boolean isIndirect() {
- return this.getHandle().getEntity() != this.getHandle().getDamager();
+ return this.getHandle().isIndirect(); // Paper - fix DamageSource API
+ return !this.getHandle().isDirect(); // Paper - fix DamageSource API
}
@Override
@ -197,10 +197,10 @@ index 4c6e15535fa40aad8cf1920f392589404f9ba79c..35eb95ef6fb6a0f7ea63351e90741c48
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index e20feab675d05ae5b5b19870546585936c757970..96070da795755f71e99979288e32b7d7e2d869fb 100644
index a4ea5d942eb61ee733eb1b8b4a3c50fb93f037ea..0b1741cd68d5066114a35cc14ed08b57f4f08fb2 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1084,7 +1084,7 @@ public class CraftEventFactory {
@@ -1085,7 +1085,7 @@ public class CraftEventFactory {
private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
CraftDamageSource bukkitDamageSource = new CraftDamageSource(source);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix creation of invalid block entity during world generation
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index a59eece9c7a8c33cb8ce963906e993c3462684fb..386fbf79afe91af445f54aeab7d1296d1407a4d8 100644
index 682c8cfbd917c086072f1756861a340800ea40da..b26a4a38144ec1b171db911bbf949b53ed35708f 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -323,7 +323,7 @@ public class WorldGenRegion implements WorldGenLevel {
@@ -324,7 +324,7 @@ public class WorldGenRegion implements WorldGenLevel {
return false;
} else {
ChunkAccess ichunkaccess = this.getChunk(pos);
@ -17,7 +17,7 @@ index a59eece9c7a8c33cb8ce963906e993c3462684fb..386fbf79afe91af445f54aeab7d1296d
if (iblockdata1 != null) {
this.level.onBlockStateChange(pos, iblockdata1, state);
@@ -339,6 +339,17 @@ public class WorldGenRegion implements WorldGenLevel {
@@ -340,6 +340,17 @@ public class WorldGenRegion implements WorldGenLevel {
ichunkaccess.removeBlockEntity(pos);
}
} else {
@ -36,10 +36,10 @@ index a59eece9c7a8c33cb8ce963906e993c3462684fb..386fbf79afe91af445f54aeab7d1296d
nbttagcompound.putInt("x", pos.getX());
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 744db9eec4f7bdeb32f83300960a7fce63b393d8..8de6ad8b131061b2dae440dff71e2e6e7af2de39 100644
index cda4413901fb465a855396e42356adaadefd4195..849efe41ff14be1fc95789b083e340363cbc93ab 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1071,9 +1071,14 @@ public class LevelChunk extends ChunkAccess {
@@ -1081,9 +1081,14 @@ public class LevelChunk extends ChunkAccess {
if (this.blockEntity.getType().isValid(iblockdata)) {
this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
this.loggedInvalidBlockState = false;

Datei anzeigen

@ -14,10 +14,10 @@ Additionally equippable mob heads, wither skulls, and carved pumpkins
are subject to the same possible error.
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896d8ea1f91 100644
index 7826e2a52da47914aca39fef958b8f398a2ff937..f96734580a29e0436ac808e41c6cbc3f35eff5f5 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -238,7 +238,7 @@ public interface DispenseItemBehavior {
@@ -239,7 +239,7 @@ public interface DispenseItemBehavior {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@ -26,7 +26,7 @@ index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896
idispensebehavior.dispense(pointer, eventStack);
return stack;
}
@@ -294,7 +294,7 @@ public interface DispenseItemBehavior {
@@ -295,7 +295,7 @@ public interface DispenseItemBehavior {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@ -35,7 +35,7 @@ index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896
idispensebehavior.dispense(pointer, eventStack);
return stack;
}
@@ -368,7 +368,7 @@ public interface DispenseItemBehavior {
@@ -369,7 +369,7 @@ public interface DispenseItemBehavior {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@ -44,7 +44,7 @@ index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896
idispensebehavior.dispense(pointer, eventStack);
return stack;
}
@@ -710,7 +710,7 @@ public interface DispenseItemBehavior {
@@ -690,7 +690,7 @@ public interface DispenseItemBehavior {
OptionalDispenseItemBehavior dispensebehaviormaybe1 = new OptionalDispenseItemBehavior() {
@Override
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
@ -53,7 +53,7 @@ index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896
return stack;
}
};
@@ -764,7 +764,7 @@ public interface DispenseItemBehavior {
@@ -744,7 +744,7 @@ public interface DispenseItemBehavior {
stack.shrink(1);
this.setSuccess(true);
} else {
@ -62,7 +62,7 @@ index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896
}
return stack;
@@ -810,7 +810,7 @@ public interface DispenseItemBehavior {
@@ -790,7 +790,7 @@ public interface DispenseItemBehavior {
stack.shrink(1);
this.setSuccess(true);
} else {
@ -72,10 +72,10 @@ index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896
return stack;
diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
index e766397aae3f73548b290b0809b9d1ca0967ea39..786e4a8700cb84b16dd9b8892a0d1d5803924d81 100644
index fb518f87cc4ccd810fb32cade2fdd7e09ab0abfc..647a4601deace52f8d855f512a73671f82b4762a 100644
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
@@ -48,14 +48,20 @@ public class ArmorItem extends Item implements Equipable {
@@ -39,14 +39,20 @@ public class ArmorItem extends Item implements Equipable {
public static final DispenseItemBehavior DISPENSE_ITEM_BEHAVIOR = new DefaultDispenseItemBehavior() {
@Override
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
@ -97,7 +97,7 @@ index e766397aae3f73548b290b0809b9d1ca0967ea39..786e4a8700cb84b16dd9b8892a0d1d58
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
List<LivingEntity> list = pointer.level().getEntitiesOfClass(LivingEntity.class, new AABB(blockposition), EntitySelector.NO_SPECTATORS.and(new EntitySelector.MobCanWearArmorEntitySelector(armor)));
@@ -86,7 +92,7 @@ public class ArmorItem extends Item implements Equipable {
@@ -77,7 +83,7 @@ public class ArmorItem extends Item implements Equipable {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());

Datei anzeigen

@ -169,10 +169,10 @@ index 898b19887ed34c87003fc63cb5905df2ba6234a5..b47eeb23055b135d5567552ba983bfbc
private void write(FriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bead9625a04a9c1139c54d6a56f055b80eb2d701..34d4243fb5198e36ea3291ffe8ed2480bc960cdb 100644
index 42d3bbfc39444e2a26adb0c72e5895acba0a45ed..9116d0c89fc84ee79d2d0b81ade77264c362c25d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -763,6 +763,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -766,6 +766,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
// Paper end - Don't suggest if tab-complete is disabled
@ -186,7 +186,7 @@ index bead9625a04a9c1139c54d6a56f055b80eb2d701..34d4243fb5198e36ea3291ffe8ed2480
// Paper start - AsyncTabCompleteEvent
TAB_COMPLETE_EXECUTOR.execute(() -> this.handleCustomCommandSuggestions0(packet));
}
@@ -815,6 +822,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -818,6 +825,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void sendServerSuggestions(final ServerboundCommandSuggestionPacket packet, final StringReader stringreader) {
// Paper end - AsyncTabCompleteEvent
ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());

Datei anzeigen

@ -5,31 +5,31 @@ Subject: [PATCH] Item Mutation Fixes
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
index 2f62957e061f513e01ec617f22791a7f27d65f02..480d093105073edfd3acdd7b079b4ca5aa5fdc6d 100644
index c1b9c3ad2cccfa520e9d73b786142624ac5f3380..07223046761cb2186d75de8edc03a91d2e8e8b2f 100644
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
@@ -228,7 +228,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
@@ -235,7 +235,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
return false;
} else if (this.costs[id] > 0 && !itemstack.isEmpty() && (player.experienceLevel >= j && player.experienceLevel >= this.costs[id] || player.getAbilities().instabuild)) {
this.access.execute((world, blockposition) -> {
- ItemStack itemstack2 = itemstack;
+ ItemStack itemstack2 = itemstack; // Paper - diff on change
List<EnchantmentInstance> list = this.getEnchantmentList(world.enabledFeatures(), itemstack, id, this.costs[id]);
List<EnchantmentInstance> list = this.getEnchantmentList(world.registryAccess(), itemstack, id, this.costs[id]);
// CraftBukkit start
@@ -250,10 +250,16 @@ public class EnchantmentMenu extends AbstractContainerMenu {
@@ -258,10 +258,16 @@ public class EnchantmentMenu extends AbstractContainerMenu {
return;
}
// CraftBukkit end
- if (itemstack.is(Items.BOOK)) {
- itemstack2 = itemstack.transmuteCopy(Items.ENCHANTED_BOOK, 1);
- itemstack2 = itemstack.transmuteCopy(Items.ENCHANTED_BOOK);
+ // Paper start
+ itemstack2 = org.bukkit.craftbukkit.inventory.CraftItemStack.getOrCloneOnMutation(item, event.getItem());
+ if (itemstack2 != itemstack) {
this.enchantSlots.setItem(0, itemstack2);
}
+ if (itemstack2.is(Items.BOOK)) {
+ itemstack2 = itemstack2.transmuteCopy(Items.ENCHANTED_BOOK, 1);
+ itemstack2 = itemstack2.transmuteCopy(Items.ENCHANTED_BOOK);
+ this.enchantSlots.setItem(0, itemstack2);
+ }
+ // Paper end