灵魂之剑
基本信息
| 属性 | 值 |
|---|---|
| 注册名 | RandomThings:spectreSword |
| 类 | lumien.randomthings.Items.ItemSpectreSword(继承原版 ItemSword) |
| 工具材质 | ItemSpectreSword.spectreToolMaterial(ItemSpectreSword.java:21-22) |
| 注册方式 | 构造函数内直接 GameRegistry.registerItem(this, "spectreSword")(:32) |
| 开关 | Items.SpectreSword(RTConfiguration.java:224) |
功能
灵魂之剑是本 mod 的灵魂掉落来源:击杀生物有几率掉落灵魂,灵魂是制作整套灵魂系列内容的材料。
命中减速
hitEntity 给目标施加 2 级缓慢 40 tick(ItemSpectreSword.java:35-40):
hitEntity.addPotionEffect(new PotionEffect(PotionEffects.SLOWNESS, 40, 2, false));
参数为 (效果, 持续 40 tick, 等级 2, 不显示粒子)。
提示文本
addInformation 用 Colors.AQUA 着色添加 text.spectre.soulSolid(ItemSpectreSword.java:42-45),中文为「灵魂实体」(zh_CN.lang:136)。
数值
工具材质(ItemSpectreSword.java:21-22):
public static final Item.ToolMaterial spectreToolMaterial = EnumHelper
.addToolMaterial("Spectre", 3, 1700, 8.2f, 4f, 16);
| 数值名 | 值 | 含义 |
|---|---|---|
| harvestingLevel | 3 | 采集等级 |
| durability | 1700 | 最大耐久 |
| damage | 8.2f | 攻击伤害 |
| attackSpeed | 4.0f | 攻击速度 |
| enchantability | 16 | 附魔能力 |
| 命中减速 | 缓慢 II / 40 tick | hitEntity |
交互
| 触发 | 行为 |
|---|---|
| 攻击生物 | 造成 8.2 伤害 + 施加缓慢 II(40 tick) |
| 击杀生物 | 按 SpiritChance 掉落灵魂(见下) |
| 附魔 | 附魔能力 16 |
灵魂掉落概率
RTEventHandler 的死亡事件处理器按概率生成灵魂。完整条件(Handler/RTEventHandler.java:527-546):
if (ConfigItems.spectreArmor || ConfigItems.spectreKey || ConfigItems.spectreSword) {
if (event.source.getEntity() != null && !(event.source.getEntity() instanceof FakePlayer)
&& event.source.getEntity() instanceof EntityPlayer
&& !(event.entity instanceof EntitySpirit)) {
double chance = Settings.SPIRIT_CHANCE;
if (ConfigItems.spectreSword && player.getCurrentEquippedItem() != null
&& player.getCurrentEquippedItem().getItem() == ModItems.spectreSword) {
chance = Settings.SPIRIT_CHANCE_SWORD;
}
if (Math.random() <= chance) { /* 生成 EntitySpirit */ }
}
}
| 条件 | 值 |
|---|---|
| 前置开关 | Items.SpectreArmor 或 Items.SpectreKey 或 Items.SpectreSword 三者任一开启 |
| 杀手 | 必须是 EntityPlayer,且不能是 FakePlayer |
| 排除 | 被杀实体不能是 EntitySpirit(防止刷魂) |
| 默认概率 | SpiritChance = 0.02 |
| 高概率 | SpiritChanceSword = 0.1,仅当手持本剑时 |
[!NOTE] 配置项
SpiritChanceSword的描述文字写的是"背包里有灵魂容器(spirit binder)时"(RTConfiguration.java:73-74),但代码只检查是否手持灵魂之剑,没有读任何灵魂容器相关的 NBT 或背包内容。把描述与实现对照即可确认这是文案与实现不一致,实际以代码为准。
合成配方
xsx
xsx
xox
| 字符 | 物品 |
|---|---|
s |
灵魂之铁(RandomThings:ingredient meta 4) |
o |
黑曜石棒(stickObsidian) |
x |
任意 |
来源:Library/Recipes.java:367-376,受 ConfigItems.spectreSword 约束。