Skip to content

Commit faacdb0

Browse files
committed
Improved curse rendering and command
1 parent 4ad82ff commit faacdb0

12 files changed

Lines changed: 245 additions & 150 deletions

File tree

src/generated/resources/.cache/20f5c98dc0fe2d7a53fc98de5b4a9405da0eaab5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.21.1 2025-08-14T02:08:17.9000088 Biome Modifier Registries: ifw
1+
// 1.21.1 2025-08-14T14:36:59.4074154 Biome Modifier Registries: ifw
22
49f499fed8f8f7c797c3124710dff297dfe03998 data/ifw/neoforge/biome_modifier/ifw_add_deepslate_spawns.json
33
d3ce835cbe615798480c31acf5200397159fd125 data/ifw/neoforge/biome_modifier/ifw_add_deep_ores.json
44
5073fcccdb1b63e1972de71daef79b5d55a8ea59 data/ifw/neoforge/biome_modifier/ifw_add_forest_spawns.json
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// 1.21.1 2025-08-13T02:40:42.2004208 Languages: zh_cn for mod: ifw
2-
219f46162f43ff9a0e2305dc5344e737699569f9 assets/ifw/lang/zh_cn.json
1+
// 1.21.1 2025-08-14T14:36:59.4094454 Languages: zh_cn for mod: ifw
2+
e58157dc84dda3ac65215ad77f1e0d6f1b359a3d assets/ifw/lang/zh_cn.json
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// 1.21.1 2025-08-13T03:09:33.6115343 Languages: en_us for mod: ifw
2-
948ae885f71816d32e804da4f96d555f39f80899 assets/ifw/lang/en_us.json
1+
// 1.21.1 2025-08-14T14:36:59.4112416 Languages: en_us for mod: ifw
2+
f633d82e520e0fb6fa8f214487a3b3d42bb31bcc assets/ifw/lang/en_us.json

src/generated/resources/assets/ifw/lang/en_us.json

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,6 @@
200200
"block.ifw.silver_ore": "Silver Ore",
201201
"block.ifw.silver_private_chest": "Silver Private Chest",
202202
"block.ifw.stone_furnace": "Stone Furnace",
203-
"cannot_drink": "CantDrink",
204-
"cannot_eat_meats": "CantEatAnimals",
205-
"cannot_eat_plants": "CantEatPlants",
206-
"cannot_hold_breath": "CantHoldBreath",
207-
"cannot_open_chests": "CantOpenChests",
208-
"cannot_run": "CantRun",
209-
"cannot_sleep": "CantSleep",
210-
"cannot_wear_armor": "CantWearArmor",
211-
"clumsiness": "Elumsiness",
212203
"commands.clear.curse.player": "Removed curse from %s",
213204
"commands.clear.curse.players": "Removed curse from %s targets",
214205
"commands.day.message": "It is day %s of this world",
@@ -223,11 +214,44 @@
223214
"commands.status.harvesting": "Harvesting: %s",
224215
"commands.status.melee_damage": "Melee Damage: %s",
225216
"container.enchant.experience.requirement": "Experience Requirement: %s",
217+
"curse.ifw.cannot_drink": "Can't Drink",
218+
"curse.ifw.cannot_drink.desc": "You find yourself unable to drink liquids",
219+
"curse.ifw.cannot_eat_meats": "Can't Eat Animals",
220+
"curse.ifw.cannot_eat_meats.desc": "You find yourself unable to eat meat or animal products",
221+
"curse.ifw.cannot_eat_plants": "Can't Eat Plants",
222+
"curse.ifw.cannot_eat_plants.desc": "You find yourself unable to eat seeds and other plant foods",
223+
"curse.ifw.cannot_hold_breath": "Can't Hold Breath",
224+
"curse.ifw.cannot_hold_breath.desc": "You seem unable to hold your breath for very long",
225+
"curse.ifw.cannot_open_chests": "Can't Open Chests",
226+
"curse.ifw.cannot_open_chests.desc": "You find yourself unable to open chests",
227+
"curse.ifw.cannot_run": "Can't Run",
228+
"curse.ifw.cannot_run.desc": "You find that your legs don't obey when you try to run",
229+
"curse.ifw.cannot_sleep": "Can't Sleep",
230+
"curse.ifw.cannot_sleep.desc": "You find yourself unable to sleep at night",
231+
"curse.ifw.cannot_wear_armor": "Can't Wear Armor",
232+
"curse.ifw.cannot_wear_armor.desc": "You find yourself unable to wear armor of any sort",
233+
"curse.ifw.clumsiness": "Clumsiness",
234+
"curse.ifw.clumsiness.desc": "Everything feels clumsy in your hands and crafting is difficult",
235+
"curse.ifw.endermen_aggro": "Endermen Enemy",
236+
"curse.ifw.endermen_aggro.desc": "Endermen seem to have taken a strong disliking to you",
237+
"curse.ifw.entanglement": "Entanglement",
238+
"curse.ifw.entanglement.desc": "You find yourself having great difficulty moving through vines and other plants",
239+
"curse.ifw.equipment_decays_faster": "Equipment Decay",
240+
"curse.ifw.equipment_decays_faster.desc": "Your equipment is wearing out faster than usual",
241+
"curse.ifw.fear_of_creepers": "Fear of Creepers",
242+
"curse.ifw.fear_of_creepers.desc": "You've become fearful of creepers and have difficulty striking them in melee combat",
243+
"curse.ifw.fear_of_spiders": "Fear of Spiders",
244+
"curse.ifw.fear_of_spiders.desc": "You've become fearful of spiders and have difficulty striking them in melee combat",
245+
"curse.ifw.fear_of_undead": "Fear of Undead",
246+
"curse.ifw.fear_of_undead.desc": "You've become fearful of undead and have difficulty striking them in melee combat",
247+
"curse.ifw.fear_of_wolves": "Fear of Wolves",
248+
"curse.ifw.fear_of_wolves.desc": "You've become fearful of wolves and have difficulty striking them in melee combat",
249+
"curse.ifw.none": "Empty",
250+
"curse.ifw.none.desc": "You are not cursed",
251+
"curse.ifw.unknown.desc": "You have been cursed, but its nature is currently unknown.",
226252
"effect.ifw.insulin_resistance": "Insulin Resistance",
227-
"effect.ifw.unkonwn.curse": "You have been cursed",
253+
"effect.ifw.unkonwn.curse": "Unknown Curse",
228254
"enchantment.ifw.speed": "Speed",
229-
"endermen_aggro": "EndermenEnemy",
230-
"entanglement": "Entanglement",
231255
"entity.ifw.ancient_bone_lord": "Ancient Bone Lord",
232256
"entity.ifw.black_widow_spider": "Black Widow Spider",
233257
"entity.ifw.blob": "Blob",
@@ -257,17 +281,12 @@
257281
"entity.ifw.wight": "Wight",
258282
"entity.ifw.wood_spider": "Wood Spider",
259283
"entity.ifw.zombie": "Zombie",
260-
"equipment_decays_faster": "EquipmentDecay",
261-
"fear_of_creepers": "FearOfCreepers",
262-
"fear_of_spiders": "FearOfSpiders",
263-
"fear_of_undead": "FearOfUndead",
264-
"fear_of_wolves": "FearOfWolves",
265284
"foodtips.insulinresponse": "+%s Insulin Response",
266285
"foodtips.nutrition": "+%s Food Value",
267286
"foodtips.phytonutrients": "+%s Phytonutrients Value",
268287
"foodtips.protein": "+%s Protein Value",
269288
"foodtips.saturation": "+%s Saturation Value",
270-
"ifw.witch_curse.curse": "You have been cursed",
289+
"ifw.witch_curse.curse": "You have been cursed!",
271290
"ifw.witch_curse.discurse": "The curse has gone",
272291
"item.ifw.adamantium_axe": "Adamantium Axe",
273292
"item.ifw.adamantium_battle_axe": "Adamantium Battle Axe",
@@ -604,7 +623,6 @@
604623
"itemGroup.ifw.entity": "IFW| Spawn Eggs",
605624
"itemGroup.ifw.item": "IFW| Item",
606625
"itemGroup.ifw.tool": "IFW| Tool",
607-
"none": "Empty",
608626
"tooltip.infinity.armor_penetration": "Ignores 3 armor against skeletons",
609627
"tooltip.infinity.effective_against_skeletons": "+50% Damage Against Skeletons",
610628
"tooltip.infinity.gem.xp": "+%s Experience Value",

src/generated/resources/assets/ifw/lang/zh_cn.json

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,6 @@
200200
"block.ifw.silver_ore": "银矿石",
201201
"block.ifw.silver_private_chest": "银保险箱",
202202
"block.ifw.stone_furnace": "石制熔炉",
203-
"cannot_drink": "汤煲厌食",
204-
"cannot_eat_meats": "肉奶厌食",
205-
"cannot_eat_plants": "蔬果厌食",
206-
"cannot_hold_breath": "呼吸困难",
207-
"cannot_open_chests": "柜子动了",
208-
"cannot_run": "腿脚僵硬",
209-
"cannot_sleep": "失眠症",
210-
"cannot_wear_armor": "盔甲排斥",
211-
"clumsiness": "智力下降",
212203
"commands.clear.curse.player": "已为 %s 清除诅咒",
213204
"commands.clear.curse.players": "已为个 %s 玩家清除诅咒",
214205
"commands.day.message": "今天是第 %s 天",
@@ -223,11 +214,44 @@
223214
"commands.status.harvesting": "采集速度: %s",
224215
"commands.status.melee_damage": "近战伤害: %s",
225216
"container.enchant.experience.requirement": "经验需要: %s",
217+
"curse.ifw.cannot_drink": "汤煲厌食",
218+
"curse.ifw.cannot_drink.desc": "你发现你不能饮用任何汤、煲类食物",
219+
"curse.ifw.cannot_eat_meats": "肉奶厌食",
220+
"curse.ifw.cannot_eat_meats.desc": "你发现你不能食用任何动物制品",
221+
"curse.ifw.cannot_eat_plants": "蔬果厌食",
222+
"curse.ifw.cannot_eat_plants.desc": "你发现你不能食用任何植物制品",
223+
"curse.ifw.cannot_hold_breath": "呼吸困难",
224+
"curse.ifw.cannot_hold_breath.desc": "你发现你不能屏息很长时间",
225+
"curse.ifw.cannot_open_chests": "柜子动了",
226+
"curse.ifw.cannot_open_chests.desc": "你发现你无法打开箱子(我柜子怎么动了)",
227+
"curse.ifw.cannot_run": "腿脚僵硬",
228+
"curse.ifw.cannot_run.desc": "你发现你不能疾跑",
229+
"curse.ifw.cannot_sleep": "失眠症",
230+
"curse.ifw.cannot_sleep.desc": "你发现你在晚上无法入睡",
231+
"curse.ifw.cannot_wear_armor": "盔甲排斥",
232+
"curse.ifw.cannot_wear_armor.desc": "你发现你不能穿着盔甲",
233+
"curse.ifw.clumsiness": "智力下降",
234+
"curse.ifw.clumsiness.desc": "你发现制作物品变得十分困难",
235+
"curse.ifw.endermen_aggro": "末影仇恨",
236+
"curse.ifw.endermen_aggro.desc": "你发现末影人总是对你无缘无故地发起攻击",
237+
"curse.ifw.entanglement": "植物缠绕",
238+
"curse.ifw.entanglement.desc": "你发现你很难穿越草、藤蔓等植物",
239+
"curse.ifw.equipment_decays_faster": "腐蚀性皮肤",
240+
"curse.ifw.equipment_decays_faster.desc": "你发现你的装备、武器与工具的耐久度下降得更快",
241+
"curse.ifw.fear_of_creepers": "苦力怕恐惧",
242+
"curse.ifw.fear_of_creepers.desc": "你发现你难以对苦力怕发起有效攻击",
243+
"curse.ifw.fear_of_spiders": "蜘蛛恐惧",
244+
"curse.ifw.fear_of_spiders.desc": "你发现你难以对蜘蛛发起有效攻击",
245+
"curse.ifw.fear_of_undead": "亡灵生物恐惧",
246+
"curse.ifw.fear_of_undead.desc": "你发现你难以对亡灵生物发起有效攻击",
247+
"curse.ifw.fear_of_wolves": "恶狼恐惧",
248+
"curse.ifw.fear_of_wolves.desc": "你发现你难以对狼发起有效攻击",
249+
"curse.ifw.none": "无诅咒",
250+
"curse.ifw.none.desc": "你没有被诅咒",
251+
"curse.ifw.unknown.desc": "你被诅咒了,但诅咒效果未知.",
226252
"effect.ifw.insulin_resistance": "胰岛素抵抗",
227-
"effect.ifw.unkonwn.curse": "你已经被诅咒了!",
253+
"effect.ifw.unkonwn.curse": "未知诅咒",
228254
"enchantment.ifw.speed": "速度",
229-
"endermen_aggro": "末影仇恨",
230-
"entanglement": "植物缠绕",
231255
"entity.ifw.ancient_bone_lord": "远古亡骸领主",
232256
"entity.ifw.black_widow_spider": "黑寡妇蜘蛛",
233257
"entity.ifw.blob": "泡泡怪",
@@ -257,17 +281,12 @@
257281
"entity.ifw.wight": "尸妖",
258282
"entity.ifw.wood_spider": "木蜘蛛",
259283
"entity.ifw.zombie": "僵尸",
260-
"equipment_decays_faster": "腐蚀性皮肤",
261-
"fear_of_creepers": "苦力怕恐惧",
262-
"fear_of_spiders": "蜘蛛恐惧",
263-
"fear_of_undead": "亡灵生物恐惧",
264-
"fear_of_wolves": "恶狼恐惧",
265284
"foodtips.insulinresponse": "+%s 胰岛素反应",
266285
"foodtips.nutrition": "+%s 饥饿值",
267286
"foodtips.phytonutrients": "+%s 植物营养素",
268287
"foodtips.protein": "+%s 蛋白质",
269288
"foodtips.saturation": "+%s 饱和度",
270-
"ifw.witch_curse.curse": "你已经被诅咒",
289+
"ifw.witch_curse.curse": "你已经被诅咒了!",
271290
"ifw.witch_curse.discurse": "诅咒消逝",
272291
"item.ifw.adamantium_axe": "艾德曼斧",
273292
"item.ifw.adamantium_battle_axe": "艾德曼战斧",
@@ -604,7 +623,6 @@
604623
"itemGroup.ifw.entity": "IFW| 刷怪蛋",
605624
"itemGroup.ifw.item": "IFW| 物品",
606625
"itemGroup.ifw.tool": "IFW| 工具",
607-
"none": "无诅咒",
608626
"tooltip.infinity.armor_penetration": "无视骷髅3点护甲值",
609627
"tooltip.infinity.effective_against_skeletons": "对骷髅类生物+50%伤害",
610628
"tooltip.infinity.gem.xp": "+%s 玩家经验",

src/main/java/huix/infinity/attachment/IFWAttachments.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ public class IFWAttachments {
4242
"is_panic", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()
4343
);
4444

45-
4645
public static final Supplier<AttachmentType<Integer>> player_curse = ATTACHMENT_TYPES.register(
4746
"player_curse", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).copyOnDeath().build()
4847
);
49-
public static final Supplier<AttachmentType<Boolean>> learned_curse = ATTACHMENT_TYPES.register(
50-
"learned_curse", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).copyOnDeath().build()
51-
);
5248

53-
}
49+
// 修正:用于“未知诅咒”机制
50+
// changed from 'learned_curse' (bool) to 'player_curse_known' (bool) for consistent naming
51+
public static final Supplier<AttachmentType<Boolean>> player_curse_known = ATTACHMENT_TYPES.register(
52+
"player_curse_known", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).copyOnDeath().build()
53+
);
54+
}
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package huix.infinity.common.command;
22

3+
import huix.infinity.attachment.IFWAttachments;
34
import huix.infinity.common.world.curse.CurseType;
45
import net.minecraft.commands.CommandSourceStack;
56
import net.minecraft.network.chat.Component;
@@ -9,26 +10,33 @@
910
import java.util.Collection;
1011

1112
public class CommandHandler {
12-
13+
/**
14+
* 给予玩家指定诅咒,并设置识别状态为未识别
15+
*/
1316
public static int giveCurse(CommandSourceStack stack, CurseType curse, Collection<? extends Entity> entities) {
1417
for (Entity entity : entities) {
1518
if (entity instanceof Player player) {
16-
if (entities.size() == 1) stack.sendSuccess(() -> Component.translatable("commands.give.curse.player", curse.name(), entities.iterator().next().getDisplayName()), true);
19+
if (entities.size() == 1) stack.sendSuccess(() -> Component.translatable("commands.give.curse.player", curse.name(), entity.getDisplayName()), true);
1720
else stack.sendSuccess(() -> Component.translatable("commands.give.curse.players", curse.name(), entities.size()), true);
1821
player.setCurse(curse);
22+
player.setData(IFWAttachments.player_curse_known, false); // 给予时重置识别状态
1923
}
2024
}
2125
return entities.size();
2226
}
2327

28+
/**
29+
* 清除玩家诅咒
30+
*/
2431
public static int clearCurse(CommandSourceStack stack, Collection<? extends Entity> entities) {
2532
for (Entity entity : entities) {
2633
if (entity instanceof Player player) {
27-
if (entities.size() == 1) stack.sendSuccess(() -> Component.translatable("commands.clear.curse.player", entities.iterator().next().getDisplayName()), true);
34+
if (entities.size() == 1) stack.sendSuccess(() -> Component.translatable("commands.clear.curse.player", entity.getDisplayName()), true);
2835
else stack.sendSuccess(() -> Component.translatable("commands.clear.curse.players", entities.size()), true);
2936
player.setCurse(CurseType.none);
37+
// 不需要重置 player_curse_known
3038
}
3139
}
3240
return entities.size();
3341
}
34-
}
42+
}

src/main/java/huix/infinity/common/command/arguments/CurseArgument.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import com.mojang.brigadier.context.CommandContext;
66
import com.mojang.brigadier.exceptions.CommandSyntaxException;
77
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
8+
import com.mojang.brigadier.suggestion.Suggestions;
9+
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
810
import huix.infinity.common.world.curse.CurseType;
911
import net.minecraft.commands.CommandSourceStack;
1012
import net.minecraft.network.chat.Component;
1113

1214
import java.util.Arrays;
1315
import java.util.Collection;
14-
import java.util.function.Supplier;
15-
16+
import java.util.concurrent.CompletableFuture;
1617

1718
public class CurseArgument implements ArgumentType<CurseType> {
1819

@@ -37,9 +38,17 @@ public static CurseArgument curse() {
3738
return new CurseArgument();
3839
}
3940

40-
4141
@Override
4242
public Collection<String> getExamples() {
4343
return Arrays.asList("equipment_decays_faster", "cannot_hold_breath");
4444
}
45-
}
45+
@Override
46+
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
47+
for (CurseType type : CurseType.values()) {
48+
if (type != CurseType.none) {
49+
builder.suggest(type.name());
50+
}
51+
}
52+
return builder.buildFuture();
53+
}
54+
}

0 commit comments

Comments
 (0)