Merge pull request #13 from C-H716/fix/multiple-bugs-and-tweaks
Fix/multiple bugs and tweaks
This commit is contained in:
commit
880117c378
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -4,7 +4,7 @@ build/
|
|||
out/
|
||||
classes/
|
||||
source/
|
||||
|
||||
Applied-Energistics-2-forge-1.20.1/
|
||||
# Eclipse
|
||||
*.tmp
|
||||
*.bak
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||
loom.platform = forge
|
||||
|
||||
# Mod properties
|
||||
mod_version = 1.4.0
|
||||
mod_version = 1.4.1_beta
|
||||
maven_group = com.extendedae_plus
|
||||
archives_name = extendedae_plus
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.autopattern;
|
||||
package com.extendedae_plus.mixin.ae2.autopattern;
|
||||
|
||||
import appeng.api.crafting.IPatternDetails;
|
||||
import appeng.me.service.CraftingService;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.autopattern;
|
||||
package com.extendedae_plus.mixin.ae2.autopattern;
|
||||
|
||||
import appeng.api.stacks.AEKey;
|
||||
import appeng.crafting.CraftingTreeNode;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.autopattern;
|
||||
package com.extendedae_plus.mixin.ae2.autopattern;
|
||||
|
||||
import appeng.api.stacks.KeyCounter;
|
||||
import appeng.crafting.CraftingTreeNode;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.autopattern;
|
||||
package com.extendedae_plus.mixin.ae2.autopattern;
|
||||
|
||||
import appeng.api.crafting.IPatternDetails;
|
||||
import appeng.api.networking.crafting.ICraftingProvider;
|
||||
|
|
@ -10,9 +10,9 @@ import appeng.crafting.CraftingTreeProcess;
|
|||
import appeng.crafting.pattern.AEProcessingPattern;
|
||||
import appeng.me.service.CraftingService;
|
||||
import com.extendedae_plus.api.SmartDoublingAwarePattern;
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
import com.extendedae_plus.content.ScaledProcessingPattern;
|
||||
import com.extendedae_plus.util.PatternScaler;
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
import com.extendedae_plus.util.RequestedAmountHolder;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.autopattern;
|
||||
package com.extendedae_plus.mixin.ae2.autopattern;
|
||||
|
||||
import appeng.api.crafting.IPatternDetails;
|
||||
import appeng.helpers.patternprovider.PatternProviderLogic;
|
||||
|
|
@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
/**适配
|
||||
* Redirect PatternProviderLogic.pushPattern 中对 List.contains 的调用,
|
||||
* 在遇到缩放样板时回退匹配到原始样板实例。
|
||||
*/
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.extendedae_plus.mixin.ae2.autopattern.adaptation;
|
||||
|
||||
import appeng.api.crafting.IPatternDetails;
|
||||
import com.extendedae_plus.content.ScaledProcessingPattern;
|
||||
import net.pedroksl.advanced_ae.common.logic.AdvPatternProviderLogic;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Pseudo;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**适配
|
||||
* Redirect PatternProviderLogic.pushPattern 中对 List.contains 的调用,
|
||||
* 在遇到缩放样板时回退匹配到原始样板实例。
|
||||
*/
|
||||
@Pseudo
|
||||
@Mixin(value = AdvPatternProviderLogic.class, remap = false)
|
||||
public class AdvPatternProviderLogicContainsRedirectMixin {
|
||||
|
||||
@Redirect(method = "pushPattern",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Ljava/util/List;contains(Ljava/lang/Object;)Z")
|
||||
)
|
||||
private boolean eap$patternsContains(List<?> list, Object o) {
|
||||
try {
|
||||
if (o instanceof ScaledProcessingPattern scaled) {
|
||||
IPatternDetails base = scaled.getOriginal();
|
||||
if (base != null && list.indexOf(base) != -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 使用 indexOf 避免再次触发对 List.contains 的 redirect(防止递归)
|
||||
return list.indexOf(o) != -1;
|
||||
} catch (Throwable t) {
|
||||
return list.indexOf(o) != -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.client.gui;
|
||||
|
||||
import appeng.api.stacks.AEKey;
|
||||
import appeng.client.Point;
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.client.gui.StackWithBounds;
|
||||
import appeng.client.gui.me.crafting.CraftingCPUScreen;
|
||||
import appeng.client.gui.TextOverride;
|
||||
import appeng.client.gui.me.crafting.CraftingCPUScreen;
|
||||
import appeng.client.gui.style.PaletteColor;
|
||||
import appeng.client.gui.style.ScreenStyle;
|
||||
import appeng.client.gui.style.Text;
|
||||
import appeng.client.gui.style.TextAlignment;
|
||||
import appeng.api.stacks.AEKey;
|
||||
import appeng.menu.slot.AppEngSlot;
|
||||
import com.extendedae_plus.api.ExPatternPageAccessor;
|
||||
import com.extendedae_plus.network.CraftingMonitorJumpC2SPacket;
|
||||
import com.extendedae_plus.network.ModNetwork;
|
||||
import com.extendedae_plus.network.CraftingMonitorOpenProviderC2SPacket;
|
||||
import com.extendedae_plus.network.ModNetwork;
|
||||
import com.extendedae_plus.util.GuiUtil;
|
||||
import com.glodblock.github.extendedae.client.gui.GuiExPatternProvider;
|
||||
import com.mojang.logging.LogUtils;
|
||||
|
|
@ -24,13 +24,13 @@ import net.minecraft.client.renderer.Rect2i;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(AEBaseScreen.class)
|
||||
public abstract class AEBaseScreenMixin {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.client.gui;
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.client.gui.Icon;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.client.gui;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.client.gui;
|
||||
|
||||
import appeng.client.Point;
|
||||
import appeng.client.gui.layout.SlotGridLayout;
|
||||
|
|
@ -8,6 +8,7 @@ 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.CallbackInfoReturnable;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Mixin(SlotGridLayout.class)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.helpers;
|
||||
|
||||
import appeng.api.crafting.IPatternDetails;
|
||||
import appeng.api.crafting.IPatternDetails.IInput;
|
||||
|
|
@ -8,7 +8,9 @@ import appeng.helpers.patternprovider.PatternProviderLogic;
|
|||
import appeng.helpers.patternprovider.PatternProviderTarget;
|
||||
import com.extendedae_plus.api.AdvancedBlockingHolder;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -17,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
|
||||
import java.util.Collections;
|
||||
|
||||
@Mixin(PatternProviderLogic.class)
|
||||
@Mixin(value = PatternProviderLogic.class, remap = false)
|
||||
public class PatternProviderLogicAdvancedMixin implements AdvancedBlockingHolder {
|
||||
@Unique
|
||||
private static final String EPP_ADV_BLOCKING_KEY = "epp_advanced_blocking";
|
||||
|
|
@ -35,12 +37,12 @@ public class PatternProviderLogicAdvancedMixin implements AdvancedBlockingHolder
|
|||
this.eap$advancedBlocking = value;
|
||||
}
|
||||
|
||||
@Inject(method = "writeToNBT", at = @At("TAIL"), remap = false)
|
||||
@Inject(method = "writeToNBT", at = @At("TAIL"))
|
||||
private void eap$writeAdvancedToNbt(CompoundTag tag, CallbackInfo ci) {
|
||||
tag.putBoolean(EPP_ADV_BLOCKING_KEY, this.eap$advancedBlocking);
|
||||
}
|
||||
|
||||
@Inject(method = "readFromNBT", at = @At("TAIL"), remap = false)
|
||||
@Inject(method = "readFromNBT", at = @At("TAIL"))
|
||||
private void eap$readAdvancedFromNbt(CompoundTag tag, CallbackInfo ci) {
|
||||
if (tag.contains(EPP_ADV_BLOCKING_KEY)) {
|
||||
this.eap$advancedBlocking = tag.getBoolean(EPP_ADV_BLOCKING_KEY);
|
||||
|
|
@ -48,7 +50,7 @@ public class PatternProviderLogicAdvancedMixin implements AdvancedBlockingHolder
|
|||
}
|
||||
|
||||
// 在 pushPattern 中,重定向对 adapter.containsPatternInput(...) 的调用
|
||||
@Redirect(method = "pushPattern", at = @At(value = "INVOKE", target = "Lappeng/helpers/patternprovider/PatternProviderTarget;containsPatternInput(Ljava/util/Set;)Z"), remap = false)
|
||||
@Redirect(method = "pushPattern", at = @At(value = "INVOKE", target = "Lappeng/helpers/patternprovider/PatternProviderTarget;containsPatternInput(Ljava/util/Set;)Z"))
|
||||
private boolean eap$redirectBlockingContains(PatternProviderTarget adapter,
|
||||
java.util.Set<AEKey> patternInputs,
|
||||
IPatternDetails patternDetails,
|
||||
|
|
@ -87,4 +89,21 @@ public class PatternProviderLogicAdvancedMixin implements AdvancedBlockingHolder
|
|||
}
|
||||
return true; // 每个输入槽都至少匹配了一个候选输入
|
||||
}
|
||||
|
||||
@Shadow public void saveChanges() {}
|
||||
|
||||
@Inject(method = "exportSettings(Lnet/minecraft/nbt/CompoundTag;)V", at = @At("TAIL"))
|
||||
private void onExportSettings(CompoundTag output, CallbackInfo ci) {
|
||||
System.out.println(this.eap$advancedBlocking);
|
||||
output.putBoolean("eap_advanced_blocking", this.eap$advancedBlocking);
|
||||
}
|
||||
|
||||
@Inject(method = "importSettings(Lnet/minecraft/nbt/CompoundTag;Lnet/minecraft/world/entity/player/Player;)V", at = @At("TAIL"))
|
||||
private void onImportSettings(CompoundTag input, Player player, CallbackInfo ci) {
|
||||
if (input.contains("eap_advanced_blocking")) {
|
||||
this.eap$advancedBlocking = input.getBoolean("eap_advanced_blocking");
|
||||
// 持久化到 world
|
||||
this.saveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,21 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.helpers;
|
||||
|
||||
import appeng.helpers.patternprovider.PatternProviderLogic;
|
||||
import com.extendedae_plus.api.SmartDoublingHolder;
|
||||
import com.extendedae_plus.api.SmartDoublingAwarePattern;
|
||||
import com.extendedae_plus.mixin.ae2.accessor.PatternProviderLogicPatternsAccessor;
|
||||
import appeng.api.crafting.IPatternDetails;
|
||||
import appeng.crafting.pattern.AEProcessingPattern;
|
||||
import appeng.helpers.patternprovider.PatternProviderLogic;
|
||||
import com.extendedae_plus.api.SmartDoublingAwarePattern;
|
||||
import com.extendedae_plus.api.SmartDoublingHolder;
|
||||
import com.extendedae_plus.mixin.ae2.accessor.PatternProviderLogicPatternsAccessor;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
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(PatternProviderLogic.class)
|
||||
@Mixin(value = PatternProviderLogic.class, remap = false)
|
||||
public class PatternProviderLogicDoublingMixin implements SmartDoublingHolder {
|
||||
@Unique
|
||||
private static final String EPP_SMART_DOUBLING_KEY = "epp_smart_doubling";
|
||||
|
|
@ -43,19 +45,19 @@ public class PatternProviderLogicDoublingMixin implements SmartDoublingHolder {
|
|||
}
|
||||
}
|
||||
|
||||
@Inject(method = "writeToNBT", at = @At("TAIL"), remap = false)
|
||||
@Inject(method = "writeToNBT", at = @At("TAIL"))
|
||||
private void eap$writeSmartDoublingToNbt(CompoundTag tag, CallbackInfo ci) {
|
||||
tag.putBoolean(EPP_SMART_DOUBLING_KEY, this.eap$smartDoubling);
|
||||
}
|
||||
|
||||
@Inject(method = "readFromNBT", at = @At("TAIL"), remap = false)
|
||||
@Inject(method = "readFromNBT", at = @At("TAIL"))
|
||||
private void eap$readSmartDoublingFromNbt(CompoundTag tag, CallbackInfo ci) {
|
||||
if (tag.contains(EPP_SMART_DOUBLING_KEY)) {
|
||||
this.eap$smartDoubling = tag.getBoolean(EPP_SMART_DOUBLING_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "updatePatterns", at = @At("TAIL"), remap = false)
|
||||
@Inject(method = "updatePatterns", at = @At("TAIL"))
|
||||
private void eap$applySmartDoublingToPatterns(CallbackInfo ci) {
|
||||
try {
|
||||
var list = ((PatternProviderLogicPatternsAccessor) this).eap$patterns();
|
||||
|
|
@ -68,4 +70,22 @@ public class PatternProviderLogicDoublingMixin implements SmartDoublingHolder {
|
|||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Shadow
|
||||
public void saveChanges() {}
|
||||
|
||||
@Inject(method = "exportSettings(Lnet/minecraft/nbt/CompoundTag;)V", at = @At("TAIL"))
|
||||
private void onExportSettings(CompoundTag output, CallbackInfo ci) {
|
||||
System.out.println(this.eap$smartDoubling);
|
||||
output.putBoolean("eap_smart_doubling", this.eap$smartDoubling);
|
||||
}
|
||||
|
||||
@Inject(method = "importSettings(Lnet/minecraft/nbt/CompoundTag;Lnet/minecraft/world/entity/player/Player;)V", at = @At("TAIL"))
|
||||
private void onImportSettings(CompoundTag input, Player player, CallbackInfo ci) {
|
||||
if (input.contains("eap_smart_doubling")) {
|
||||
this.eap$smartDoubling = input.getBoolean("eap_smart_doubling");
|
||||
// 持久化到 world
|
||||
this.saveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.menu;
|
||||
|
||||
import appeng.api.crafting.PatternDetailsHelper;
|
||||
import appeng.menu.me.items.PatternEncodingTermMenu;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.menu;
|
||||
|
||||
import appeng.api.config.Setting;
|
||||
import appeng.api.util.IConfigManager;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.menu;
|
||||
|
||||
import appeng.api.inventories.InternalInventory;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.menu;
|
||||
|
||||
import appeng.helpers.patternprovider.PatternProviderLogic;
|
||||
import appeng.helpers.patternprovider.PatternProviderLogicHost;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.ae2.menu;
|
||||
|
||||
import appeng.helpers.patternprovider.PatternProviderLogic;
|
||||
import appeng.helpers.patternprovider.PatternProviderLogicHost;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.extendedae;
|
||||
package com.extendedae_plus.mixin.extendedae.client;
|
||||
|
||||
import com.glodblock.github.extendedae.client.button.HighlightButton;
|
||||
import com.glodblock.github.extendedae.client.gui.GuiExPatternTerminal;
|
||||
|
|
@ -1,22 +1,19 @@
|
|||
package com.extendedae_plus.mixin.extendedae;
|
||||
package com.extendedae_plus.mixin.extendedae.client.gui;
|
||||
|
||||
import appeng.client.gui.Icon;
|
||||
import appeng.client.gui.implementations.PatternProviderScreen;
|
||||
import appeng.client.gui.style.PaletteColor;
|
||||
import appeng.client.gui.style.ScreenStyle;
|
||||
import appeng.menu.SlotSemantics;
|
||||
import com.extendedae_plus.NewIcon;
|
||||
import com.glodblock.github.extendedae.client.button.ActionEPPButton;
|
||||
import com.extendedae_plus.api.ExPatternButtonsAccessor;
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
import com.glodblock.github.extendedae.client.button.ActionEPPButton;
|
||||
import com.glodblock.github.extendedae.client.gui.GuiExPatternProvider;
|
||||
import com.glodblock.github.extendedae.container.ContainerExPatternProvider;
|
||||
import com.glodblock.github.extendedae.network.EPPNetworkHandler;
|
||||
import com.glodblock.github.glodium.network.packet.CGenericPacket;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -24,7 +21,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import static com.extendedae_plus.util.ExtendedAELogger.LOGGER;
|
||||
|
||||
@Mixin(GuiExPatternProvider.class)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.extendedae;
|
||||
package com.extendedae_plus.mixin.extendedae.client.gui;
|
||||
|
||||
import appeng.api.crafting.PatternDetailsHelper;
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
|
|
@ -9,23 +9,26 @@ import appeng.client.gui.style.ScreenStyle;
|
|||
import appeng.client.gui.widgets.AETextField;
|
||||
import appeng.client.gui.widgets.IconButton;
|
||||
import appeng.menu.AEBaseMenu;
|
||||
import com.glodblock.github.extendedae.client.gui.GuiExPatternTerminal;
|
||||
import com.extendedae_plus.mixin.extendedae.accessor.GuiExPatternTerminalAccessor;
|
||||
import com.extendedae_plus.network.ModNetwork;
|
||||
import com.extendedae_plus.network.OpenProviderUiC2SPacket;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import com.glodblock.github.extendedae.client.gui.GuiExPatternTerminal;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.Tooltip;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Rect2i;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Pseudo;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
@ -37,11 +40,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Set;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import java.util.*;
|
||||
|
||||
@Pseudo
|
||||
@Mixin(value = GuiExPatternTerminal.class)
|
||||
|
|
@ -218,12 +217,11 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<AEBaseMenu>
|
|||
private void eap$tryOpenProviderUI(int rowIndex) {
|
||||
try {
|
||||
// 使用 Accessor 获取 rows,避免取到父类导致失败
|
||||
com.extendedae_plus.mixin.extendedae.accessor.GuiExPatternTerminalAccessor acc =
|
||||
(com.extendedae_plus.mixin.extendedae.accessor.GuiExPatternTerminalAccessor) (Object) this;
|
||||
java.util.ArrayList<?> rows = acc.getRows();
|
||||
GuiExPatternTerminalAccessor acc = (GuiExPatternTerminalAccessor) this;
|
||||
ArrayList<?> rows = acc.getRows();
|
||||
|
||||
// 找到该分组对应的第一个 PatternContainerRecord
|
||||
Class<?> cls = com.glodblock.github.extendedae.client.gui.GuiExPatternTerminal.class;
|
||||
Class<?> cls = GuiExPatternTerminal.class;
|
||||
var byGroupField = cls.getDeclaredField("byGroup");
|
||||
byGroupField.setAccessible(true);
|
||||
Object byGroup = byGroupField.get(this); // HashMultimap<PatternContainerGroup, PatternContainerRecord>
|
||||
|
|
@ -234,7 +232,7 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<AEBaseMenu>
|
|||
Object group = groupField.get(headerRow);
|
||||
|
||||
// 调用 byGroup.get(group),再取第一个元素
|
||||
java.util.Collection<?> containers = (java.util.Collection<?>) byGroup.getClass().getMethod("get", Object.class).invoke(byGroup, group);
|
||||
Collection<?> containers = (Collection<?>) byGroup.getClass().getMethod("get", Object.class).invoke(byGroup, group);
|
||||
if (containers == null || containers.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -245,7 +243,7 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<AEBaseMenu>
|
|||
var infoMapField = cls.getDeclaredField("infoMap");
|
||||
infoMapField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
java.util.HashMap<Long, Object> infoMap = (java.util.HashMap<Long, Object>) infoMapField.get(this);
|
||||
HashMap<Long, Object> infoMap = (HashMap<Long, Object>) infoMapField.get(this);
|
||||
Object info = infoMap.get(serverId);
|
||||
if (info == null) {
|
||||
// 无位置信息,提示
|
||||
|
|
@ -299,7 +297,7 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<AEBaseMenu>
|
|||
|
||||
// 通过反射调用refreshList方法 - 先尝试当前类,失败后尝试父类
|
||||
try {
|
||||
java.lang.reflect.Method refreshMethod = null;
|
||||
Method refreshMethod = null;
|
||||
try {
|
||||
// 先尝试在当前类中查找
|
||||
refreshMethod = this.getClass().getDeclaredMethod("refreshList");
|
||||
|
|
@ -514,13 +512,12 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<AEBaseMenu>
|
|||
// 动态放置/创建每个组标题后的“打开UI”按钮
|
||||
try {
|
||||
// 使用 Accessor 获取必要的字段,避免反射失败
|
||||
com.extendedae_plus.mixin.extendedae.accessor.GuiExPatternTerminalAccessor acc =
|
||||
(com.extendedae_plus.mixin.extendedae.accessor.GuiExPatternTerminalAccessor) (Object) this;
|
||||
GuiExPatternTerminalAccessor acc = (GuiExPatternTerminalAccessor) this;
|
||||
java.util.ArrayList<?> rows = acc.getRows();
|
||||
int currentScroll = acc.getScrollbar().getCurrentScroll();
|
||||
|
||||
// 直接引用目标类以获取其静态常量
|
||||
Class<?> cls = com.glodblock.github.extendedae.client.gui.GuiExPatternTerminal.class;
|
||||
Class<?> cls = GuiExPatternTerminal.class;
|
||||
int GUI_PADDING_X = getIntConst(cls, "GUI_PADDING_X", 22);
|
||||
int GUI_PADDING_Y = getIntConst(cls, "GUI_PADDING_Y", 6);
|
||||
int GUI_HEADER_HEIGHT = getIntConst(cls, "GUI_HEADER_HEIGHT", 51);
|
||||
|
|
@ -548,8 +545,8 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<AEBaseMenu>
|
|||
}
|
||||
|
||||
// 放置按钮:位于名称文本右侧,与原类 choiceButton 锚点相邻,向右偏移 20px
|
||||
int bx = this.leftPos + GUI_PADDING_X + TEXT_MAX_WIDTH - 40;
|
||||
int by = this.topPos + GUI_PADDING_Y + GUI_HEADER_HEIGHT + i * ROW_HEIGHT - 3;
|
||||
int bx = this.leftPos + GUI_PADDING_X + TEXT_MAX_WIDTH - 11;
|
||||
int by = this.topPos + GUI_PADDING_Y + GUI_HEADER_HEIGHT + i * ROW_HEIGHT - 2;
|
||||
|
||||
Button btn = eap$openUIButtons.get(rowIndex);
|
||||
if (btn == null) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.extendedae;
|
||||
package com.extendedae_plus.mixin.extendedae.common;
|
||||
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
import com.glodblock.github.extendedae.common.parts.PartExPatternProvider;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.extendedae;
|
||||
package com.extendedae_plus.mixin.extendedae.common;
|
||||
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
import com.glodblock.github.extendedae.common.tileentities.TileExPatternProvider;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.extendedae;
|
||||
package com.extendedae_plus.mixin.extendedae.container;
|
||||
|
||||
import appeng.api.crafting.PatternDetailsHelper;
|
||||
import appeng.api.stacks.GenericStack;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.extendedae;
|
||||
package com.extendedae_plus.mixin.extendedae.container;
|
||||
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.menu.guisync.GuiSync;
|
||||
|
|
@ -6,23 +6,24 @@ import com.extendedae_plus.util.ExtendedAEPatternUploadUtil;
|
|||
import com.glodblock.github.extendedae.container.ContainerExPatternTerminal;
|
||||
import com.glodblock.github.glodium.network.packet.sync.IActionHolder;
|
||||
import com.glodblock.github.glodium.network.packet.sync.Paras;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
|
@ -32,8 +33,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mixin(ContainerExPatternTerminal.class)
|
||||
public abstract class ContainerExPatternTerminalMixin implements IActionHolder {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.extendedae;
|
||||
package com.extendedae_plus.mixin.extendedae.container;
|
||||
|
||||
import com.extendedae_plus.util.ExtendedAEPatternUploadUtil;
|
||||
import com.glodblock.github.extendedae.common.me.itemhost.HostWirelessExPAT;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.jei;
|
||||
|
||||
import appeng.integration.modules.jei.transfer.EncodePatternTransferHandler;
|
||||
import appeng.integration.modules.jeirei.EncodingHelper;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.extendedae_plus.mixin.ae2;
|
||||
package com.extendedae_plus.mixin.jei;
|
||||
|
||||
import appeng.api.stacks.AEFluidKey;
|
||||
import appeng.api.stacks.AEItemKey;
|
||||
|
|
@ -8,12 +8,12 @@ import appeng.helpers.patternprovider.PatternProviderLogic;
|
|||
import appeng.helpers.patternprovider.PatternProviderLogicHost;
|
||||
import appeng.me.service.CraftingService;
|
||||
import appeng.menu.AEBaseMenu;
|
||||
import appeng.menu.me.crafting.CraftingCPUMenu;
|
||||
import appeng.menu.locator.MenuLocators;
|
||||
import appeng.menu.me.crafting.CraftingCPUMenu;
|
||||
import appeng.parts.AEBasePart;
|
||||
import com.extendedae_plus.mixin.ae2.accessor.PatternProviderLogicAccessor;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ public class CraftingMonitorOpenProviderC2SPacket {
|
|||
// 直接打开供应器自身的 UI(调用 Host 默认方法)
|
||||
try {
|
||||
// 部件与方块实体分别选择定位器
|
||||
if (host instanceof appeng.parts.AEBasePart part) {
|
||||
if (host instanceof AEBasePart part) {
|
||||
host.openMenu(player, MenuLocators.forPart(part));
|
||||
} else {
|
||||
host.openMenu(player, MenuLocators.forBlockEntity(pbe));
|
||||
|
|
@ -112,4 +112,6 @@ public class CraftingMonitorOpenProviderC2SPacket {
|
|||
});
|
||||
context.setPacketHandled(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,54 +7,54 @@
|
|||
"PickFromWirelessMixin",
|
||||
"accessor.AbstractContainerScreenAccessor",
|
||||
"accessor.ScreenAccessor",
|
||||
"ae2.AEBaseScreenMixin",
|
||||
"ae2.EncodedPatternItemMixin",
|
||||
"ae2.PatternEncodingTermScreenMixin",
|
||||
"ae2.PatternProviderScreenMixin",
|
||||
"ae2.QuartzCuttingKnifeItemMixin",
|
||||
"ae2.SlotGridLayoutMixin",
|
||||
"ae2.accessor.AEBaseScreenAccessor",
|
||||
"ae2.accessor.AEBaseScreenInvoker",
|
||||
"ae2.accessor.MEStorageScreenAccessor",
|
||||
"ae2.accessor.PatternAccessTermScreenAccessor",
|
||||
"ae2.accessor.PatternAccessTermScreenSlotsRowAccessor",
|
||||
"extendedae.GuiExPatternProviderMixin",
|
||||
"extendedae.GuiExPatternTerminalMixin",
|
||||
"extendedae.HighlightButtonMixin",
|
||||
"ae2.client.gui.AEBaseScreenMixin",
|
||||
"ae2.client.gui.PatternEncodingTermScreenMixin",
|
||||
"ae2.client.gui.PatternProviderScreenMixin",
|
||||
"ae2.client.gui.SlotGridLayoutMixin",
|
||||
"extendedae.accessor.GuiExPatternTerminalAccessor",
|
||||
"extendedae.accessor.GuiExPatternTerminalSlotsRowAccessor",
|
||||
"ae2.EncodePatternTransferHandlerMixin",
|
||||
"ae2.EncodingHelperMixin",
|
||||
"jei.accessor.BookmarkOverlayAccessor",
|
||||
"hooks.ModelBakeryMixin"
|
||||
"extendedae.client.HighlightButtonMixin",
|
||||
"extendedae.client.gui.GuiExPatternProviderMixin",
|
||||
"extendedae.client.gui.GuiExPatternTerminalMixin",
|
||||
"hooks.ModelBakeryMixin",
|
||||
"jei.EncodePatternTransferHandlerMixin",
|
||||
"jei.EncodingHelperMixin",
|
||||
"jei.accessor.BookmarkOverlayAccessor"
|
||||
],
|
||||
"mixins": [
|
||||
"ae2.AEProcessingPatternMixin",
|
||||
"ae2.ContainerPatternEncodingTermMenuMixin",
|
||||
"ae2.CraftingCPUClusterMixin",
|
||||
"ae2.MEStorageMenuMixin",
|
||||
"ae2.PatternEncodingTermMenuMixin",
|
||||
"ae2.PatternProviderLogicAdvancedMixin",
|
||||
"ae2.PatternProviderLogicDoublingMixin",
|
||||
"ae2.PatternProviderMenuAdvancedMixin",
|
||||
"ae2.PatternProviderMenuDoublingMixin",
|
||||
"ae2.accessor.MEStorageMenuAccessor",
|
||||
"ae2.accessor.PatternEncodingTermMenuAccessor",
|
||||
"ae2.accessor.PatternProviderLogicAccessor",
|
||||
"ae2.accessor.PatternProviderLogicPatternInputsAccessor",
|
||||
"ae2.accessor.PatternProviderLogicPatternsAccessor",
|
||||
"ae2.accessor.PatternProviderMenuAdvancedAccessor",
|
||||
"ae2.autopattern.CraftingServiceGetProvidersMixin",
|
||||
"ae2.autopattern.CraftingTreeNodeAccessor",
|
||||
"ae2.autopattern.CraftingTreeNodeMixin",
|
||||
"ae2.autopattern.CraftingTreeProcessMixin",
|
||||
"ae2.autopattern.PatternProviderLogicContainsRedirectMixin",
|
||||
"ae2.autopattern.adaptation.AdvPatternProviderLogicContainsRedirectMixin",
|
||||
"ae2.helpers.PatternProviderLogicAdvancedMixin",
|
||||
"ae2.helpers.PatternProviderLogicDoublingMixin",
|
||||
"ae2.menu.ContainerPatternEncodingTermMenuMixin",
|
||||
"ae2.menu.MEStorageMenuMixin",
|
||||
"ae2.menu.PatternEncodingTermMenuMixin",
|
||||
"ae2.menu.PatternProviderMenuAdvancedMixin",
|
||||
"ae2.menu.PatternProviderMenuDoublingMixin",
|
||||
"ae2WTlib.ContainerUWirelessExPatternTerminalMixin",
|
||||
"autopattern.CraftingServiceGetProvidersMixin",
|
||||
"autopattern.CraftingTreeNodeAccessor",
|
||||
"autopattern.CraftingTreeNodeMixin",
|
||||
"autopattern.CraftingTreeProcessMixin",
|
||||
"autopattern.PatternProviderLogicContainsRedirectMixin",
|
||||
"extendedae.ContainerExPatternProviderMixin",
|
||||
"extendedae.ContainerExPatternTerminalMixin",
|
||||
"extendedae.ContainerWirelessExPatternTerminalMixin",
|
||||
"extendedae.PartExPatternProviderMixin",
|
||||
"extendedae.TileExPatternProviderMixin"
|
||||
"extendedae.common.PartExPatternProviderMixin",
|
||||
"extendedae.common.TileExPatternProviderMixin",
|
||||
"extendedae.container.ContainerExPatternProviderMixin",
|
||||
"extendedae.container.ContainerExPatternTerminalMixin",
|
||||
"extendedae.container.ContainerWirelessExPatternTerminalMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user