添加是否显示样板编码玩家配置选项

This commit is contained in:
xinyihl 2025-08-30 12:12:50 +08:00
parent 5314850bfd
commit 462d3731a7
2 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,7 @@ public final class ModConfigs {
public static final ForgeConfigSpec.IntValue PAGE_MULTIPLIER;
public static final ForgeConfigSpec.DoubleValue WIRELESS_MAX_RANGE;
public static final ForgeConfigSpec.BooleanValue WIRELESS_CROSS_DIM_ENABLE;
public static final ForgeConfigSpec.BooleanValue SHOW_ENCOD_PATTERN_PLAYER;
static {
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
@ -32,6 +33,14 @@ public final class ModConfigs {
"是否允许无线收发器跨维度建立连接",
"开启后,从端可连接到不同维度的主端(忽略距离限制)")
.define("wirelessCrossDimEnable", true);
SHOW_ENCOD_PATTERN_PLAYER = builder
.comment(
"是否显示样板编码玩家",
"开启后将在样板 HoverText 上添加样板的编码玩家"
)
.define("showEncoderPatternPlayer", true);
builder.pop();
COMMON_SPEC = builder.build();
}

View File

@ -1,6 +1,7 @@
package com.extendedae_plus.mixin.ae2;
import appeng.crafting.pattern.EncodedPatternItem;
import com.extendedae_plus.config.ModConfigs;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
@ -19,7 +20,7 @@ public class EncodedPatternItemMixin {
// 客户端 HoverText 显示样板的编码玩家
@Inject(method = "appendHoverText", at = @At("TAIL"))
public void epp$appendHoverText(ItemStack stack, Level level, List<Component> lines, TooltipFlag advancedTooltips, CallbackInfo ci){
if (stack.hasTag()) {
if (stack.hasTag() && ModConfigs.SHOW_ENCOD_PATTERN_PLAYER.get()) {
CompoundTag tag = stack.getOrCreateTag();
String name = tag.getString("encodePlayer");
lines.add(Component.translatable("extendedae_plus.pattern.hovertext.player", name).withStyle(ChatFormatting.GRAY));