Skip to content

Commit

Permalink
Fix elytra durability setting not working properly (#1589)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantera07 authored Sep 15, 2024
1 parent fdfc12e commit bc7bcbb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions patches/server/0060-Implement-elytra-settings.patch
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ index 218f2f085309f04438f8b07bc41cf242583db2dc..ea8e49b42b9dde74784189430be66ed6
if (event.shouldConsume() && !user.hasInfiniteMaterials()) {
itemStack.shrink(1);
} else ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index e90cf9da9c35c5b73b489990141311c283db4767..59b54a0c37a435976f92a57f5838e25c87096213 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -723,6 +723,12 @@ public final class ItemStack implements DataComponentHolder {
this.setDamageValue(j);
if (j >= this.getMaxDamage()) {
Item item = this.getItem();
+ // Purpur start
+ if (item == Items.ELYTRA) {
+ setDamageValue(this.getMaxDamage() - 1);
+ return;
+ }
+ // Purpur end

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 f1b2d388a1a40a1d909a2e726f32d6c15e1eb0eb..4934bae61114b49a9f8d0ed044fbb881210df32a 100644
--- a/src/main/java/net/minecraft/world/item/TridentItem.java
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0148-Config-to-allow-unsafe-enchants.patch
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ index 2d300905c05c7c23a4da30b3651b331381a1dc0d..30746b3ae45840206bf23e811a9819f3
((ServerPlayer) this.player).connection.send(new ClientboundContainerSetDataPacket(this.containerId, 0, this.cost.get()));
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 50d82217aade8bb6db557df9655e5746608af3ef..fab7bebb8c7fd21a3bcfbd2f04702eb56f9eb310 100644
index 59b54a0c37a435976f92a57f5838e25c87096213..950589f3cfbd4f271c5693f86461aba53663b3f2 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -1251,6 +1251,12 @@ public final class ItemStack implements DataComponentHolder {
@@ -1257,6 +1257,12 @@ public final class ItemStack implements DataComponentHolder {
return !((ItemEnchantments) this.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY)).isEmpty();
}

Expand Down

0 comments on commit bc7bcbb

Please sign in to comment.