Skip to content

Commit 281f7ba

Browse files
committed
✨ 添加对恶魂爆炸伤害源修复规则
(cherry picked from commit 20ef3b4)
1 parent 4130043 commit 281f7ba

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed

src/main/java/club/mcams/carpet/AmsServerSettings.java

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ public class AmsServerSettings {
152152
@Rule(categories = {AMS, FEATURE, SURVIVAL, EXPERIMENTAL})
153153
public static boolean amsUpdateSuppressionCrashFix = false;
154154

155+
@Rule(categories = {AMS, FEATURE, SURVIVAL, EXPERIMENTAL})
156+
public static boolean ghastFireballExplosionDamageSourceFix = false;
157+
155158
@Rule(categories = {AMS, FEATURE, SURVIVAL})
156159
public static boolean cakeBlockDropOnBreak = false;
157160

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* This file is part of the Carpet AMS Addition project, licensed under the
3+
* GNU Lesser General Public License v3.0
4+
*
5+
* Copyright (C) 2024 A Minecraft Server and contributors
6+
*
7+
* Carpet AMS 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 AMS 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 AMS Addition. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
package club.mcams.carpet.mixin.rule.ghastFireballExplosionDamageSourceFix;
22+
23+
import club.mcams.carpet.AmsServerSettings;
24+
import net.minecraft.entity.Entity;
25+
import net.minecraft.entity.projectile.FireballEntity;
26+
import org.jetbrains.annotations.Nullable;
27+
import org.spongepowered.asm.mixin.Mixin;
28+
import org.spongepowered.asm.mixin.injection.At;
29+
import org.spongepowered.asm.mixin.injection.ModifyArg;
30+
31+
//For version <1.19.3
32+
@Mixin(FireballEntity.class)
33+
public class FireballEntityMixin {
34+
//#if MC<11903
35+
@ModifyArg(
36+
method="Lnet/minecraft/entity/projectile/FireballEntity;onCollision(Lnet/minecraft/util/hit/HitResult;)V",
37+
at=@At(
38+
value="INVOKE",
39+
target = "Lnet/minecraft/world/World;createExplosion(Lnet/minecraft/entity/Entity;DDDFZLnet/minecraft/world/explosion/Explosion$DestructionType;)Lnet/minecraft/world/explosion/Explosion;"
40+
),
41+
index=0
42+
)
43+
public Entity fillUpExplosionOwner(@Nullable Entity entity) {
44+
if(AmsServerSettings.ghastFireballExplosionDamageSourceFix) {
45+
return (FireballEntity) (Object) this;
46+
}
47+
else {
48+
return entity;
49+
}
50+
}
51+
52+
//#endif
53+
}

src/main/resources/amscarpet.mixins.json

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"rule.fancyFakePlayerName.PlayerManagerMixin",
4545
"rule.fasterMovement.PlayerEntityMixin",
4646
"rule.flippinCactusSoundEffect.BlockRotatorMixin",
47+
"rule.ghastFireballExplosionDamageSourceFix.FireballEntityMixin",
4748
"rule.hopperSuctionDisabled.HopperBlockEntityMixin",
4849
"rule.infiniteTrades.TradeOfferMixin",
4950
"rule.keepWorldTickUpdate.ServerWorldMixin",

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

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ carpetamsaddition:
137137
extra:
138138
'0': 'Use the following command to control whether it is forcibly enabled when "customBlockUpdateSuppressor" is enabled, with a permission level of 2:'
139139
'1': '/amsUpdateSuppressionCrashFixForceMode true/false'
140+
ghastFireballExplosionDamageSourceFix:
141+
desc: Fix MC-193297 that the large fireball does not create explosion with correct damage source
140142
cakeBlockDropOnBreak:
141143
desc: When the cake is destroyed, it can drop cake (the cake will only drop when it is intact)
142144
noCakeEating:

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

+3
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ carpetamsaddition:
169169
extra:
170170
'0': '使用如下指令来控制其是否在"customBlockUpdateSuppressor"开启时强制启动,权限等级为2:'
171171
'1': '/amsUpdateSuppressionCrashFixForceMode true/false'
172+
ghastFireballExplosionDamageSourceFix:
173+
name: 恶魂火球爆炸伤害源修复
174+
desc: 修复MC-193297中,恶魂火球爆炸时不会正确传递伤害源
172175
cakeBlockDropOnBreak:
173176
name: 可掉落蛋糕
174177
desc: 蛋糕在被破坏时可以掉落蛋糕(蛋糕是完整的情况下才会掉落)

0 commit comments

Comments
 (0)