Skip to content

Commit a1664ce

Browse files
committed
Add rule leaderZombieSpawnWithMaxHealthDisabled
resolve #268
1 parent 8673d95 commit a1664ce

8 files changed

Lines changed: 119 additions & 0 deletions

File tree

src/main/java/carpettisaddition/CarpetTISAdditionSettings.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ public ValidateHUDLoggerUpdateInterval()
358358
@Rule(categories = {TIS, FEATURE, EXPERIMENTAL})
359359
public static boolean largeBarrel = false;
360360

361+
//#if MC >= 26.1
362+
//$$ @Rule(categories = {TIS, PORTING})
363+
//$$ public static boolean leaderZombieSpawnWithMaxHealthDisabled = false;
364+
//#endif
365+
361366
@Rule(categories = {TIS, CREATIVE})
362367
public static boolean lifeTimeTrackerConsidersMobcap = true;
363368

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* This file is part of the Carpet TIS Addition project, licensed under the
3+
* GNU Lesser General Public License v3.0
4+
*
5+
* Copyright (C) 2026 Fallen_Breath and contributors
6+
*
7+
* Carpet TIS Addition is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Lesser General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* Carpet TIS Addition is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public License
18+
* along with Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
package carpettisaddition.mixins.rule.leaderZombieSpawnWithMaxHealthDisabled;
22+
23+
import carpettisaddition.utils.compat.DummyClass;
24+
import org.spongepowered.asm.mixin.Mixin;
25+
26+
@Mixin(DummyClass.class)
27+
public abstract class ZombieEntityMixin
28+
{
29+
// impl in mc26.1+
30+
}
31+

src/main/resources/assets/carpettisaddition/lang/en_us.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,11 @@ carpettisaddition:
11651165
extra:
11661166
'0': Two adjacent barrel blocks with their bottom side facing towards each other create a large barrel
11671167
'1': The behavior and logic of large barrel is just like large chest
1168+
leaderZombieSpawnWithMaxHealthDisabled:
1169+
name: leaderZombieSpawnWithMaxHealthDisabled
1170+
desc: When enabled, leader zombies will spawn with default health (20) instead of their boosted max health
1171+
extra:
1172+
'0': It reverts the behavior back to mc < 26.1, where leader zombies had a high max health but still spawned with 20 HP
11681173
lifeTimeTrackerConsidersMobcap:
11691174
name: lifeTimeTrackerConsidersMobcap
11701175
desc: Strategy for lifetime tracker to deal with mob that doesn't count towards mobcap

src/main/resources/assets/carpettisaddition/lang/zh_cn.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,11 @@ carpettisaddition:
11651165
extra:
11661166
'0': 两个相邻的底部相连木桶可以组成一个大木桶
11671167
'1': 大木桶的行为逻辑跟大箱子相近
1168+
leaderZombieSpawnWithMaxHealthDisabled:
1169+
name: 禁用领头僵尸以最大生命值生成
1170+
desc: 开启后,领头僵尸将以默认生命值(20)生成,而非被增加的最大生命值
1171+
extra:
1172+
'0': 它将相关表现还原回了 MC < 26.1 的表现,即领头僵尸虽然最大生命值很高,但生成时的血量仍为默认的 20
11681173
lifeTimeTrackerConsidersMobcap:
11691174
name: 存活时间追踪器考虑怪物容量
11701175
desc: 存活时间追踪器对不占怪物容量的生物的策略

src/main/resources/carpet-tis-addition.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@
427427
"rule.largeBarrel.compat.malilib.IInventoryOverlayHandlerMixin",
428428
"rule.largeBarrel.compat.malilib.InventoryUtilsMixin",
429429
"rule.largeBarrel.compat.minihud.EntitiesDataManagerMixin",
430+
"rule.leaderZombieSpawnWithMaxHealthDisabled.ZombieEntityMixin",
430431
"rule.lightEngineMaxBatchSize.MinecraftServerMixin",
431432
"rule.lightEngineMaxBatchSize.ServerLightingProviderMixin",
432433
"rule.lightUpdates.ServerLightingProviderMixin",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* This file is part of the Carpet TIS Addition project, licensed under the
3+
* GNU Lesser General Public License v3.0
4+
*
5+
* Copyright (C) 2026 Fallen_Breath and contributors
6+
*
7+
* Carpet TIS Addition is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Lesser General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* Carpet TIS Addition is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public License
18+
* along with Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
package carpettisaddition.mixins.rule.leaderZombieSpawnWithMaxHealthDisabled;
22+
23+
import carpettisaddition.CarpetTISAdditionSettings;
24+
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
25+
import net.minecraft.world.entity.monster.zombie.Zombie;
26+
import org.spongepowered.asm.mixin.Mixin;
27+
import org.spongepowered.asm.mixin.injection.At;
28+
29+
@Mixin(Zombie.class)
30+
public abstract class ZombieEntityMixin
31+
{
32+
@WrapWithCondition(
33+
method = "handleAttributes",
34+
at = @At(
35+
value = "INVOKE",
36+
target = "Lnet/minecraft/world/entity/monster/zombie/Zombie;setHealth(F)V"
37+
)
38+
)
39+
private boolean leaderZombieSpawnWithMaxHealthDisabled_skipSetHealthToMax(Zombie instance, float health)
40+
{
41+
return !CarpetTISAdditionSettings.leaderZombieSpawnWithMaxHealthDisabled;
42+
}
43+
}
44+

website/docs/rules.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,20 @@ The behavior and logic of large barrel is just like large chest
859859
- Categories: `TIS`, `FEATURE`, `EXPERIMENTAL`
860860

861861

862+
## leaderZombieSpawnWithMaxHealthDisabled
863+
864+
**Minecraft >= 26.1 only**
865+
866+
When enabled, leader zombies will spawn with default health (20) instead of their boosted max health
867+
868+
It reverts the behavior back to mc < 26.1, where leader zombies had a high max health but still spawned with 20 HP
869+
870+
- Type: `boolean`
871+
- Default value: `false`
872+
- Suggested options: `false`, `true`
873+
- Categories: `TIS`, `PORTING`
874+
875+
862876
## lifeTimeTrackerConsidersMobcap
863877

864878
Strategy for lifetime tracker to deal with mob that doesn't count towards mobcap

website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/rules.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,20 @@ sidebar_position: 1
843843
- 分类: `TIS`, `FEATURE`, `EXPERIMENTAL`
844844

845845

846+
## 禁用领头僵尸以最大生命值生成 (leaderZombieSpawnWithMaxHealthDisabled)
847+
848+
**本规则仅在 Minecraft >= 26.1 中存在**
849+
850+
开启后,领头僵尸将以默认生命值(20)生成,而非被增加的最大生命值
851+
852+
它将相关表现还原回了 MC < 26.1 的表现,即领头僵尸虽然最大生命值很高,但生成时的血量仍为默认的 20
853+
854+
- 类型: `boolean`
855+
- 默认值: `false`
856+
- 参考选项: `false`, `true`
857+
- 分类: `TIS`, `PORTING`
858+
859+
846860
## 存活时间追踪器考虑怪物容量 (lifeTimeTrackerConsidersMobcap)
847861

848862
存活时间追踪器对不占怪物容量的生物的策略

0 commit comments

Comments
 (0)