Updated Upstream (Bukkit/CraftBukkit) (#10379)
Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: f02baa38 PR-988: Add World#getIntersectingChunks(BoundingBox) 9321d665 Move getItemInUse up to LivingEntity 819eef73 PR-959: Add access to current item's remaining ticks c4fdadb0 SPIGOT-7601: Add AbstractArrow#getItem be8261ca Add support for Java 22 26119676 PR-979: Add more translation keys 66753362 PR-985: Correct book maximum pages and characters per page documentation c8be92fa PR-980: Improve getArmorContents() documentation f1120ee2 PR-983: Expose riptide velocity to PlayerRiptideEvent CraftBukkit Changes: dfaa89bbe PR-1369: Add World#getIntersectingChunks(BoundingBox) 51bbab2b9 Move getItemInUse up to LivingEntity 668e09602 PR-1331: Add access to current item's remaining ticks a639406d1 SPIGOT-7601: Add AbstractArrow#getItem 0398930fc SPIGOT-7602: Allow opening in-world horse and related inventories ffd15611c SPIGOT-7608: Allow empty lists to morph to any PDT list 2188dcfa9 Add support for Java 22 45d6a609f SPIGOT-7604: Revert "SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime" 06d915943 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime ca3bc3707 PR-1361: Add more translation keys 366c3ca80 SPIGOT-7600: EntityChangeBlockEvent is not fired for frog eggs 06d0f9ba8 SPIGOT-7593: Fix sapling growth physics / client-side updates 45c2608e4 PR-1366: Expose riptide velocity to PlayerRiptideEvent 29b6bb79b SPIGOT-7587: Remove fixes for now-resolved MC-142590 and MC-109346
This commit is contained in:
@@ -45,19 +45,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
this.damageItemStack0(this.getHandle().getItemBySlot(nmsSlot), amount, nmsSlot);
|
||||
this.getHandle().frictionState = state;
|
||||
}
|
||||
|
||||
// Paper end - friction API
|
||||
+
|
||||
+ // Paper start - body yaw API
|
||||
+ @Override
|
||||
+ public float getBodyYaw() {
|
||||
+ return this.getHandle().getVisualRotationYInDegrees();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBodyYaw(float bodyYaw) {
|
||||
+ public void setBodyYaw(final float bodyYaw) {
|
||||
+ this.getHandle().setYBodyRot(bodyYaw);
|
||||
+ }
|
||||
+
|
||||
private void damageItemStack0(net.minecraft.world.item.ItemStack nmsStack, int amount, net.minecraft.world.entity.EquipmentSlot slot) {
|
||||
nmsStack.hurtAndBreak(amount, this.getHandle(), livingEntity -> {
|
||||
if (slot != null) {
|
||||
+ // Paper end - body yaw API
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
return getHandle().getUseItem().asBukkitMirror();
|
||||
return this.getHandle().getUseItem().asBukkitMirror();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
@@ -20,5 +20,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public int getItemUseRemainingTime() {
|
||||
return getHandle().getUseItemRemainingTicks();
|
||||
public int getActiveItemRemainingTime() {
|
||||
return this.getHandle().getUseItemRemainingTicks();
|
||||
|
||||
@@ -237,12 +237,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
player.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
- public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is) {
|
||||
- BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is);
|
||||
+ public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, Block dispenser, CraftItemStack is, List<ItemStack> drops) { // Paper - custom shear drops
|
||||
+ public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is, List<ItemStack> drops) { // Paper - custom shear drops
|
||||
+ BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is, Lists.transform(drops, CraftItemStack::asCraftMirror)); // Paper - custom shear drops
|
||||
Bukkit.getPluginManager().callEvent(bse);
|
||||
return bse;
|
||||
|
||||
@@ -9,14 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category");
|
||||
}
|
||||
// Paper end - more enchant API
|
||||
+
|
||||
+ // Paper start - knockback API
|
||||
+ @Override
|
||||
+ public void knockback(double strength, double directionX, double directionZ) {
|
||||
+ public void knockback(final double strength, final double directionX, final double directionZ) {
|
||||
+ Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0");
|
||||
+ getHandle().knockback(strength, directionX, directionZ);
|
||||
+ this.getHandle().knockback(strength, directionX, directionZ);
|
||||
+ };
|
||||
// Paper end
|
||||
+ // Paper end - knockback API
|
||||
}
|
||||
|
||||
@@ -9,13 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
((Mob) getHandle()).getJumpControl().jump();
|
||||
}
|
||||
}
|
||||
// Paper end - entity jump API
|
||||
+
|
||||
+ // Paper start - pickup animation API
|
||||
+ @Override
|
||||
+ public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
|
||||
+ getHandle().take(((CraftItem) item).getHandle(), quantity);
|
||||
+ public void playPickupItemAnimation(final org.bukkit.entity.Item item, final int quantity) {
|
||||
+ this.getHandle().take(((CraftItem) item).getHandle(), quantity);
|
||||
+ }
|
||||
// Paper end
|
||||
+ // Paper end - pickup animation API
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol
|
||||
// Paper end
|
||||
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
|
||||
implementation("org.ow2.asm:asm-commons:9.5")
|
||||
implementation("org.ow2.asm:asm-commons:9.7")
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||
|
||||
@@ -4054,7 +4054,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public String getTranslationKey() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -5167,6 +5167,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Override
|
||||
public boolean hasRepairCost() {
|
||||
return this.repairCost > 0;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
|
||||
@@ -0,0 +0,0 @@ public class CraftTrimMaterial implements TrimMaterial, Handleable<net.minecraft
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTranslationKey() {
|
||||
+ if (!(this.handle.description().getContents() instanceof TranslatableContents)) throw new UnsupportedOperationException("Description isn't translatable!"); // Paper
|
||||
return ((TranslatableContents) this.handle.description().getContents()).getKey();
|
||||
}
|
||||
+
|
||||
+ // Paper start - adventure
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component description() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.handle.description());
|
||||
+ }
|
||||
+ // Paper end - adventure
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
|
||||
@@ -0,0 +0,0 @@ public class CraftTrimPattern implements TrimPattern, Handleable<net.minecraft.w
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTranslationKey() {
|
||||
+ if (!(this.handle.description().getContents() instanceof TranslatableContents)) throw new UnsupportedOperationException("Description isn't translatable!"); // Paper
|
||||
return ((TranslatableContents) this.handle.description().getContents()).getKey();
|
||||
}
|
||||
+
|
||||
+ // Paper start - adventure
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component description() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.handle.description());
|
||||
+ }
|
||||
+ // Paper end - adventure
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftCustomInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftCustomInventoryConverter.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftCustomInventoryConverter.java
|
||||
|
||||
@@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
||||
- }
|
||||
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
|
||||
implementation("org.ow2.asm:asm-commons:9.5")
|
||||
implementation("org.ow2.asm:asm-commons:9.7")
|
||||
implementation("commons-lang:commons-lang:2.6")
|
||||
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
|
||||
@@ -0,0 +0,0 @@ tasks.jar {
|
||||
|
||||
@@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -0,0 +0,0 @@ dependencies {
|
||||
implementation("org.ow2.asm:asm-commons:9.5")
|
||||
implementation("org.ow2.asm:asm-commons:9.7")
|
||||
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
||||
implementation("commons-lang:commons-lang:2.6")
|
||||
+ implementation("net.fabricmc:mapping-io:0.5.0") // Paper - needed to read mappings for stacktrace deobfuscation
|
||||
|
||||
@@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
engine.execute(() -> { // Paper - Fix preemptive player kick on a server shutdown
|
||||
+ packetProcessing.push(listener); // Paper - detailed watchdog information
|
||||
+ try { // Paper - detailed watchdog information
|
||||
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
|
||||
if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players
|
||||
if (listener.shouldHandleMessage(packet)) {
|
||||
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
|
||||
@@ -0,0 +0,0 @@ public class PacketUtils {
|
||||
|
||||
@@ -54,10 +54,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public org.bukkit.inventory.EquipmentSlot getHandRaised() {
|
||||
return getHandle().getUsedItemHand() == net.minecraft.world.InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
|
||||
return org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(this.getHandle().getUsedItemHand());
|
||||
}
|
||||
// Paper end - active item API
|
||||
+
|
||||
+ // Paper start - entity jump API
|
||||
+ @Override
|
||||
+ public boolean isJumping() {
|
||||
+ return getHandle().jumping;
|
||||
@@ -71,5 +72,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ ((Mob) getHandle()).getJumpControl().jump();
|
||||
+ }
|
||||
+ }
|
||||
// Paper end
|
||||
+ // Paper end - entity jump API
|
||||
}
|
||||
|
||||
@@ -40,18 +40,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
|
||||
getHandle().take(((CraftItem) item).getHandle(), quantity);
|
||||
this.getHandle().take(((CraftItem) item).getHandle(), quantity);
|
||||
}
|
||||
// Paper end - pickup animation API
|
||||
+
|
||||
+ // Paper start - hurt direction API
|
||||
+ @Override
|
||||
+ public float getHurtDirection() {
|
||||
+ return this.getHandle().getHurtDir();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setHurtDirection(float hurtDirection) {
|
||||
+ public void setHurtDirection(final float hurtDirection) {
|
||||
+ throw new UnsupportedOperationException("Cannot set the hurt direction on a non player");
|
||||
+ }
|
||||
// Paper end
|
||||
+ // Paper end - hurt direction API
|
||||
}
|
||||
|
||||
@@ -79,23 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
world.setBlockAndUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error
|
||||
});
|
||||
world.levelEvent(3002, blockposition1, -1);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java b/src/main/java/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
|
||||
@@ -0,0 +0,0 @@ public class TryLaySpawnOnWaterNearLand {
|
||||
BlockPos blockPos3 = blockPos2.above();
|
||||
if (world.getBlockState(blockPos3).isAir()) {
|
||||
BlockState blockState = frogSpawn.defaultBlockState();
|
||||
+ // Paper start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockPos3, blockState)) {
|
||||
+ isPregnant.erase(); // forgot pregnant memory
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
world.setBlock(blockPos3, blockState, 3);
|
||||
world.gameEvent(GameEvent.BLOCK_PLACE, blockPos3, GameEvent.Context.of(entity, blockState));
|
||||
world.playSound((Player)null, entity, SoundEvents.FROG_LAY_SPAWN, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
|
||||
@@ -18,6 +18,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!engine.isSameThread()) {
|
||||
- engine.executeIfPossible(() -> {
|
||||
+ engine.execute(() -> { // Paper - Fix preemptive player kick on a server shutdown
|
||||
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
|
||||
if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players
|
||||
if (listener.shouldHandleMessage(packet)) {
|
||||
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
|
||||
|
||||
@@ -139,7 +139,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
});
|
||||
}
|
||||
|
||||
// Paper end - ItemStack damage API
|
||||
+
|
||||
+ // Paper start - friction API
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.util.TriState getFrictionState() {
|
||||
@@ -151,7 +153,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ java.util.Objects.requireNonNull(state, "state may not be null");
|
||||
+ this.getHandle().frictionState = state;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void knockback(double strength, double directionX, double directionZ) {
|
||||
Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0");
|
||||
+ // Paper end - friction API
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
||||
testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
testImplementation("org.mockito:mockito-core:5.5.0")
|
||||
testImplementation("org.mockito:mockito-core:5.11.0")
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
||||
@@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.TRIM_MATERIAL.getKey(this), () -> this + " doesn't have a key"); // Paper
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
|
||||
@@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.TRIM_PATTERN.getKey(this), () -> this + " doesn't have a key"); // Paper
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/test/java/org/bukkit/registry/PerRegistryTest.java b/src/test/java/org/bukkit/registry/PerRegistryTest.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/test/java/org/bukkit/registry/PerRegistryTest.java
|
||||
|
||||
@@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'.");
|
||||
- return;
|
||||
- }
|
||||
- if (javaVersion > 65.0) {
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 21 is supported.");
|
||||
- if (javaVersion > 66.0) {
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 22 is supported.");
|
||||
+ boolean isOldVersion = javaVersion < 61.0;
|
||||
+ if (!skip && isOldVersion) {
|
||||
+ System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install");
|
||||
|
||||
@@ -15,16 +15,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category");
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public void broadcastSlotBreak(org.bukkit.inventory.EquipmentSlot slot) {
|
||||
this.getHandle().knockback(strength, directionX, directionZ);
|
||||
};
|
||||
// Paper end - knockback API
|
||||
+
|
||||
+ // Paper start - ItemStack damage API
|
||||
+ public void broadcastSlotBreak(final org.bukkit.inventory.EquipmentSlot slot) {
|
||||
+ this.getHandle().broadcastBreakEvent(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void broadcastSlotBreak(org.bukkit.inventory.EquipmentSlot slot, Collection<org.bukkit.entity.Player> players) {
|
||||
+ public void broadcastSlotBreak(final org.bukkit.inventory.EquipmentSlot slot, final Collection<org.bukkit.entity.Player> players) {
|
||||
+ if (players.isEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
@@ -36,9 +37,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack damageItemStack(ItemStack stack, int amount) {
|
||||
+ public ItemStack damageItemStack(ItemStack stack, final int amount) {
|
||||
+ final net.minecraft.world.item.ItemStack nmsStack;
|
||||
+ if (stack instanceof CraftItemStack craftItemStack) {
|
||||
+ if (stack instanceof final CraftItemStack craftItemStack) {
|
||||
+ if (craftItemStack.handle == null || craftItemStack.handle.isEmpty()) {
|
||||
+ return stack;
|
||||
+ }
|
||||
@@ -52,19 +53,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void damageItemStack(org.bukkit.inventory.EquipmentSlot slot, int amount) {
|
||||
+ public void damageItemStack(final org.bukkit.inventory.EquipmentSlot slot, final int amount) {
|
||||
+ final net.minecraft.world.entity.EquipmentSlot nmsSlot = org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot);
|
||||
+ this.damageItemStack0(this.getHandle().getItemBySlot(nmsSlot), amount, nmsSlot);
|
||||
+ }
|
||||
+
|
||||
+ private void damageItemStack0(net.minecraft.world.item.ItemStack nmsStack, int amount, net.minecraft.world.entity.EquipmentSlot slot) {
|
||||
+ private void damageItemStack0(final net.minecraft.world.item.ItemStack nmsStack, final int amount, final net.minecraft.world.entity.EquipmentSlot slot) {
|
||||
+ nmsStack.hurtAndBreak(amount, this.getHandle(), livingEntity -> {
|
||||
+ if (slot != null) {
|
||||
+ livingEntity.broadcastBreakEvent(slot);
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void knockback(double strength, double directionX, double directionZ) {
|
||||
Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0");
|
||||
+ // Paper end - ItemStack damage API
|
||||
}
|
||||
|
||||
53
patches/server/LivingEntity-Active-Item-API.patch
Normal file
53
patches/server/LivingEntity-Active-Item-API.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 29 Jun 2018 00:21:28 -0400
|
||||
Subject: [PATCH] LivingEntity Active Item API
|
||||
|
||||
API relating to items being actively used by a LivingEntity
|
||||
such as a bow or eating food.
|
||||
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
getHandle().setShieldBlockingDelay(delay);
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Paper start - active item API
|
||||
+ @Override
|
||||
+ public ItemStack getActiveItem() {
|
||||
+ return this.getHandle().getUseItem().asBukkitMirror();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getActiveItemRemainingTime() {
|
||||
+ return this.getHandle().getUseItemRemainingTicks();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setActiveItemRemainingTime(final int ticks) {
|
||||
+ Preconditions.checkArgument(ticks >= 0, "ticks must be >= 0");
|
||||
+ Preconditions.checkArgument(ticks <= this.getHandle().getUseItem().getUseDuration(), "ticks must be <= item use duration");
|
||||
+ this.getHandle().useItemRemaining = ticks;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getActiveItemUsedTime() {
|
||||
+ return this.getHandle().getTicksUsingItem();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasActiveItem() {
|
||||
+ return this.getHandle().isUsingItem();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.EquipmentSlot getActiveItemHand() {
|
||||
+ return org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(this.getHandle().getUsedItemHand());
|
||||
+ }
|
||||
+ // Paper end - active item API
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 29 Jun 2018 00:21:28 -0400
|
||||
Subject: [PATCH] LivingEntity Hand Raised/Item Use API
|
||||
|
||||
How long an entity has raised hands to charge an attack or use an item
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void setShieldBlockingDelay(int delay) {
|
||||
getHandle().setShieldBlockingDelay(delay);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack getActiveItem() {
|
||||
+ return getHandle().getUseItem().asBukkitMirror();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getItemUseRemainingTime() {
|
||||
+ return getHandle().getUseItemRemainingTicks();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getHandRaisedTime() {
|
||||
+ return getHandle().getTicksUsingItem();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isHandRaised() {
|
||||
+ return getHandle().isUsingItem();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.EquipmentSlot getHandRaised() {
|
||||
+ return getHandle().getUsedItemHand() == net.minecraft.world.InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
@@ -82,10 +82,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void setHurtDirection(float hurtDirection) {
|
||||
throw new UnsupportedOperationException("Cannot set the hurt direction on a non player");
|
||||
}
|
||||
// Paper end - hurt direction API
|
||||
+
|
||||
+ // Paper start - more enchant API
|
||||
+ public static MobType fromBukkitEntityCategory(EntityCategory entityCategory) {
|
||||
+ switch (entityCategory) {
|
||||
+ case NONE:
|
||||
@@ -101,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category");
|
||||
+ }
|
||||
// Paper end
|
||||
+ // Paper end - more enchant API
|
||||
}
|
||||
diff --git a/src/test/java/io/papermc/paper/enchantments/EnchantmentRarityTest.java b/src/test/java/io/papermc/paper/enchantments/EnchantmentRarityTest.java
|
||||
new file mode 100644
|
||||
|
||||
@@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPotionEffectType extends PotionEffectType implements Handleabl
|
||||
return Color.fromRGB(this.handle.getColor());
|
||||
return this.handle.getDescriptionId();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
||||
@@ -7268,7 +7268,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public FeatureFlag getFeatureFlag(NamespacedKey namespacedKey) {
|
||||
public String getTranslationKey(final Attribute attribute) {
|
||||
diff --git a/src/main/resources/META-INF/services/io.papermc.paper.plugin.entrypoint.classloader.ClassloaderBytecodeModifier b/src/main/resources/META-INF/services/io.papermc.paper.plugin.entrypoint.classloader.ClassloaderBytecodeModifier
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
||||
@@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ dependencies {
|
||||
implementation("jline:jline:2.12.1")
|
||||
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
|
||||
implementation("org.ow2.asm:asm-commons:9.5")
|
||||
implementation("org.ow2.asm:asm-commons:9.7")
|
||||
+ implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
||||
implementation("commons-lang:commons-lang:2.6")
|
||||
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Sat, 23 Sep 2023 01:51:22 -0400
|
||||
Subject: [PATCH] Remove Spigot Bug Fix for MC-109346
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -0,0 +0,0 @@ public class ServerEntity {
|
||||
((LivingEntity) this.entity).detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
}
|
||||
|
||||
- // CraftBukkit start - MC-109346: Fix for nonsensical head yaw
|
||||
- if (this.entity instanceof ServerPlayer) {
|
||||
- sender.accept(new ClientboundRotateHeadPacket(this.entity, (byte) Mth.floor(this.entity.getYHeadRot() * 256.0F / 360.0F)));
|
||||
- }
|
||||
- // CraftBukkit end
|
||||
-
|
||||
if (!this.entity.getPassengers().isEmpty()) {
|
||||
sender.accept(new ClientboundSetPassengersPacket(this.entity));
|
||||
}
|
||||
@@ -15668,14 +15668,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
continue;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// CraftBukkit start
|
||||
@Override
|
||||
public boolean isSameThread() {
|
||||
- return super.isSameThread() || this.isStopped(); // CraftBukkit - MC-142590
|
||||
+ return io.papermc.paper.util.TickThread.isTickThread(); // Paper - rewrite chunk system
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start - rewrite chunk system
|
||||
+ @Override
|
||||
+ public boolean isSameThread() {
|
||||
+ return io.papermc.paper.util.TickThread.isTickThread();
|
||||
+ }
|
||||
+ // Paper end - rewrite chunk system
|
||||
+
|
||||
// CraftBukkit start
|
||||
public boolean isDebugging() {
|
||||
return false;
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
|
||||
@@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") {
|
||||
+ exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
||||
+ }
|
||||
+ implementation("org.ow2.asm:asm-commons:9.5")
|
||||
+ implementation("org.ow2.asm:asm-commons:9.7")
|
||||
+ implementation("commons-lang:commons-lang:2.6")
|
||||
+ runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
|
||||
+ runtimeOnly("com.mysql:mysql-connector-j:8.2.0")
|
||||
@@ -57,8 +57,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
||||
+ testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
+ testImplementation("org.mockito:mockito-core:5.5.0")
|
||||
+ testImplementation("org.ow2.asm:asm-tree:9.5")
|
||||
+ testImplementation("org.mockito:mockito-core:5.11.0")
|
||||
+ testImplementation("org.ow2.asm:asm-tree:9.7")
|
||||
+}
|
||||
+
|
||||
+val craftbukkitPackageVersion = "1_20_R3" // Paper
|
||||
@@ -242,7 +242,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <dependency>
|
||||
- <groupId>org.ow2.asm</groupId>
|
||||
- <artifactId>asm-commons</artifactId>
|
||||
- <version>9.5</version>
|
||||
- <version>9.7</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <!-- Mojang depends -->
|
||||
@@ -466,13 +466,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <dependency>
|
||||
- <groupId>org.mockito</groupId>
|
||||
- <artifactId>mockito-core</artifactId>
|
||||
- <version>5.5.0</version>
|
||||
- <version>5.11.0</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.ow2.asm</groupId>
|
||||
- <artifactId>asm-tree</artifactId>
|
||||
- <version>9.5</version>
|
||||
- <version>9.7</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
|
||||
@@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/build.gradle.kts
|
||||
@@ -0,0 +0,0 @@ dependencies {
|
||||
testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
testImplementation("org.mockito:mockito-core:5.5.0")
|
||||
testImplementation("org.ow2.asm:asm-tree:9.5")
|
||||
testImplementation("org.mockito:mockito-core:5.11.0")
|
||||
testImplementation("org.ow2.asm:asm-tree:9.7")
|
||||
+ testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
||||
}
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||
@@ -0,0 +0,0 @@ public class PacketUtils {
|
||||
engine.executeIfPossible(() -> {
|
||||
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
|
||||
if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players
|
||||
if (listener.shouldHandleMessage(packet)) {
|
||||
- try {
|
||||
+ co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
|
||||
Date: Sat, 18 Feb 2023 16:23:18 +0100
|
||||
Subject: [PATCH] Update the flag when a captured block state is outdated
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
|
||||
this.capturedBlockStates.put(pos.immutable(), blockstate);
|
||||
}
|
||||
+ blockstate.setFlag(flags); // Paper - update the flag also
|
||||
blockstate.setData(state);
|
||||
return true;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ alsoShade(log4jPlugins.output)
|
||||
+ // Paper end
|
||||
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
|
||||
implementation("org.ow2.asm:asm-commons:9.5")
|
||||
implementation("org.ow2.asm:asm-commons:9.7")
|
||||
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
||||
@@ -0,0 +0,0 @@ relocation {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user