From ca8bdc214c4265ed9c8fb8d6554915fb42a197f1 Mon Sep 17 00:00:00 2001 From: Nebojsa Majic <79749977+Onako2@users.noreply.github.com> Date: Sun, 24 Nov 2024 00:08:43 +0100 Subject: [PATCH] Check if the player has an elytra equipped --- .../server/0058-Implement-elytra-settings.patch | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/patches/server/0058-Implement-elytra-settings.patch b/patches/server/0058-Implement-elytra-settings.patch index b5bca2d07..d06cba41a 100644 --- a/patches/server/0058-Implement-elytra-settings.patch +++ b/patches/server/0058-Implement-elytra-settings.patch @@ -90,20 +90,22 @@ index 239bd6e3d756dc4ecab6ca639fa84ccbf89418a7..dcb656be3d37f29bdbe7d25ace05c6dd this.shrink(1); breakCallback.accept(item); diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java -index 8b9a93ef71164cce8a616735b71d96d37e83b1a8..24b97c8e2758e4a991dbbbf5276580e1fe027439 100644 +index 8b9a93ef71164cce8a616735b71d96d37e83b1a8..5133443911f932e8f6b5d3ca8baccecfd6f81c00 100644 --- a/src/main/java/net/minecraft/world/item/TridentItem.java +++ b/src/main/java/net/minecraft/world/item/TridentItem.java -@@ -132,6 +132,16 @@ public class TridentItem extends Item implements ProjectileItem { +@@ -132,6 +132,18 @@ public class TridentItem extends Item implements ProjectileItem { f4 *= f / f6; f5 *= f / f6; org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(entityhuman, stack, f3, f4, f5); // CraftBukkit + + // Purpur start + List list = EquipmentSlot.VALUES.stream().filter((enumitemslot) -> LivingEntity.canGlideUsing(entityhuman.getItemBySlot(enumitemslot), enumitemslot)).toList(); -+ EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, entityhuman.random); -+ ItemStack glideItem = entityhuman.getItemBySlot(enumitemslot); -+ if (glideItem.has(net.minecraft.core.component.DataComponents.GLIDER) && world.purpurConfig.elytraDamagePerTridentBoost > 0) { -+ glideItem.hurtAndBreak(world.purpurConfig.elytraDamagePerTridentBoost, entityhuman, enumitemslot); ++ if (!list.isEmpty()) { ++ EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, entityhuman.random); ++ ItemStack glideItem = entityhuman.getItemBySlot(enumitemslot); ++ if (glideItem.has(net.minecraft.core.component.DataComponents.GLIDER) && world.purpurConfig.elytraDamagePerTridentBoost > 0) { ++ glideItem.hurtAndBreak(world.purpurConfig.elytraDamagePerTridentBoost, entityhuman, enumitemslot); ++ } + } + // Purpur end +