mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-09-01 10:07:56 +00:00
Fabric lol
- Add support for Fabric. This is mostly pretty simple, though does require a lot more mixins than Forge. Half this diff is due to data generators: we run them separately as some aspects (recipes mostly) are different between the loaders. - Add integration with Iris (same as our Oculus support) and REI (mostly the same as our JEI support). - Generic peripherals only support inventories (or rather InventoryStorage) right now. Supporting more of the Fabric storage API is going to be tricky due to the slotted nature of the API: maybe something to revisit after Transfer API V3 (V4?, I've lost track). Note, this does /not/ mean I will be publishing a Fabric version of CC:T. My plan is to rebase CC:R on top of this, hopefully simplifying the maintenance work on their end and making the two mods a little more consistent.
This commit is contained in:
17
projects/fabric-api/build.gradle.kts
Normal file
17
projects/fabric-api/build.gradle.kts
Normal file
@@ -0,0 +1,17 @@
|
||||
plugins {
|
||||
id("cc-tweaked.publishing")
|
||||
id("cc-tweaked.fabric")
|
||||
}
|
||||
|
||||
val mcVersion: String by extra
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
cct.inlineProject(":common-api")
|
||||
|
||||
dependencies {
|
||||
api(project(":core-api"))
|
||||
compileOnly(project(":forge-stubs"))
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2022. This API may be redistributed unmodified and in full only.
|
||||
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||
*/
|
||||
package dan200.computercraft.api.detail;
|
||||
|
||||
import dan200.computercraft.impl.ComputerCraftAPIFabricService;
|
||||
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
|
||||
import net.fabricmc.fabric.api.transfer.v1.storage.StorageView;
|
||||
|
||||
/**
|
||||
* {@link DetailRegistry}s for Fabric's types.
|
||||
*
|
||||
* @see VanillaDetailRegistries Detail registries for vanilla types.
|
||||
*/
|
||||
public class FabricDetailRegistries {
|
||||
/**
|
||||
* Detail provider for {@link FluidVariant}s.
|
||||
*/
|
||||
public static final DetailRegistry<StorageView<FluidVariant>> FLUID_VARIANT = ComputerCraftAPIFabricService.get().getFluidDetailRegistry();
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2022. This API may be redistributed unmodified and in full only.
|
||||
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||
*/
|
||||
package dan200.computercraft.api.node.wired;
|
||||
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.network.wired.IWiredElement;
|
||||
import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
/**
|
||||
* {@linkplain BlockApiLookup Block API lookup} for {@link IWiredElement}s. This should be used to query wired elements
|
||||
* from a block.
|
||||
*/
|
||||
public final class WiredElementLookup {
|
||||
public static final ResourceLocation ID = new ResourceLocation(ComputerCraftAPI.MOD_ID, "wired_node");
|
||||
|
||||
private static final BlockApiLookup<IWiredElement, Direction> lookup = BlockApiLookup.get(ID, IWiredElement.class, Direction.class);
|
||||
|
||||
private WiredElementLookup() {
|
||||
}
|
||||
|
||||
public static BlockApiLookup<IWiredElement, Direction> get() {
|
||||
return lookup;
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of the public ComputerCraft API - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2022. This API may be redistributed unmodified and in full only.
|
||||
* For help using the API, and posting your mods, visit the forums at computercraft.info.
|
||||
*/
|
||||
package dan200.computercraft.api.peripheral;
|
||||
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
/**
|
||||
* {@linkplain BlockApiLookup Block API lookup} for {@link IPeripheral}s. This should be used to register peripherals
|
||||
* for a block. It should <em>NOT</em> be used to query peripherals.
|
||||
*/
|
||||
public final class PeripheralLookup {
|
||||
public static final ResourceLocation ID = new ResourceLocation(ComputerCraftAPI.MOD_ID, "peripheral");
|
||||
|
||||
private static final BlockApiLookup<IPeripheral, Direction> lookup = BlockApiLookup.get(ID, IPeripheral.class, Direction.class);
|
||||
|
||||
private PeripheralLookup() {
|
||||
}
|
||||
|
||||
public static BlockApiLookup<IPeripheral, Direction> get() {
|
||||
return lookup;
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.impl;
|
||||
|
||||
import dan200.computercraft.api.detail.DetailRegistry;
|
||||
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
|
||||
import net.fabricmc.fabric.api.transfer.v1.storage.StorageView;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* A Fabric-specific version of {@link ComputerCraftAPIService}.
|
||||
* <p>
|
||||
* Do <strong>NOT</strong> directly reference this class. It exists for internal use by the API.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public interface ComputerCraftAPIFabricService extends ComputerCraftAPIService {
|
||||
static ComputerCraftAPIFabricService get() {
|
||||
return (ComputerCraftAPIFabricService) ComputerCraftAPIService.get();
|
||||
}
|
||||
|
||||
DetailRegistry<StorageView<FluidVariant>> getFluidDetailRegistry();
|
||||
}
|
Reference in New Issue
Block a user