feat:合成界面shift取消添加书签功能添加提示
This commit is contained in:
parent
77043178a4
commit
c599dfb198
|
|
@ -1,6 +1,7 @@
|
|||
package com.extendedae_plus.mixin.ae2.accessor;
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.client.gui.WidgetContainer;
|
||||
import appeng.client.gui.style.ScreenStyle;
|
||||
import appeng.menu.AEBaseMenu;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -10,4 +11,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
public interface AEBaseScreenAccessor<T extends AEBaseMenu> {
|
||||
@Accessor(value = "style", remap = false)
|
||||
ScreenStyle eap$getStyle();
|
||||
|
||||
@Accessor("widgets")
|
||||
WidgetContainer eap$getWidgets();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
package com.extendedae_plus.mixin.ae2.accessor;
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.menu.AEBaseMenu;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(AEBaseScreen.class)
|
||||
public interface AEBaseScreenInvoker<T extends AEBaseMenu> {
|
||||
// 空接口:避免在 AEBaseScreen 上声明不存在方法的 Invoker 导致编译错误
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.extendedae_plus.mixin.ae2.accessor;
|
||||
|
||||
import appeng.client.gui.WidgetContainer;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(value = WidgetContainer.class, remap = false)
|
||||
public interface WidgetContainerAccessor {
|
||||
@Accessor("widgets")
|
||||
Map<String, AbstractWidget> eap$getWidgetsMap();
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.extendedae_plus.mixin.ae2.client.gui;
|
||||
|
||||
import appeng.client.gui.WidgetContainer;
|
||||
import appeng.client.gui.me.crafting.CraftConfirmScreen;
|
||||
import appeng.core.localization.GuiText;
|
||||
import com.extendedae_plus.mixin.ae2.accessor.AEBaseScreenAccessor;
|
||||
import com.extendedae_plus.mixin.ae2.accessor.WidgetContainerAccessor;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.Tooltip;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.neoforged.fml.ModList;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
@Mixin(value = CraftConfirmScreen.class, remap = false)
|
||||
public class CraftConfirmScreenMixin {
|
||||
|
||||
@Unique
|
||||
private static final Component EAP_CANCEL_TEXT = GuiText.Cancel.text();
|
||||
@Unique
|
||||
private static final Component EAP_BOOKMARK_TEXT = Component.translatable("gui.extendedae_plus.add_bookmark");
|
||||
@Unique
|
||||
private static final Component EAP_BOOKMARK_TOOLTIP = Component.translatable("tooltip.extendedae_plus.add_missing_to_jei_bookmark");
|
||||
|
||||
@Inject(method = "updateBeforeRender", at = @At("TAIL"), remap = false)
|
||||
private void eap$updateCancelButtonText(CallbackInfo ci) {
|
||||
if (!ModList.get().isLoaded("jei")){
|
||||
return;
|
||||
}
|
||||
|
||||
CraftConfirmScreen self = (CraftConfirmScreen) (Object) this;
|
||||
try {
|
||||
WidgetContainer widgets = ((AEBaseScreenAccessor<?>) self).eap$getWidgets();
|
||||
if (widgets == null) return;
|
||||
|
||||
AbstractWidget cancelWidget = ((WidgetContainerAccessor) widgets).eap$getWidgetsMap().get("cancel");
|
||||
if (!(cancelWidget instanceof Button cancelButton)) return;
|
||||
|
||||
boolean shiftDown = Screen.hasShiftDown();
|
||||
|
||||
if (shiftDown) {
|
||||
cancelButton.setMessage(EAP_BOOKMARK_TEXT);
|
||||
cancelButton.setTooltip(Tooltip.create(EAP_BOOKMARK_TOOLTIP));
|
||||
} else {
|
||||
cancelButton.setMessage(EAP_CANCEL_TEXT);
|
||||
cancelButton.setTooltip(null);
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -275,5 +275,8 @@
|
|||
"extendedae_plus.jade.network.online": "Online",
|
||||
"extendedae_plus.jade.network.offline": "Offline",
|
||||
|
||||
"extendedae_plus.screen.global_controller_title": "Pattern Provider Status Controller"
|
||||
"extendedae_plus.screen.global_controller_title": "Pattern Provider Status Controller",
|
||||
|
||||
"gui.extendedae_plus.add_bookmark": "Add Bookmark",
|
||||
"tooltip.extendedae_plus.add_missing_to_jei_bookmark": "Add missing items to JEI bookmarks"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,5 +270,8 @@
|
|||
"extendedae_plus.jade.network.online": "设备在线",
|
||||
"extendedae_plus.jade.network.offline": "设备离线",
|
||||
|
||||
"extendedae_plus.screen.global_controller_title": "样板供应器状态控制器"
|
||||
"extendedae_plus.screen.global_controller_title": "样板供应器状态控制器",
|
||||
|
||||
"gui.extendedae_plus.add_bookmark": "添加书签",
|
||||
"tooltip.extendedae_plus.add_missing_to_jei_bookmark": "添加缺失物品到JEI书签"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
"ae2.AEProcessingPatternMixin",
|
||||
"ae2.CraftingCalculationMixin",
|
||||
"ae2.CraftingCPUClusterMixin",
|
||||
"ae2.accessor.CraftingCPUClusterAccessor",
|
||||
"ae2.EncodedPatternItemMixin",
|
||||
"ae2.accessor.CraftingCPUClusterAccessor",
|
||||
"ae2.accessor.CraftingCpuLogicAccessor",
|
||||
"ae2.accessor.ExecutingCraftingJobAccessor",
|
||||
"ae2.accessor.ExecutingCraftingJobTaskProgressAccessor",
|
||||
|
|
@ -62,7 +62,6 @@
|
|||
"extendedae.common.PartExPatternProviderMixin",
|
||||
"extendedae.common.TileExPatternProviderMixin",
|
||||
"extendedae.common.matrix.ClusterAssemblerMatrixMixin",
|
||||
"extendedae.common.matrix.ClusterAssemblerMatrixMixin",
|
||||
"extendedae.container.ContainerAssemblerMatrixPatternSlotTrackerMixin",
|
||||
"extendedae.container.ContainerExPatternProviderMixin",
|
||||
"extendedae.container.ContainerExPatternTerminalMixin",
|
||||
|
|
@ -76,18 +75,19 @@
|
|||
"advancedae.client.gui.SmallAdvPatternProviderScreenMixin",
|
||||
"ae2.QuartzCuttingKnifeItemMixin",
|
||||
"ae2.accessor.AEBaseScreenAccessor",
|
||||
"ae2.accessor.AEBaseScreenInvoker",
|
||||
"ae2.accessor.MEStorageScreenAccessor",
|
||||
"ae2.accessor.PatternAccessTermScreenAccessor",
|
||||
"ae2.accessor.PatternAccessTermScreenSlotsRowAccessor",
|
||||
"ae2.accessor.WidgetContainerAccessor",
|
||||
"ae2.client.gui.AEBaseScreenMixin",
|
||||
"ae2.client.gui.CraftConfirmScreenMixin",
|
||||
"ae2.client.gui.InterfaceScreenMixin",
|
||||
"ae2.client.gui.ProcessingEncodingPanelMixin",
|
||||
"ae2.client.gui.PatternEncodingTermScreenMixin",
|
||||
"ae2.client.gui.PatternEncodingTermUploadMixin",
|
||||
"ae2.client.gui.PatternProviderCloseMixin",
|
||||
"ae2.client.gui.PatternProviderScreenUpgradesMixin",
|
||||
"ae2.client.gui.PatternProviderSmartFeaturesMixin",
|
||||
"ae2.client.gui.ProcessingEncodingPanelMixin",
|
||||
"ae2.client.gui.ScreenStyleMixin",
|
||||
"ae2.client.gui.SlotGridLayoutMixin",
|
||||
"ae2.menu.CraftConfirmMenuGoBackMixin",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user