Pretend to fix compile errors

This commit is contained in:
Bjarne Koll 2024-06-14 15:16:29 +02:00
parent a308c7c8d7
commit 69d1d0a4f4
No known key found for this signature in database
GPG key ID: 27F6CCCF55D2EE62
6 changed files with 24 additions and 16 deletions

View file

@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..d926ad804355ee2fdc5910b2505e8671
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603921d2260
index 0000000000000000000000000000000000000000..69433be355f284030ca79cba509a351bb32ccd8b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
@@ -0,0 +1,116 @@
@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603
+
+ // Close connection immediately if event is cancelled
+ if (event.isCancelled()) {
+ networkManager.disconnect(null);
+ networkManager.disconnect((Component) null);
+ return;
+ }
+

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add Destroy Speed API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index 9953b6b36cbcbfd1756bac478b568ca5700fc898..21ad2f461a5a578a2bf7fec1deeb421071245e6d 100644
index 9953b6b36cbcbfd1756bac478b568ca5700fc898..9fd636424f1300e0b8263bdd26418e6892053f8f 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -721,4 +721,19 @@ public class CraftBlockData implements BlockData {
@@ -721,4 +721,24 @@ public class CraftBlockData implements BlockData {
public BlockState createBlockState() {
return CraftBlockStates.getBlockState(this.state, null);
}
@ -20,10 +20,15 @@ index 9953b6b36cbcbfd1756bac478b568ca5700fc898..21ad2f461a5a578a2bf7fec1deeb4210
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.unwrap(itemStack);
+ float speed = nmsItemStack.getDestroySpeed(this.state);
+ if (speed > 1.0F && considerEnchants) {
+ int enchantLevel = net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.EFFICIENCY, nmsItemStack);
+ if (enchantLevel > 0) {
+ speed += enchantLevel * enchantLevel + 1;
+ }
+ final org.apache.commons.lang3.mutable.MutableFloat mutableFloat = new org.apache.commons.lang3.mutable.MutableFloat(0);
+ net.minecraft.world.item.enchantment.EnchantmentHelper.forEachModifier(
+ nmsItemStack, net.minecraft.world.entity.EquipmentSlotGroup.MAINHAND,
+ (attributeHolder, attributeModifier) -> {
+ if (!attributeHolder.is(net.minecraft.world.entity.ai.attributes.Attributes.MINING_EFFICIENCY)) return;
+
+ // TODO do we just attempt to calculate the full "modifier" to the mining efficiency?
+ }
+ );
+ }
+ return speed;
+ }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Implement enchantWithLevels API
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index cd0b6819da81978b9186c83ee926e1fed5ee6fe4..01c441bcede88ce663c6b47b027c6239381c62c8 100644
index cd0b6819da81978b9186c83ee926e1fed5ee6fe4..6d1eab448f368be8e1d768712f80f2c4d93c5e1a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -606,4 +606,26 @@ public final class CraftItemFactory implements ItemFactory {
@@ -606,4 +606,29 @@ public final class CraftItemFactory implements ItemFactory {
return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
}
// Paper end - old getSpawnEgg API
@ -24,12 +24,15 @@ index cd0b6819da81978b9186c83ee926e1fed5ee6fe4..01c441bcede88ce663c6b47b027c6239
+ if (internalStack.isEnchanted()) {
+ internalStack.set(net.minecraft.core.component.DataComponents.ENCHANTMENTS, null);
+ }
+ final net.minecraft.core.RegistryAccess registryAccess = net.minecraft.server.MinecraftServer.getServer().registryAccess();
+ final net.minecraft.core.Registry<Enchantment> enchantments = registryAccess.registryOrThrow(Registries.ENCHANTMENT);
+ final net.minecraft.world.item.ItemStack enchanted = net.minecraft.world.item.enchantment.EnchantmentHelper.enchantItem(
+ MinecraftServer.getServer().getWorldData().enabledFeatures(),
+ new org.bukkit.craftbukkit.util.RandomSourceWrapper(random),
+ internalStack,
+ levels,
+ allowTreasure
+ enchantments.holders()
+ .<net.minecraft.core.Holder<Enchantment>>map(r -> r)
+ .filter(r -> allowTreasure || !r.is(EnchantmentTags.TREASURE))
+ );
+ return CraftItemStack.asCraftMirror(enchanted);
+ }

View file

@ -46,10 +46,10 @@ index 6d10396347b69d9243ab902ecc68ede93fa17b7d..af219df5267589300f0ad1d30fa5c81a
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index 21ad2f461a5a578a2bf7fec1deeb421071245e6d..de4bbb73a78d037b99d662df130c7e122fda6cee 100644
index 9fd636424f1300e0b8263bdd26418e6892053f8f..bfa0ec7bbf18b47546a4c2d3409164e3e53a9fb5 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -736,4 +736,11 @@ public class CraftBlockData implements BlockData {
@@ -741,4 +741,11 @@ public class CraftBlockData implements BlockData {
return speed;
}
// Paper end - destroy speed API

View file

@ -5,7 +5,7 @@ Subject: [PATCH] fix item meta for tadpole buckets
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 01c441bcede88ce663c6b47b027c6239381c62c8..06af600a82f16c54f0774d93266deb8dd1c662cf 100644
index 6d1eab448f368be8e1d768712f80f2c4d93c5e1a..c4ec0165dc0d2bba829c2310596e70a1b224e225 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -377,6 +377,7 @@ public final class CraftItemFactory implements ItemFactory {

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Add API to get the collision shape of a block before it's
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index de4bbb73a78d037b99d662df130c7e122fda6cee..162e10ce5481d1f94afae595114920ef9df51c61 100644
index bfa0ec7bbf18b47546a4c2d3409164e3e53a9fb5..260285a3b0643e3262e3e7c01db23889755998aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -679,6 +679,20 @@ public class CraftBlockData implements BlockData {