diff --git a/readme_folder/en_us/rules_en.md b/readme_folder/en_us/rules_en.md index 8b5f218d..ac0976e4 100644 --- a/readme_folder/en_us/rules_en.md +++ b/readme_folder/en_us/rules_en.md @@ -427,6 +427,15 @@ When enabled, Update suppression does not cause the server to crash. - Categroies: `AMS` , `FEATURE` , `SURVIVAL` , `EXPERIMENTAL` +## easyWitherSkeletonSkullDrop + +When enabled, 100% Wither Skeleton Skull Drop. + +- Type: `boolean` +- Default: `false` +- Suggested options: `false` , `true` +- Categroies: `AMS` , `FEATURE` , `SURVIVAL` + ## movableEnderChest diff --git a/readme_folder/rules_cn.md b/readme_folder/rules_cn.md index 055980d0..f896a211 100644 --- a/readme_folder/rules_cn.md +++ b/readme_folder/rules_cn.md @@ -445,6 +445,16 @@ - 分类: `AMS` , `FEATURE` , `SURVIVAL` , `EXPERIMENTAL` +## 轻松掉落凋零骷髅头 (easyWitherSkeletonSkullDrop) + +开启后,击杀凋零骷髅会百分百掉落凋零骷髅头。 + +- 类型: `boolean` +- 默认值: `false` +- 参考选项: `false` , `true` +- 分类: `AMS` , `FEATURE` , `SURVIVAL` + + ## 可移动末地传送门框架(movableEndPortalFrame) 开启后,末地传送门框架可以被活塞/黏性活塞推动。 diff --git a/src/main/java/club/mcams/carpet/AmsServerSettings.java b/src/main/java/club/mcams/carpet/AmsServerSettings.java index af427eda..7cd7feb4 100644 --- a/src/main/java/club/mcams/carpet/AmsServerSettings.java +++ b/src/main/java/club/mcams/carpet/AmsServerSettings.java @@ -178,6 +178,9 @@ public class AmsServerSettings { public static boolean amsUpdateSuppressionCrashFix = false; //#endif + @Rule(categories = {AMS, FEATURE, SURVIVAL}) + public static boolean easyWitherSkeletonSkullDrop = false; + /** * 可移动方块规则 */ diff --git a/src/main/java/club/mcams/carpet/mixin/rule/easyWitherSkeletonSkullDrop/WitherSkeletonEntityMixin.java b/src/main/java/club/mcams/carpet/mixin/rule/easyWitherSkeletonSkullDrop/WitherSkeletonEntityMixin.java new file mode 100644 index 00000000..6e0d1d97 --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/rule/easyWitherSkeletonSkullDrop/WitherSkeletonEntityMixin.java @@ -0,0 +1,50 @@ +/* + * This file is part of the Carpet AMS Addition project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 A Minecraft Server and contributors + * + * Carpet AMS Addition is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Carpet AMS Addition is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Carpet AMS Addition. If not, see . + */ + +package club.mcams.carpet.mixin.rule.easyWitherSkeletonSkullDrop; + +import club.mcams.carpet.AmsServerSettings; + +import net.minecraft.entity.EntityType; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.mob.AbstractSkeletonEntity; +import net.minecraft.entity.mob.WitherSkeletonEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.world.World; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(WitherSkeletonEntity.class) +public abstract class WitherSkeletonEntityMixin extends AbstractSkeletonEntity { + protected WitherSkeletonEntityMixin(EntityType entityType, World world) { + super(entityType, world); + } + @Inject(method = "dropEquipment", at = @At("TAIL"), cancellable = true) + private void dropEquipment(DamageSource source, int lootingMultiplier, boolean allowDrops, CallbackInfo ci) { + if (AmsServerSettings.easyWitherSkeletonSkullDrop && allowDrops) { + this.dropStack(new ItemStack(Items.WITHER_SKELETON_SKULL)); + ci.cancel(); + } + } +} diff --git a/src/main/resources/amscarpet.mixins.json b/src/main/resources/amscarpet.mixins.json index f74d1a16..a3b46380 100644 --- a/src/main/resources/amscarpet.mixins.json +++ b/src/main/resources/amscarpet.mixins.json @@ -21,6 +21,7 @@ "rule.creativeOneHitKill.EntityAccessorMixin", "rule.creativeOneHitKill.PlayerEntityMixin", "rule.creativeShulkerBoxDropsDisabled.ShulkerBoxBlockMixin", + "rule.easyWitherSkeletonSkullDrop.WitherSkeletonEntityMixin", "rule.enderManTeleportRandomlyDisabled.EndermanEntityMixin", "rule.extinguishedCampfire_campfireSmokeParticleDisabled.GetPlacementStateMixin", "rule.fakePeace.AbstractBlockStateMixin", diff --git a/src/main/resources/assets/carpetamsaddition/lang/en_us.yml b/src/main/resources/assets/carpetamsaddition/lang/en_us.yml index 5556b572..228d3861 100644 --- a/src/main/resources/assets/carpetamsaddition/lang/en_us.yml +++ b/src/main/resources/assets/carpetamsaddition/lang/en_us.yml @@ -123,6 +123,9 @@ carpetamsaddition: amsUpdateSuppressionCrashFix: name: amsUpdateSuppressionCrashFix desc: Fixes updates suppression causing server crashes + easyWitherSkeletonSkullDrop: + name: easyWitherSkeletonSkullDrop + desc: 100% Wither Skeleton Skull Drop # 计划刻催熟规则: scheduledRandomTickCactus: diff --git a/src/main/resources/assets/carpetamsaddition/lang/zh_cn.yml b/src/main/resources/assets/carpetamsaddition/lang/zh_cn.yml index 58fdc1cf..eff2152b 100644 --- a/src/main/resources/assets/carpetamsaddition/lang/zh_cn.yml +++ b/src/main/resources/assets/carpetamsaddition/lang/zh_cn.yml @@ -123,6 +123,9 @@ carpetamsaddition: amsUpdateSuppressionCrashFix: name: 更新抑制崩溃修复 desc: 防止更新抑制导致服务器崩溃 + easyWitherSkeletonSkullDrop: + name: 轻松掉落凋零骷髅头 + desc: 击杀凋零骷髅会百分百掉落凋零骷髅头 # 计划刻催熟规则: scheduledRandomTickCactus: