Skip to content

Commit

Permalink
Add optional AECapFix integration for proper part cap invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Apr 30, 2024
1 parent 4164f51 commit 2197c43
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ dependencies {
implementation(fg.deobf(libs.ae2.get()))
implementation(fg.deobf(libs.projecte.get()))

// implementation(fg.deobf(libs.aecapfix.get()))
compileOnly(fg.deobf(libs.aecapfix.get()))

runtimeOnly(fg.deobf(libs.projectex.get()))
runtimeOnly(fg.deobf(libs.teampe.get()))
runtimeOnly(fg.deobf(libs.jade.get()))
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ dependencyResolutionManagement {
version("projecte", "1.0.1")
library("projecte", "curse.maven", "projecte-226410").version("4901949-api-4901951")

library("aecapfix", "curse.maven", "aecapfix-914685").version("5017517")

library("projectex", "curse.maven", "project-expansion-579177").version("5232445")
library("teampe", "curse.maven", "team-projecte-689273").version("4882959")
library("jade", "curse.maven", "jade-324717").version("5072729")
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/gripe/_90/appliede/AppliedE.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLEnvironment;
Expand All @@ -33,6 +34,7 @@
import gripe._90.appliede.iface.EMCInterfaceBlockEntity;
import gripe._90.appliede.iface.EMCInterfaceMenu;
import gripe._90.appliede.iface.EMCInterfacePart;
import gripe._90.appliede.iface.EMCInterfacePartAECF;
import gripe._90.appliede.iface.EMCInterfaceScreen;
import gripe._90.appliede.key.EMCKeyType;
import gripe._90.appliede.key.EMCRenderer;
Expand Down Expand Up @@ -64,7 +66,9 @@ public final class AppliedE {
ITEMS.register("emc_interface", () -> new BlockItem(block, new Item.Properties()));
return block;
});
public static final RegistryObject<Item> CABLE_EMC_INTERFACE = ITEMS.register("cable_emc_interface", () -> part(EMCInterfacePart.class, EMCInterfacePart::new));
public static final RegistryObject<Item> CABLE_EMC_INTERFACE = ITEMS.register("cable_emc_interface", () -> ModList.get().isLoaded("aecapfix")
? part(EMCInterfacePartAECF.class, EMCInterfacePartAECF::new)
: part(EMCInterfacePart.class, EMCInterfacePart::new));

@SuppressWarnings("DataFlowIssue")
public static final RegistryObject<BlockEntityType<EMCInterfaceBlockEntity>> EMC_INTERFACE_BE = BE_TYPES.register("emc_interface", () -> {
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/gripe/_90/appliede/iface/EMCInterfacePartAECF.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package gripe._90.appliede.iface;

import appeng.api.parts.IPartItem;

import gripe._90.aecapfix.AECapFix;

public class EMCInterfacePartAECF extends EMCInterfacePart implements AECapFix.Invalidator {
public EMCInterfacePartAECF(IPartItem<?> partItem) {
super(partItem);
}

@Override
public void aecapfix$invalidate() {
getInterfaceLogic().invalidateCaps();
}
}

0 comments on commit 2197c43

Please sign in to comment.