9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/patches/server/0048-Renewable-Elytra.patch
2023-09-28 18:12:42 +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 5b4719dd7c3b8f93c898779f45239568f6a5fe43..9c0b9eb91c07aae0cb43a0988ccd4381eecfbbf7 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -36,6 +36,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;
@@ -255,6 +257,20 @@ public class Phantom extends FlyingMob implements Enemy {
return -0.125F;
}
+ // Leaves start - renewable elytra
+ @Override
+ protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
+ super.dropFromLootTable(source, causedByPlayer);
+ if (top.leavesmc.leaves.LeavesConfig.renewableElytra > 0.0D) {
+ if (source.getEntity() instanceof Shulker && this.random.nextDouble() < top.leavesmc.leaves.LeavesConfig.renewableElytra) {
+ ItemStack item = new ItemStack(Items.ELYTRA);
+ item.setDamageValue(432);
+ this.spawnAtLocation(item);
+ }
+ }
+ }
+ // Leaves end - renewable elytra
+
// Paper start
java.util.UUID spawningEntity;