Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package pl.kuba6000.ae2webintegration.ae2interface.mixins.AE2.implementations;

import net.pedroksl.advanced_ae.common.cluster.AdvCraftingCPU;

import org.spongepowered.asm.mixin.Mixin;

import appeng.api.networking.crafting.ICraftingCPU;
Expand All @@ -15,97 +13,81 @@
import pl.kuba6000.ae2webintegration.core.interfaces.ICraftingCPUCluster;
import pl.kuba6000.ae2webintegration.core.interfaces.IItemList;

@Mixin(value = ICraftingCPU.class, remap = false)
public interface AECraftingCPUClusterMixin extends ICraftingCPUCluster {
@Mixin(value = CraftingCPUCluster.class, remap = false)
public class AECraftingCPUClusterMixin implements ICraftingCPUCluster {

@Override
default public void web$setInternalID(int id) {
public void web$setInternalID(int id) {
AE.cpuInternalIDMap.put(this, id);
}

@Override
default public boolean web$hasCustomName() {
public boolean web$hasCustomName() {
return !(((ICraftingCPU) this).getName() == null);
}

@Override
default public String web$getName() {
public String web$getName() {
return web$hasCustomName() ? ((ICraftingCPU) this).getName()
.getString() : ("CPU #" + AE.cpuInternalIDMap.getOrDefault(this, -1));
}

@Override
default public long web$getAvailableStorage() {
public long web$getAvailableStorage() {
return ((ICraftingCPU) this).getAvailableStorage();
}

@Override
default public long web$getUsedStorage() {
public long web$getUsedStorage() {
return -1L;
}

@Override
default public long web$getCoProcessors() {
public long web$getCoProcessors() {
return ((ICraftingCPU) this).getCoProcessors();
}

@Override
default public boolean web$isBusy() {
public boolean web$isBusy() {
return ((ICraftingCPU) this).isBusy();
}

@Override
default public void web$cancel() {
public void web$cancel() {
((ICraftingCPU) this).cancelJob();
}

@Override
default public IAEGenericStack web$getFinalOutput() {
public IAEGenericStack web$getFinalOutput() {
if (web$isBusy()) return (IAEGenericStack) (Object) ((ICraftingCPU) this).getJobStatus()
.crafting();
return null;
}

@Override
default public void web$getAllItems(IItemList list) {
if ((Object) this instanceof CraftingCPUCluster cpuCluster)
cpuCluster.craftingLogic.getAllItems((KeyCounter) (Object) list);
else if ((Object) this instanceof AdvCraftingCPU advCpu)
advCpu.craftingLogic.getAllItems((KeyCounter) (Object) list);
public void web$getAllItems(IItemList list) {
((CraftingCPUCluster) (Object) this).craftingLogic.getAllItems((KeyCounter) (Object) list);
}

@Override
default public long web$getActiveItems(IAEKey key) {
if ((Object) this instanceof CraftingCPUCluster cpuCluster)
return cpuCluster.craftingLogic.getWaitingFor((AEKey) key);
else if ((Object) this instanceof AdvCraftingCPU advCpu) return advCpu.craftingLogic.getWaitingFor((AEKey) key);
return 0L;
public long web$getActiveItems(IAEKey key) {
return ((CraftingCPUCluster) (Object) this).craftingLogic.getWaitingFor((AEKey) key);
}

@Override
default public long web$getPendingItems(IAEKey key) {
if ((Object) this instanceof CraftingCPUCluster cpuCluster)
return cpuCluster.craftingLogic.getPendingOutputs((AEKey) key);
else if ((Object) this instanceof AdvCraftingCPU advCpu) return advCpu.craftingLogic.getWaitingFor((AEKey) key);
return 0L;
public long web$getPendingItems(IAEKey key) {
return ((CraftingCPUCluster) (Object) this).craftingLogic.getPendingOutputs((AEKey) key);
}

@Override
default public long web$getStorageItems(IAEKey key) {
if ((Object) this instanceof CraftingCPUCluster cpuCluster)
return cpuCluster.craftingLogic.getStored((AEKey) key);
else if ((Object) this instanceof AdvCraftingCPU advCpu) return advCpu.craftingLogic.getWaitingFor((AEKey) key);
return 0L;
public long web$getStorageItems(IAEKey key) {
return ((CraftingCPUCluster) (Object) this).craftingLogic.getStored((AEKey) key);
}

@Override
default public IItemList web$getWaitingFor() {
if ((Object) this instanceof CraftingCPUCluster cpuCluster)
return (IItemList) (Object) ((ICraftingCPULogicAccessor) cpuCluster.craftingLogic).web$getJob()
.web$getWaitingFor().list;
else if ((Object) this instanceof AdvCraftingCPU advCpu)
return (IItemList) (Object) ((ICraftingCPULogicAccessor) advCpu.craftingLogic).web$getJob()
.web$getWaitingFor().list;
return (IItemList) (Object) new KeyCounter();
public IItemList web$getWaitingFor() {
return (IItemList) (Object) ((ICraftingCPULogicAccessor) ((CraftingCPUCluster) (Object) this).craftingLogic)
.web$getJob()
.web$getWaitingFor().list;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ public List<String> getMixins() {
if (FMLLoader.getLoadingModList()
.getModFileById("advanced_ae") != null) {
LOG.info("AdvancedAE detected !, applying mixins for AdvancedAE");
mixins.addAll(Arrays.asList("advanced_ae.CraftingCPULogicMixin", "advanced_ae.ExecutingCraftingJobMixin"));
mixins.addAll(
Arrays.asList(
"advanced_ae.CraftingCPULogicMixin",
"advanced_ae.ExecutingCraftingJobMixin",
"advanced_ae.AdvCraftingCPUMixin"));
}

return mixins;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package pl.kuba6000.ae2webintegration.ae2interface.mixins.advanced_ae;

import net.pedroksl.advanced_ae.common.cluster.AdvCraftingCPU;

import org.spongepowered.asm.mixin.Mixin;

import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.stacks.AEKey;
import appeng.api.stacks.KeyCounter;
import pl.kuba6000.ae2webintegration.ae2interface.accessors.ICraftingCPULogicAccessor;
import pl.kuba6000.ae2webintegration.ae2interface.implementations.AE;
import pl.kuba6000.ae2webintegration.core.interfaces.IAEGenericStack;
import pl.kuba6000.ae2webintegration.core.interfaces.IAEKey;
import pl.kuba6000.ae2webintegration.core.interfaces.ICraftingCPUCluster;
import pl.kuba6000.ae2webintegration.core.interfaces.IItemList;

@Mixin(value = AdvCraftingCPU.class, remap = false)
public class AdvCraftingCPUMixin implements ICraftingCPUCluster {

@Override
public void web$setInternalID(int id) {
AE.cpuInternalIDMap.put(this, id);
}

@Override
public boolean web$hasCustomName() {
return !(((ICraftingCPU) this).getName() == null);
}

@Override
public String web$getName() {
return web$hasCustomName() ? ((ICraftingCPU) this).getName()
.getString() : ("CPU #" + AE.cpuInternalIDMap.getOrDefault(this, -1));
}

@Override
public long web$getAvailableStorage() {
return ((ICraftingCPU) this).getAvailableStorage();
}

@Override
public long web$getUsedStorage() {
return -1L;
}

@Override
public long web$getCoProcessors() {
return ((ICraftingCPU) this).getCoProcessors();
}

@Override
public boolean web$isBusy() {
return ((ICraftingCPU) this).isBusy();
}

@Override
public void web$cancel() {
((ICraftingCPU) this).cancelJob();
}

@Override
public IAEGenericStack web$getFinalOutput() {
if (web$isBusy()) return (IAEGenericStack) (Object) ((ICraftingCPU) this).getJobStatus()
.crafting();
return null;
}

@Override
public void web$getAllItems(IItemList list) {
((AdvCraftingCPU) (Object) this).craftingLogic.getAllItems((KeyCounter) (Object) list);
}

@Override
public long web$getActiveItems(IAEKey key) {
return ((AdvCraftingCPU) (Object) this).craftingLogic.getWaitingFor((AEKey) key);
}

@Override
public long web$getPendingItems(IAEKey key) {
return ((AdvCraftingCPU) (Object) this).craftingLogic.getWaitingFor((AEKey) key);
}

@Override
public long web$getStorageItems(IAEKey key) {
return ((AdvCraftingCPU) (Object) this).craftingLogic.getWaitingFor((AEKey) key);
}

@Override
public IItemList web$getWaitingFor() {
return (IItemList) (Object) ((ICraftingCPULogicAccessor) ((AdvCraftingCPU) (Object) this).craftingLogic)
.web$getJob()
.web$getWaitingFor().list;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import pl.kuba6000.ae2webintegration.core.interfaces.service.IAECraftingGrid;

@Mixin(value = AdvCraftingCPULogic.class, remap = false)
public abstract class CraftingCPULogicMixin implements ICraftingCPULogicAccessor {
public class CraftingCPULogicMixin implements ICraftingCPULogicAccessor {

@Final
@Shadow
Expand Down
Loading