9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-27 19:09:23 +00:00
Files
LeavesMC/patches/server/0045-Renewable-Elytra.patch
violetc f40d340092 1.20.6 (#216)
---------

Co-authored-by: MC_XiaoHei <xiaohei.xor7studio@foxmail.com>
Co-authored-by: Bluemangoo <chenfy2006@qq.com>
2024-05-20 23:03:56 +08:00

42 lines
1.9 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 68f8945292753535a3b73acb9f48c1594f0789a4..da5df2271a8192bf4c86772bd84107e55f3040aa 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -35,6 +35,8 @@ import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
import net.minecraft.world.entity.animal.Cat;
import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.levelgen.Heightmap;
@@ -233,6 +235,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) {
+ ItemStack item = new ItemStack(Items.ELYTRA);
+ item.setDamageValue(432);
+ this.spawnAtLocation(item);
+ }
+ }
+ }
+ // Leaves end - renewable elytra
+
// Paper start
@Nullable
java.util.UUID spawningEntity;