完成按钮去除有线终端的格子绘制
This commit is contained in:
parent
552c1eff42
commit
bccf0bf4c9
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -86,7 +86,7 @@ classes/
|
||||||
*.zip
|
*.zip
|
||||||
|
|
||||||
# Reference source code (should not be tracked)
|
# Reference source code (should not be tracked)
|
||||||
# ExtendedAE-1.20-1.4.2-forge/
|
ExtendedAE-1.20-1.4.2-forge/
|
||||||
GTLCore/
|
GTLCore/
|
||||||
|
|
||||||
# Gradle wrapper (optional - some prefer to commit this)
|
# Gradle wrapper (optional - some prefer to commit this)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.extendedae_plus.mixin;
|
||||||
|
|
||||||
|
import appeng.menu.guisync.GuiSync;
|
||||||
|
import com.glodblock.github.extendedae.container.ContainerExPatternTerminal;
|
||||||
|
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(ContainerExPatternTerminal.class)
|
||||||
|
public abstract class ContainerExPatternTerminalMixin {
|
||||||
|
|
||||||
|
@GuiSync(11452)
|
||||||
|
@Unique
|
||||||
|
public boolean hidePatternSlots = false;
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
public boolean isHidePatternSlots() {
|
||||||
|
return this.hidePatternSlots;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
public void setHidePatternSlots(boolean hide) {
|
||||||
|
this.hidePatternSlots = hide;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
public void toggleHidePatternSlots() {
|
||||||
|
this.hidePatternSlots = !this.hidePatternSlots;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.extendedae_plus.mixin;
|
||||||
|
|
||||||
|
import appeng.client.gui.layout.SlotGridLayout;
|
||||||
|
import appeng.client.Point;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(SlotGridLayout.class)
|
||||||
|
public abstract class SlotGridLayoutMixin {
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private static final int SLOTS_PER_PAGE = 36;
|
||||||
|
|
||||||
|
@Inject(method = "getRowBreakPosition", at = @At("HEAD"), cancellable = true, remap = false)
|
||||||
|
private static void onGetRowBreakPosition(int x, int y, int semanticIdx, int cols, CallbackInfoReturnable<Point> cir) {
|
||||||
|
// 只处理BREAK_AFTER_9COLS布局
|
||||||
|
if (cols != 9) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算当前页码
|
||||||
|
int currentPage = semanticIdx / SLOTS_PER_PAGE;
|
||||||
|
|
||||||
|
// 计算在当前页中的位置
|
||||||
|
int slotInPage = semanticIdx % SLOTS_PER_PAGE;
|
||||||
|
int row = slotInPage / 9; // 0-3
|
||||||
|
int col = slotInPage % 9; // 0-8
|
||||||
|
|
||||||
|
// 计算目标位置(始终在前4行)
|
||||||
|
int targetX = x + col * 18;
|
||||||
|
int targetY = y + row * 18;
|
||||||
|
|
||||||
|
cir.setReturnValue(new Point(targetX, targetY));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user