diff --git a/build.gradle b/build.gradle index 91baa7ff33d..46fffc3d4b1 100644 --- a/build.gradle +++ b/build.gradle @@ -408,7 +408,7 @@ dependencies { compileOnly("com.blamejared.recipestages:RecipeStages:${recipe_stages_version}") compileOnly("curse.maven:opencomputers2-437654:${oc2_id}") compileOnly("cc.tweaked:cc-tweaked-${previous_minor_minecraft_version}-forge-api:${cc_tweaked_version}") - //localRuntime("cc.tweaked:cc-tweaked-${minecraft_version}-forge:${cc_tweaked_version}") + //localRuntime("cc.tweaked:cc-tweaked-${previous_minor_minecraft_version}-forge:${cc_tweaked_version}") compileOnly("curse.maven:female-gender-forge-481655:${wildfire_gender_mod_id}") compileOnly("curse.maven:framedblocks-441647:${framedblocks_mod_id}") diff --git a/src/main/java/mekanism/common/capabilities/Capabilities.java b/src/main/java/mekanism/common/capabilities/Capabilities.java index 7e9032896d4..a7bbaa18cf7 100644 --- a/src/main/java/mekanism/common/capabilities/Capabilities.java +++ b/src/main/java/mekanism/common/capabilities/Capabilities.java @@ -15,6 +15,7 @@ import mekanism.api.security.IEntitySecurityUtils; import mekanism.common.Mekanism; import mekanism.common.entity.EntityRobit; +import mekanism.common.integration.computer.ComputerCapabilityHelper; import mekanism.common.integration.energy.EnergyCompatUtils; import mekanism.common.lib.radiation.capability.RadiationEntity; import mekanism.common.registries.MekanismEntityTypes; @@ -98,6 +99,7 @@ public static void registerCapabilities(RegisterCapabilitiesEvent event) { TileEntityBoundingBlock.alwaysProxyCapability(event, IBlockSecurityUtils.INSTANCE.ownerCapability()); TileEntityBoundingBlock.alwaysProxyCapability(event, IBlockSecurityUtils.INSTANCE.securityCapability()); //Capabilities we need to proxy because some sub implementations use them + ComputerCapabilityHelper.addBoundingComputerCapabilities(event); TileEntityBoundingBlock.proxyCapability(event, ITEM.block()); for (BlockCapability capability : EnergyCompatUtils.getLoadedEnergyCapabilities()) { TileEntityBoundingBlock.proxyCapability(event, capability); diff --git a/src/main/java/mekanism/common/integration/computer/ComputerCapabilityHelper.java b/src/main/java/mekanism/common/integration/computer/ComputerCapabilityHelper.java index 0f066f72218..a5f84ef2acf 100644 --- a/src/main/java/mekanism/common/integration/computer/ComputerCapabilityHelper.java +++ b/src/main/java/mekanism/common/integration/computer/ComputerCapabilityHelper.java @@ -6,6 +6,7 @@ import mekanism.common.integration.computer.opencomputers2.OC2CapabilityHelper; import mekanism.common.registration.impl.TileEntityTypeDeferredRegister.BlockEntityTypeBuilder; import mekanism.common.tile.base.CapabilityTileEntity; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; public class ComputerCapabilityHelper { @@ -19,4 +20,15 @@ public static void addComput OC2CapabilityHelper.addCapability(builder, supportsComputer); } } + + public static void addBoundingComputerCapabilities(RegisterCapabilitiesEvent event) { + if (Mekanism.hooks.CCLoaded) { + //If ComputerCraft is loaded add the capability for it + CCCapabilityHelper.addBoundingComputerCapabilities(event); + } + if (Mekanism.hooks.OC2Loaded) { + //If OpenComputers2 is loaded add the capability for it + OC2CapabilityHelper.addBoundingComputerCapabilities(event); + } + } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/computer/computercraft/CCCapabilityHelper.java b/src/main/java/mekanism/common/integration/computer/computercraft/CCCapabilityHelper.java index 43cb96472a6..db033dbb1b7 100644 --- a/src/main/java/mekanism/common/integration/computer/computercraft/CCCapabilityHelper.java +++ b/src/main/java/mekanism/common/integration/computer/computercraft/CCCapabilityHelper.java @@ -9,9 +9,11 @@ import mekanism.common.integration.computer.ComputerFilterHelper; import mekanism.common.integration.computer.IComputerTile; import mekanism.common.registration.impl.TileEntityTypeDeferredRegister.BlockEntityTypeBuilder; +import mekanism.common.tile.TileEntityBoundingBlock; import mekanism.common.tile.base.CapabilityTileEntity; import net.minecraft.core.Direction; import net.neoforged.neoforge.capabilities.ICapabilityProvider; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; import org.jetbrains.annotations.Nullable; public class CCCapabilityHelper { @@ -32,6 +34,10 @@ public static void addCapabi builder.with(PeripheralCapability.get(), (ICapabilityProvider) PROVIDER, supportsComputer); } + public static void addBoundingComputerCapabilities(RegisterCapabilitiesEvent event) { + TileEntityBoundingBlock.proxyCapability(event, PeripheralCapability.get()); + } + public static void registerApis() { ComputerCraftAPI.registerAPIFactory(CCApiObject.create(ComputerEnergyHelper.class, "mekanismEnergyHelper")); ComputerCraftAPI.registerAPIFactory(CCApiObject.create(ComputerFilterHelper.class, "mekanismFilterHelper")); diff --git a/src/main/java/mekanism/common/integration/computer/opencomputers2/OC2CapabilityHelper.java b/src/main/java/mekanism/common/integration/computer/opencomputers2/OC2CapabilityHelper.java index 56aac2ddf83..af56f9e333e 100644 --- a/src/main/java/mekanism/common/integration/computer/opencomputers2/OC2CapabilityHelper.java +++ b/src/main/java/mekanism/common/integration/computer/opencomputers2/OC2CapabilityHelper.java @@ -4,6 +4,7 @@ import mekanism.common.integration.computer.IComputerTile; import mekanism.common.registration.impl.TileEntityTypeDeferredRegister.BlockEntityTypeBuilder; import mekanism.common.tile.base.CapabilityTileEntity; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; public class OC2CapabilityHelper { @@ -24,4 +25,8 @@ public static void addCapabi //TODO - 1.20.2: Reimplement when OC2 updates //builder.with(CAPABILITY, (ICapabilityProvider) PROVIDER, supportsComputer); } + + public static void addBoundingComputerCapabilities(RegisterCapabilitiesEvent event) { + //TileEntityBoundingBlock.proxyCapability(event, CAPABILITY); + } } \ No newline at end of file