forked from LeavesMC/Leaves
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89c0a99
commit 9a612a8
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Mon, 22 Jan 2024 11:41:13 +0800 | ||
Subject: [PATCH] Renewable sponges | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Guardian.java b/src/main/java/net/minecraft/world/entity/monster/Guardian.java | ||
index fd41ef66e2e12ec3a888bb376ef4363343914fcd..2719623d856ad33fa1164c566fddd8bd24dfc8bd 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/monster/Guardian.java | ||
+++ b/src/main/java/net/minecraft/world/entity/monster/Guardian.java | ||
@@ -364,6 +364,30 @@ public class Guardian extends Monster { | ||
return new Vector3f(0.0F, dimensions.height + 0.125F * scaleFactor, 0.0F); | ||
} | ||
|
||
+ // Leaves start - renewable sponges | ||
+ | ||
+ @Override | ||
+ public void thunderHit(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.LightningBolt lightning) { | ||
+ if (top.leavesmc.leaves.LeavesConfig.renewableSponges && !this.isRemoved() && !(this instanceof ElderGuardian)) { | ||
+ ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level()); | ||
+ elderGuardian.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); | ||
+ elderGuardian.finalizeSpawn(world ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), MobSpawnType.CONVERSION, null, null); | ||
+ elderGuardian.setNoAi(this.isNoAi()); | ||
+ | ||
+ if (this.hasCustomName()) { | ||
+ elderGuardian.setCustomName(this.getCustomName()); | ||
+ elderGuardian.setCustomNameVisible(this.isCustomNameVisible()); | ||
+ } | ||
+ | ||
+ this.level().addFreshEntity(elderGuardian); | ||
+ this.discard(); | ||
+ } else { | ||
+ super.thunderHit(world, lightning); | ||
+ } | ||
+ } | ||
+ | ||
+ // Leaves end - renewable sponges | ||
+ | ||
private static class GuardianMoveControl extends MoveControl { | ||
|
||
private final Guardian guardian; |