Skip to content

Commit 9a612a8

Browse files
s-yh-chinaLumine1909
authored andcommitted
Renewable sponges (LeavesMC#29)
1 parent 89c0a99 commit 9a612a8

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

patches/server/0005-Leaves-Server-Config-And-Command.patch

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ index dd95c9d931da5ee2cb3e620c71cc90d178c51fbc..d1ebe4f340c53f987a42fffcc462f2ea
7878
.withRequiredArg()
7979
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
8080
new file mode 100644
81-
index 0000000000000000000000000000000000000000..9b558395d65921b097fd1ab6230496c93f6c97c3
81+
index 0000000000000000000000000000000000000000..4eac1921b5cb8616881bcb56b889336ac559920e
8282
--- /dev/null
8383
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
84-
@@ -0,0 +1,873 @@
84+
@@ -0,0 +1,876 @@
8585
+package top.leavesmc.leaves;
8686
+
8787
+import com.destroystokyo.paper.util.SneakyThrow;
@@ -546,6 +546,9 @@ index 0000000000000000000000000000000000000000..9b558395d65921b097fd1ab6230496c9
546546
+ @GlobalConfig(name = "renewable-deepslate", category = "modify")
547547
+ public static boolean renewableDeepslate = false;
548548
+
549+
+ @GlobalConfig(name = "renewable-sponges", category = "modify")
550+
+ public static boolean renewableSponges = false;
551+
+
549552
+ // Leaves start - modify - removed
550553
+
551554
+ @RemovedConfig
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: violetc <[email protected]>
3+
Date: Mon, 22 Jan 2024 11:41:13 +0800
4+
Subject: [PATCH] Renewable sponges
5+
6+
7+
diff --git a/src/main/java/net/minecraft/world/entity/monster/Guardian.java b/src/main/java/net/minecraft/world/entity/monster/Guardian.java
8+
index fd41ef66e2e12ec3a888bb376ef4363343914fcd..2719623d856ad33fa1164c566fddd8bd24dfc8bd 100644
9+
--- a/src/main/java/net/minecraft/world/entity/monster/Guardian.java
10+
+++ b/src/main/java/net/minecraft/world/entity/monster/Guardian.java
11+
@@ -364,6 +364,30 @@ public class Guardian extends Monster {
12+
return new Vector3f(0.0F, dimensions.height + 0.125F * scaleFactor, 0.0F);
13+
}
14+
15+
+ // Leaves start - renewable sponges
16+
+
17+
+ @Override
18+
+ public void thunderHit(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.LightningBolt lightning) {
19+
+ if (top.leavesmc.leaves.LeavesConfig.renewableSponges && !this.isRemoved() && !(this instanceof ElderGuardian)) {
20+
+ ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level());
21+
+ elderGuardian.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
22+
+ elderGuardian.finalizeSpawn(world ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), MobSpawnType.CONVERSION, null, null);
23+
+ elderGuardian.setNoAi(this.isNoAi());
24+
+
25+
+ if (this.hasCustomName()) {
26+
+ elderGuardian.setCustomName(this.getCustomName());
27+
+ elderGuardian.setCustomNameVisible(this.isCustomNameVisible());
28+
+ }
29+
+
30+
+ this.level().addFreshEntity(elderGuardian);
31+
+ this.discard();
32+
+ } else {
33+
+ super.thunderHit(world, lightning);
34+
+ }
35+
+ }
36+
+
37+
+ // Leaves end - renewable sponges
38+
+
39+
private static class GuardianMoveControl extends MoveControl {
40+
41+
private final Guardian guardian;

0 commit comments

Comments
 (0)