虚拟合成卡完成适配量子计算机,中键下单失败写入名称适配饰品槽
This commit is contained in:
parent
b513f45832
commit
c7b0d4ae38
|
|
@ -4,10 +4,14 @@ import net.pedroksl.advanced_ae.common.logic.AdvCraftingCPULogic;
|
|||
import net.pedroksl.advanced_ae.common.logic.ExecutingCraftingJob;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(value = AdvCraftingCPULogic.class, remap = false)
|
||||
public interface AdvCraftingCPULogicAccessor {
|
||||
|
||||
@Accessor("job")
|
||||
ExecutingCraftingJob eap$getAdvJob();
|
||||
|
||||
@Invoker("finishJob")
|
||||
void eap$invokeAdvFinishJob(boolean success);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,22 @@ public abstract class PatternProviderLogicVirtualCompletionMixin {
|
|||
var progress = tasks.get(patternDetails);
|
||||
if (progress instanceof AdvExecutingCraftingJobTaskProgressAccessor advProgressAccessor) {
|
||||
if (advProgressAccessor.eap$getAdvValue() <= 1) {
|
||||
advCpu.cancelJob();
|
||||
boolean finished = false;
|
||||
try {
|
||||
advCpu.updateOutput(null);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
try {
|
||||
advLogicAccessor.eap$invokeAdvFinishJob(true);
|
||||
finished = true;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
if (!finished) {
|
||||
try {
|
||||
advCpu.cancelJob();
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.extendedae_plus.mixin.ae2.accessor.MEStorageScreenAccessor;
|
|||
import com.extendedae_plus.mixin.extendedae.accessor.GuiExPatternTerminalAccessor;
|
||||
import com.extendedae_plus.util.wireless.WirelessTerminalLocator;
|
||||
import com.glodblock.github.extendedae.client.gui.GuiExPatternTerminal;
|
||||
import de.mari_023.ae2wtlib.wut.WUTHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
|
@ -57,6 +58,40 @@ public class OpenCraftFromJeiC2SPacket {
|
|||
String curiosSlotId = located.getCuriosSlotId();
|
||||
int curiosIndex = located.getCuriosIndex();
|
||||
if (curiosSlotId != null && curiosIndex >= 0) {
|
||||
// Curios 也需要先检查是否可合成,否则写入搜索框并返回
|
||||
var craftingService = (appeng.api.networking.crafting.ICraftingService) null;
|
||||
try {
|
||||
String current = WUTHandler.getCurrentTerminal(located.stack);
|
||||
var def = WUTHandler.wirelessTerminals.get(current);
|
||||
var wtHost = def == null ? null : def.wTMenuHostFactory().create(player, null, located.stack, (p, sub) -> {});
|
||||
var node = wtHost == null ? null : wtHost.getActionableNode();
|
||||
var grid = node == null ? null : node.getGrid();
|
||||
craftingService = grid == null ? null : grid.getCraftingService();
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
if (craftingService != null && !craftingService.isCraftable(what)) {
|
||||
String name = what.getDisplayName().getString();
|
||||
if (name == null || name.isEmpty()) return;
|
||||
|
||||
var screen = Minecraft.getInstance().screen;
|
||||
if (screen instanceof MEStorageScreen<?> me) {
|
||||
try {
|
||||
MEStorageScreenAccessor acc = (MEStorageScreenAccessor) me;
|
||||
acc.eap$getSearchField().setValue(name);
|
||||
acc.eap$setSearchText(name);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
} else if (screen instanceof GuiExPatternTerminal<?> gpt) {
|
||||
try {
|
||||
GuiExPatternTerminalAccessor acc = (GuiExPatternTerminalAccessor) gpt;
|
||||
acc.getSearchOutField().setValue(name);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int initial = 1;
|
||||
CraftAmountMenu.open(player, new CuriosItemLocator(curiosSlotId, curiosIndex), what, initial);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user