Skip to content

Commit d86d291

Browse files
committed
Add rule mobSpawnWithArmorDiamondOverrideChance
1 parent ecce2a2 commit d86d291

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

patches/net/minecraft/entity/EntityLiving.java.patch

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,16 @@
103103
{
104104
ItemStack itemstack = this.getItemStackFromSlot(entityequipmentslot);
105105
float f = this.getDropChance(entityequipmentslot);
106-
@@ -973,7 +1005,8 @@
106+
@@ -971,9 +1003,16 @@
107+
++i;
108+
}
107109

110+
+ // TISCM mobSpawnWithArmorDiamondOverrideChance
111+
+ if (CarpetSettings.mobSpawnWithArmorDiamondOverrideChance > 0 && this.rand.nextFloat() < CarpetSettings.mobSpawnWithArmorDiamondOverrideChance)
112+
+ {
113+
+ i = 4;
114+
+ }
115+
+
108116
boolean flag = true;
109117

110118
- for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values())
@@ -113,7 +121,7 @@
113121
{
114122
if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.ARMOR)
115123
{
116-
@@ -1136,7 +1169,8 @@
124+
@@ -1136,7 +1175,8 @@
117125
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItemMainhand(), (int)(5.0F + f * (float)this.rand.nextInt(18)), false));
118126
}
119127

@@ -123,7 +131,7 @@
123131
{
124132
if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.ARMOR)
125133
{
126-
@@ -1174,6 +1208,9 @@
134+
@@ -1174,6 +1214,9 @@
127135

128136
public void enablePersistence()
129137
{
@@ -133,7 +141,7 @@
133141
this.persistenceRequired = true;
134142
}
135143

136-
@@ -1447,10 +1484,16 @@
144+
@@ -1447,10 +1490,16 @@
137145
float f = (float)this.getAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getValue();
138146
int i = 0;
139147

src/main/java/carpet/settings/CarpetSettings.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,16 @@ public String validate(CommandSource source, ParsedRule<String> currentRule, Str
961961
)
962962
public static boolean blockStateParserFutureVersionInputCompact;
963963

964+
@Rule(
965+
desc = "If enabled, if a mob spawns with armor, there's the given chance to override the armor type to diamond",
966+
extra = {
967+
"If set to 1, the mob will always spawn with diamond armor if it spawns with armor",
968+
"Set it to <=0 to disable this rule",
969+
},
970+
category = {CREATIVE},
971+
options = {"-1", "0.5", "1"}
972+
)
973+
public static double mobSpawnWithArmorDiamondOverrideChance = -1;
964974

965975
// /$$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$
966976
//|__ $$__/|_ $$_/ /$$__ $$ /$$__ $$| $$$ /$$$

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ rule:
217217
extra:
218218
'0': 将其设为0以让矿车忽略速度,像船一样总能将附件实体载上车
219219
'1': 将其设为NaN以让矿车永远不能把实体载上车
220+
mobSpawnWithArmorDiamondOverrideChance:
221+
name: 怪物装备钻石化几率
222+
desc: 启用时,若怪物刷新上带有盔甲,那么会有给定概率把其盔甲材质覆盖为钻石
223+
extra:
224+
'0': 若其值为1,则怪物若刷新时带有盔甲,则盔甲一定是钻石材质
225+
'1': 将其值设置为<=0以禁用该规则
220226
opPlayerNoCheat:
221227
name: op玩家不准作弊
222228
desc: 禁用部分指令以避免op玩家意外地作弊

0 commit comments

Comments
 (0)