清理编译警告

This commit is contained in:
GaLi 2026-03-19 17:23:10 +08:00
parent 4fef441e8d
commit 1ee757e84c
6 changed files with 54 additions and 30 deletions

View File

@ -2,23 +2,35 @@ package com.extendedae_plus.mixin.ae2.helpers;
import appeng.helpers.InterfaceLogic;
import com.extendedae_plus.api.bridge.IInterfaceWirelessLinkBridge;
import org.spongepowered.asm.mixin.Final;
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.CallbackInfoReturnable;
import java.lang.reflect.Field;
/**
* 注入到 InterfaceLogic.Ticker 的每tick回调驱动无线链接状态更新
*/
@Mixin(targets = "appeng.helpers.InterfaceLogic$Ticker")
@Mixin(targets = "appeng.helpers.InterfaceLogic$Ticker", remap = false)
public abstract class InterfaceLogicTickerMixin {
// Mixin 访问内部类的外部引用字段javac 生成名 this$0
@Shadow(remap = false)
@Final
private InterfaceLogic this$0;
@Unique
private static Field extendedae_plus$outerField;
@Unique
private InterfaceLogic extendedae_plus$getOuterLogic() {
try {
if (extendedae_plus$outerField == null) {
extendedae_plus$outerField = this.getClass().getDeclaredField("this$0");
extendedae_plus$outerField.setAccessible(true);
}
return (InterfaceLogic) extendedae_plus$outerField.get(this);
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("Failed to access InterfaceLogic outer instance", e);
}
}
@Inject(method = "tickingRequest", at = @At("HEAD"), remap = false)
private void eap$tickHead(appeng.api.networking.IGridNode node, int ticksSinceLastCall,
@ -28,7 +40,7 @@ public abstract class InterfaceLogicTickerMixin {
return;
}
if (this$0 instanceof IInterfaceWirelessLinkBridge bridge) {
if (this.extendedae_plus$getOuterLogic() instanceof IInterfaceWirelessLinkBridge bridge) {
// 处理延迟初始化
bridge.eap$handleDelayedInit();
}
@ -37,7 +49,7 @@ public abstract class InterfaceLogicTickerMixin {
@Inject(method = "tickingRequest", at = @At("TAIL"), remap = false)
private void eap$tickTail(appeng.api.networking.IGridNode node, int ticksSinceLastCall,
CallbackInfoReturnable<appeng.api.networking.ticking.TickRateModulation> cir) {
if (this$0 instanceof IInterfaceWirelessLinkBridge bridge) {
if (this.extendedae_plus$getOuterLogic() instanceof IInterfaceWirelessLinkBridge bridge) {
bridge.eap$updateWirelessLink();
}
}

View File

@ -2,23 +2,35 @@ package com.extendedae_plus.mixin.ae2.helpers.patternprovider;
import appeng.helpers.patternprovider.PatternProviderLogic;
import com.extendedae_plus.api.bridge.IInterfaceWirelessLinkBridge;
import org.spongepowered.asm.mixin.Final;
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.CallbackInfoReturnable;
import java.lang.reflect.Field;
/**
* 注入到 PatternProviderLogic.Ticker 的每tick回调驱动无线链接状态更新
*/
@Mixin(targets = "appeng.helpers.patternprovider.PatternProviderLogic$Ticker", remap = false)
public abstract class PatternProviderLogicTickerMixin {
// Mixin 访问内部类的外部引用字段javac 生成名 this$0
@Shadow(remap = false)
@Final
private PatternProviderLogic this$0;
@Unique
private static Field extendedae_plus$outerField;
@Unique
private PatternProviderLogic extendedae_plus$getOuterLogic() {
try {
if (extendedae_plus$outerField == null) {
extendedae_plus$outerField = this.getClass().getDeclaredField("this$0");
extendedae_plus$outerField.setAccessible(true);
}
return (PatternProviderLogic) extendedae_plus$outerField.get(this);
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("Failed to access PatternProviderLogic outer instance", e);
}
}
@Inject(method = "tickingRequest", at = @At("HEAD"))
private void eap$tickHead(appeng.api.networking.IGridNode node, int ticksSinceLastCall,
@ -27,7 +39,7 @@ public abstract class PatternProviderLogicTickerMixin {
if (node != null && node.getLevel() != null && node.getLevel().isClientSide) {
return;
}
if (this$0 instanceof IInterfaceWirelessLinkBridge bridge) {
if (this.extendedae_plus$getOuterLogic() instanceof IInterfaceWirelessLinkBridge bridge) {
bridge.eap$handleDelayedInit();
}
}
@ -35,7 +47,7 @@ public abstract class PatternProviderLogicTickerMixin {
@Inject(method = "tickingRequest", at = @At("TAIL"))
private void eap$tickTail(appeng.api.networking.IGridNode node, int ticksSinceLastCall,
CallbackInfoReturnable<appeng.api.networking.ticking.TickRateModulation> cir) {
if (this$0 instanceof IInterfaceWirelessLinkBridge bridge) {
if (this.extendedae_plus$getOuterLogic() instanceof IInterfaceWirelessLinkBridge bridge) {
bridge.eap$updateWirelessLink();
}
}

View File

@ -7,17 +7,17 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(TileAssemblerMatrixCrafter.class)
@Mixin(value = TileAssemblerMatrixCrafter.class, remap = false)
public interface TileAssemblerMatrixCrafterAccessor {
@Accessor("threads")
@Accessor(value = "threads", remap = false)
CraftingThread[] extendedae_plus$getThreads();
@Accessor("threads")
@Accessor(value = "threads", remap = false)
@Mutable
void extendedae_plus$setThreads(CraftingThread[] threads);
@Accessor("internalInv")
@Accessor(value = "internalInv", remap = false)
@Mutable
void extendedae_plus$setInternalInv(InternalInventory inventory);
}

View File

@ -6,10 +6,10 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(TileAssemblerMatrixPattern.class)
@Mixin(value = TileAssemblerMatrixPattern.class, remap = false)
public interface TileAssemblerMatrixPatternAccessor {
@Accessor("patternInventory")
@Accessor(value = "patternInventory", remap = false)
@Mutable
void extendedae_plus$setPatternInventory(AppEngInternalInventory inventory);
}

View File

@ -16,10 +16,10 @@ import com.glodblock.github.extendedae.client.gui.GuiAssemblerMatrix;
import java.util.List;
import java.lang.reflect.Constructor;
@Mixin(targets = "com.glodblock.github.extendedae.client.gui.GuiAssemblerMatrix$PatternInfo")
@Mixin(targets = "com.glodblock.github.extendedae.client.gui.GuiAssemblerMatrix$PatternInfo", remap = false)
public abstract class GuiAssemblerMatrixPatternInfoMixin {
@Shadow
@Shadow(remap = false)
@Final
private List<Object> internalRows;
@ -41,7 +41,7 @@ public abstract class GuiAssemblerMatrixPatternInfoMixin {
}
}
@Inject(method = "<init>", at = @At("RETURN"))
@Inject(method = "<init>", at = @At("RETURN"), remap = false)
private void extendedae_plus$rebuildRows(long id, CallbackInfo ci) {
int invSize = TileAssemblerMatrixPattern.INV_SIZE;//样板核心槽位数变量
try {

View File

@ -12,19 +12,19 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.glodblock.github.extendedae.container.ContainerAssemblerMatrix;
@Mixin(targets = "com.glodblock.github.extendedae.container.ContainerAssemblerMatrix$PatternSlotTracker")
@Mixin(targets = "com.glodblock.github.extendedae.container.ContainerAssemblerMatrix$PatternSlotTracker", remap = false)
public abstract class ContainerAssemblerMatrixPatternSlotTrackerMixin {
@Shadow
@Shadow(remap = false)
@Final
private InternalInventory server;
@Shadow
@Shadow(remap = false)
@Final
@Mutable
private InternalInventory client;
@Inject(method = "<init>", at = @At("TAIL"))
@Inject(method = "<init>", at = @At("TAIL"), remap = false)
private void extendedae_plus$resizeClientInventory(TileAssemblerMatrixPattern host, CallbackInfo ci) {
this.client = new AppEngInternalInventory(this.server.size());
}