9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-25 18:09:18 +00:00
Files
LeavesMC/patches/server/0039-Renewable-Elytra.patch
2024-08-14 17:07:19 +08:00

33 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Mon, 12 Dec 2022 16:41:52 +0800
Subject: [PATCH] Renewable Elytra
This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition)
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index c277dac448a64809e93dd7a447ee3dc2a86c860e..5641da81d6f00e153d847b9284251084d545e726 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -233,6 +233,20 @@ public class Phantom extends FlyingMob implements Enemy {
return entitysize.scale(1.0F + 0.15F * (float) i);
}
+ // Leaves start - renewable elytra
+ @Override
+ protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
+ super.dropFromLootTable(source, causedByPlayer);
+ if (org.leavesmc.leaves.LeavesConfig.renewableElytra > 0.0D) {
+ if (source.getEntity() instanceof Shulker && this.random.nextDouble() < org.leavesmc.leaves.LeavesConfig.renewableElytra) {
+ net.minecraft.world.item.ItemStack item = new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ELYTRA);
+ item.setDamageValue(432);
+ this.spawnAtLocation(item);
+ }
+ }
+ }
+ // Leaves end - renewable elytra
+
// Paper start
@Nullable
java.util.UUID spawningEntity;