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
8 changes: 8 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ dependencies {
implementation(neoforge.ae2)
compileOnly(neoforge.ae2wtlib)

// AE addons for compatibility //
compileOnly(neoforge.advancedae)

// Standard runtime mods //
localRuntime(neoforge.jade)
localRuntime(neoforge.spark)
localRuntime(neoforge.modernfix)


// Runtime Recipe Viewers //
localRuntime(neoforge.emi)

// Client-only runtime mods //
clientLocalRuntime(neoforge.embeddium)
//modClientLocalRuntime(forge.oculus)

// runtime test mods //
//localRuntime(neoforge.advancedae)
//localRuntime(neoforge.geckolib)

}
6 changes: 5 additions & 1 deletion gradle/forge.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
mixinExtras = "0.5.0-rc.3"

emi = "1.1.21+1.21.1"
ae2 = "19.2.4"
ae2 = "19.2.16"
theoneprobe = "1.20.1-10.0.1-3"

## modrinth maven ##
Expand All @@ -14,6 +14,8 @@ modernfix = "4SPHwiDB" # 5.24.3+mc1.21.1
## cursemaven ##
ae2wtlib = "6939030"
spark = "6225208"
advancedae = "7222372"
geckolib = "6659026"



Expand All @@ -30,5 +32,7 @@ modernfix = { module = "maven.modrinth:modernfix", version.ref = "mode

ae2wtlib = { module = "curse.maven:ae2wtlib-459929", version.ref = "ae2wtlib" }
spark = { module = "curse.maven:spark-361579", version.ref = "spark" }
advancedae = { module = "curse.maven:advancedae-1084104", version.ref = "advancedae" }
geckolib = { module = "curse.maven:geckolib-388172", version.ref = "geckolib" }

[bundles]
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
minecraft = "1.21.1"
neo = "21.1.169"
neo = "21.1.203"
parchment = "2024.11.17"
jetbrains-annotations = "26.0.1"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pl.kuba6000.ae2webintegration.ae2interface.implementations;

import java.util.Iterator;
import java.util.WeakHashMap;

import net.neoforged.neoforge.server.ServerLifecycleHooks;

Expand All @@ -11,10 +12,13 @@
import pl.kuba6000.ae2webintegration.core.interfaces.IAE;
import pl.kuba6000.ae2webintegration.core.interfaces.IAEGrid;
import pl.kuba6000.ae2webintegration.core.interfaces.IAEPlayerData;
import pl.kuba6000.ae2webintegration.core.interfaces.ICraftingCPUCluster;
import pl.kuba6000.ae2webintegration.core.interfaces.IItemList;

public class AE implements IAE {

public static WeakHashMap<ICraftingCPUCluster, Integer> cpuInternalIDMap = new WeakHashMap<>();

public static AE instance = new AE();

public static AE getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ public class CraftingCPULogicMixin implements ICraftingCPULogicAccessor {
@Shadow
CraftingCPUCluster cluster;

// @Shadow
// private void postCraftingStatusChange(final IAEItemStack diff) {
// throw new IllegalStateException("Mixin failed to apply");
// }

@Shadow
private ExecutingCraftingJob job;

Expand Down Expand Up @@ -82,23 +77,6 @@ public class CraftingCPULogicMixin implements ICraftingCPULogicAccessor {
.jobCancelled((IAEGrid) cluster.getGrid(), (ICraftingCPUCluster) (Object) cluster);
}

// @Inject(method = "cancel", at = @At("HEAD"))
// void ae2webintegration$cancel(CallbackInfo ci) {
// IAEMixinCallbacks.getInstance()
// .jobCancelled((IAEGrid) cluster.getGrid(), (ICraftingCPUCluster) this);
// }

// @Inject(
// method = "injectItems",
// at = @At(
// value = "INVOKE",
// target = "Lappeng/api/storage/data/IAEItemStack;setStackSize(J)Lappeng/api/storage/data/IAEStack;",
// shift = At.Shift.AFTER,
// ordinal = 2))
// void ae2webintegration$fixCpuCluster(CallbackInfoReturnable<IAEStack> cir, @Local(ordinal = 1) IAEItemStack is) {
// postCraftingStatusChange(is);
// }

@Redirect(
method = "executeCrafting",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,110 +1,111 @@
package pl.kuba6000.ae2webintegration.ae2interface.mixins.AE2.implementations;

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

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;

import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.stacks.AEKey;
import appeng.api.stacks.KeyCounter;
import appeng.me.cluster.implementations.CraftingCPUCluster;
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 = CraftingCPUCluster.class, remap = false)
public abstract class AECraftingCPUClusterMixin implements ICraftingCPUCluster {

@Unique
private int web$internalID = -1;
@Mixin(value = ICraftingCPU.class, remap = false)
public interface AECraftingCPUClusterMixin extends ICraftingCPUCluster {

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

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

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

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

@Unique
private boolean web$isUsedStorageAvailable = true;

@Unique
private boolean web$usedStorageInitialized = false;

@Override
public long web$getUsedStorage() {
default public long web$getUsedStorage() {
return -1L;
// if (!web$usedStorageInitialized) {
// web$usedStorageInitialized = true;
// try {
// appeng.me.cluster.implementations.CraftingCPUCluster.class.getDeclaredMethod("getUsedStorage");
// } catch (NoSuchMethodException e) {
// web$isUsedStorageAvailable = false;
// return -1L;
// }
// }
// if (!web$isUsedStorageAvailable) return -1L;
// return ((CraftingCPUCluster) (Object) this).getUsedStorage();
}

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

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

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

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

@Override
public void web$getAllItems(IItemList list) {
((CraftingCPUCluster) (Object) this).craftingLogic.getAllItems((KeyCounter) (Object) list);
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);
}

@Override
public long web$getActiveItems(IAEKey key) {
return ((CraftingCPUCluster) (Object) this).craftingLogic.getWaitingFor((AEKey) key);
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;
}

@Override
public long web$getPendingItems(IAEKey key) {
return ((CraftingCPUCluster) (Object) this).craftingLogic.getPendingOutputs((AEKey) key);
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;
}

@Override
public long web$getStorageItems(IAEKey key) {
return ((CraftingCPUCluster) (Object) this).craftingLogic.getStored((AEKey) key);
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;
}

@Override
public IItemList web$getWaitingFor() {
return (IItemList) (Object) ((ICraftingCPULogicAccessor) ((CraftingCPUCluster) (Object) this).craftingLogic)
.web$getJob()
.web$getWaitingFor().list;
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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.util.List;
import java.util.Set;

import net.neoforged.fml.loading.FMLLoader;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.lib.tree.ClassNode;
Expand Down Expand Up @@ -63,6 +65,12 @@ public List<String> getMixins() {

LOG.info("MIXING INTO AE2 LETS GOOOOOOOOOOOOOOOOOOOOOOOOO");

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"));
}

return mixins;
}

Expand Down
Loading