9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-03 22:26:12 +00:00
Files
LeavesMC/patches/server/0053-Renewable-Elytra.patch
2023-01-24 10:43:02 +08:00

58 lines
2.7 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 aa8734856ec7b90036afad13bfda46c02e548812..5d3c60c2e216848c7bbaebbd9b4f8184c5e06518 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;
@@ -245,6 +247,20 @@ public class Phantom extends FlyingMob implements Enemy {
return entitysize.scale(f);
}
+ // 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;
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 9d96ca020c8b8c5d194bb5312ac7bf6d06bad03e..5ae57fa9c5421940e703c02a01a061fceb7cf374 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -435,6 +435,11 @@ public final class LeavesConfig {
playerOperationLimiter = getBoolean("settings.modify.player-operation-limiter", playerOperationLimiter);
}
+ public static double renewableElytra = -1.0;
+ private static void renewableElytra() {
+ renewableElytra = getDouble("settings.modify.renewable-elytra", renewableElytra);
+ }
+
public static final class WorldConfig {
public final String worldName;