-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fire LivingConversionEvent Pre and Post properly for Husk, Tadpole, M…
…ooshroom, and Skeleton conversions (#514)
- Loading branch information
1 parent
69d5eb0
commit af78677
Showing
6 changed files
with
52 additions
and
10 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
13 changes: 13 additions & 0 deletions
13
patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch
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,13 @@ | ||
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java | ||
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java | ||
@@ -226,8 +_,10 @@ | ||
private void ageUp() { | ||
Level $$1 = this.level(); | ||
if ($$1 instanceof ServerLevel serverlevel) { | ||
+ if (!net.neoforged.neoforge.event.EventHooks.canLivingConvert(this, EntityType.FROG, (timer) -> {})) return; | ||
Frog frog = EntityType.FROG.create(this.level()); | ||
if (frog != null) { | ||
+ net.neoforged.neoforge.event.EventHooks.onLivingConvert(this, frog); | ||
frog.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); | ||
frog.finalizeSpawn(serverlevel, this.level().getCurrentDifficultyAt(frog.blockPosition()), MobSpawnType.CONVERSION, null, null); | ||
frog.setNoAi(this.isNoAi()); |
10 changes: 10 additions & 0 deletions
10
patches/net/minecraft/world/entity/monster/Husk.java.patch
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,10 @@ | ||
--- a/net/minecraft/world/entity/monster/Husk.java | ||
+++ b/net/minecraft/world/entity/monster/Husk.java | ||
@@ -72,6 +_,7 @@ | ||
|
||
@Override | ||
protected void doUnderWaterConversion() { | ||
+ if (!net.neoforged.neoforge.event.EventHooks.canLivingConvert(this, EntityType.ZOMBIE, (timer) -> this.conversionTime = timer)) return; | ||
this.convertToZombieType(EntityType.ZOMBIE); | ||
if (!this.isSilent()) { | ||
this.level().levelEvent(null, 1041, this.blockPosition(), 0); |
13 changes: 13 additions & 0 deletions
13
patches/net/minecraft/world/entity/monster/Skeleton.java.patch
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,13 @@ | ||
--- a/net/minecraft/world/entity/monster/Skeleton.java | ||
+++ b/net/minecraft/world/entity/monster/Skeleton.java | ||
@@ -86,7 +_,9 @@ | ||
} | ||
|
||
protected void doFreezeConversion() { | ||
- this.convertTo(EntityType.STRAY, true); | ||
+ if (!net.neoforged.neoforge.event.EventHooks.canLivingConvert(this, EntityType.STRAY, (timer) -> this.conversionTime = timer)) return; | ||
+ Stray stray = this.convertTo(EntityType.STRAY, true); | ||
+ if (stray != null) net.neoforged.neoforge.event.EventHooks.onLivingConvert(this, stray); | ||
if (!this.isSilent()) { | ||
this.level().levelEvent(null, 1048, this.blockPosition(), 0); | ||
} |
17 changes: 8 additions & 9 deletions
17
patches/net/minecraft/world/entity/monster/Zombie.java.patch
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