diff --git a/CHANGELOG.md b/CHANGELOG.md index 6429e284..8e5b96d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Before a release, `./gradlew releaseChangelog` turns *Unreleased* into the relea - Serial Port addon, with the recipe from 1.12.2 (quartz and I/O buses): lets computers use turret bases of tiers 2–4 (tier 5 bases accept them without it) - NeoForge 1.21.1 with OpenComputers: Rebooted: an Adapter next to a turret base offers it as the component `turret_base`, with the callbacks of 1.12.2 (targeting, trusted players, redstone mode, energy, turret aim, auto fire and forced shots) - Computer control: `setComputerControl(true)` stops a base's turrets from targeting on their own, so a computer aims and fires them (`isComputerControl` tells whether it is on) +- CC: Tweaked support: turret bases are the peripheral `turret_base`, with the computer commands of the Serial Port addon. - Range falloff (#539): turrets deal full damage up to a share of their range (`optimalRange`), then less down to `falloffDamage` at the end of the range; configurable per turret, off for the grenade, rocket, railgun and effect turrets - Turret tracking (#539): turrets turn at most `turnRate` degrees per tick towards their target and fire only once their aim is within `turrets.aimTolerance` (default 5 degrees); configurable per turret, instant for the arc, slowing, teleporter and melee turrets - Computer control with the range falloff and turn rate (#539): a computer's aim (`setTurretYawPitch`, `setAllYawPitch`) is still set at once, and forced shots and auto fire do not wait for the aim, but their damage gets the range falloff diff --git a/CLAUDE.md b/CLAUDE.md index 24470d1f..a4fc7237 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -54,6 +54,8 @@ Core gameplay: The library is a mod of its own (`omlib`), declared as a required dependency in the mod metadata, and built as a nested step of the mod build, see §4 "OMLib". - **OpenComputers: Rebooted** (`li.cil.oc:opencomputers`, from `maven.michiyo.me`), on the **`1.21.1-neoforge` node only** (approved by the user on 2026-11-04): compile-only against its `api` jar, never bundled, an optional dependency in `neoforge.mods.toml`; the full mod (Scala bundled inside, so no ScalableCatsForce) is in the NeoForge dev runs (`localRuntime`), on the NeoForge game test server and in `runenv/1.21.1-neoforge`, all non-transitive (its POM lists Create, AE2 and others it does not require). Gated on `opencomputers_version`, which only `versions/1.21.1-neoforge/gradle.properties` has; the code is loaded behind `isModLoaded("opencomputers")`. +- **CC: Tweaked** (`cc.tweaked`, from `maven.squiddev.cc`), on both nodes (approved by the user on 2026-11-27): compile-only against its `-api` jar, never bundled, an optional dependency in the loader metadata (`suggests` on Fabric, an optional dependency in `neoforge.mods.toml`); the full mod is in the dev runs (`modLocalRuntime` / `localRuntime`), on the game test servers and in `runenv`. + Gated on `cctweaked_version` in `versions//gradle.properties` (1.120.2: 1.121.0 needs NeoForge 21.1.265, 1.122.0 Loom 1.19); the code is loaded behind `isModLoaded("computercraft")`. - Nothing else without asking the user first. No Architectury, no Cloth Config, no Kotlin. @@ -228,7 +230,7 @@ The § numbers and headings of the moved sections are kept, so references such a | `src/main/java/omtteam/openmodularturrets/api/` | the turret API (adding turrets) | | `src/main/java/omtteam/openmodularturrets/security/` | security and trusted players; ownership for adventure maps | | `src/main/java/omtteam/openmodularturrets/config/` | config (Gson, `@Comment` / `@Range`), config versions | -| `src/main/java/omtteam/openmodularturrets/compat/` | the roadmap section "Sable contraptions" (poses, targeting in the plot frame, turret mount, Create movement, game tests) | +| `src/main/java/omtteam/openmodularturrets/compat/` | the CC: Tweaked peripheral (`computercraft/`) and the roadmap section "Sable contraptions" (poses, targeting in the plot frame, turret mount, Create movement, game tests) | | `src/main/` | §5 "Resources strategy" (assets, datagen, no AI images) and the data decision (NeoForge converts the Fabric data) | | `src/client/java/omtteam/openmodularturrets/client/` | §6 client package layout, client compat helpers, client decisions, Jade | | `src/gametest/` | game tests: framework, scenes, fake players, the loader-neutral test decisions, API test turrets | @@ -246,7 +248,7 @@ The § numbers and headings of the moved sections are kept, so references such a - Every variant (base tier, ammo type, upgrade, addon) is an **individual registered block/item** with a lowercase snake_case ID. `docs/id-mapping.md` maps the 1.12.2 IDs to the current ones. - Computers: **OpenComputers: Rebooted** is supported on `1.21.1-neoforge` only (the only node it exists for; added on 2026-11-04, decided by the user): the commands are loader-free in `core/computer` (`BaseComputerCommands`, a port of 1.12.2's, plus computer control), the OpenComputers driver and component are in `platform/neoforge/opencomputers` (see §6). - **ComputerCraft / CC: Tweaked** is still **out of scope** (ask before adding); a peripheral would reuse `BaseComputerCommands` as on 1.12.2. + **CC: Tweaked** is supported on both nodes (added on 2026-11-27, decided by the user): `compat/computercraft/TurretBasePeripheral` (one loader-free class, the peripheral `turret_base`, the same methods as the OpenComputers component) reuses `BaseComputerCommands`; only its registration is per loader (`platform//computercraft`). ### Designing APIs diff --git a/README.md b/README.md index 020347c5..cea0355a 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ The other Minecraft versions have their own branches: - Uses **Team Reborn Energy** on Fabric, so it works with energy from other Fabric tech mods; the NeoForge build uses its energy capability (FE) instead - Optional **Jade** support for turret bases and turrets, on both loaders - Optional **OpenComputers: Rebooted** support (NeoForge 1.21.1, the only version it exists for): turret bases are computer components, as on 1.12.2, with a Serial Port addon or on tier 5; computers can read and change targeting and trusted players and aim and fire the turrets themselves +- Optional **CC: Tweaked** support (both loaders): turret bases are the peripheral `turret_base`, with the same functions as the OpenComputers component and 1.12.2 ## Requirements diff --git a/build.fabric.gradle.kts b/build.fabric.gradle.kts index c183bcd8..e44d708d 100644 --- a/build.fabric.gradle.kts +++ b/build.fabric.gradle.kts @@ -69,6 +69,11 @@ repositories { forRepository { maven("https://maven.ryanhcode.dev/releases") { name = "Sable" } } filter { includeGroup("dev.ryanhcode.sable-companion") } } + // CC: Tweaked comes only from its own maven + exclusiveContent { + forRepository { maven("https://maven.squiddev.cc") { name = "CC-Tweaked" } } + filter { includeGroup("cc.tweaked") } + } } dependencies { @@ -87,6 +92,14 @@ dependencies { // Jade tooltips (optional, not bundled: the mod only registers the plugin when Jade is installed) modCompileOnly("maven.modrinth:jade:${property("jade_version")}") + // CC: Tweaked (optional, not bundled: the peripheral in compat/computercraft is only registered when it is + // installed): its API compile-only, the full mod in the dev runs and on the game test server for the peripheral test + findProperty("cctweaked_version")?.let { cc -> + val mc = property("minecraft_version") + modCompileOnly("cc.tweaked:cc-tweaked-$mc-fabric-api:$cc") + modLocalRuntime("cc.tweaked:cc-tweaked-$mc-fabric:$cc") + } + // Sable contraptions: Sable Companion is jar-in-jar and does nothing without Sable. Sable itself is // only in the dev client: its Fabric jar (2.0.6) does not load in a server environment (the Veil it bundles // requires client-only Fabric API modules), so the game tests run with Sable on NeoForge only. diff --git a/build.neoforge.gradle.kts b/build.neoforge.gradle.kts index 09cecb29..496f2d9f 100644 --- a/build.neoforge.gradle.kts +++ b/build.neoforge.gradle.kts @@ -84,6 +84,11 @@ repositories { forRepository { maven("https://maven.michiyo.me/releases/") { name = "OpenComputers" } } filter { includeGroup("li.cil.oc") } } + // CC: Tweaked comes only from its own maven + exclusiveContent { + forRepository { maven("https://maven.squiddev.cc") { name = "CC-Tweaked" } } + filter { includeGroup("cc.tweaked") } + } } dependencies { @@ -146,6 +151,17 @@ dependencies { "gametestCompileOnly"("li.cil.oc:opencomputers:$oc:api") { isTransitive = false } "gametestRuntimeOnly"("li.cil.oc:opencomputers:$oc") { isTransitive = false } } + + // CC: Tweaked: the turret base peripheral (compat/computercraft, platform/neoforge/computercraft) compiles against + // its API jars, never bundled, only used when CC: Tweaked is installed; the full mod is in the dev runs and on the + // GameTest server for its test. + (findProperty("cctweaked_version") as String?)?.let { cc -> + val mc = property("minecraft_version") + compileOnly("cc.tweaked:cc-tweaked-$mc-forge-api:$cc") + localRuntime("cc.tweaked:cc-tweaked-$mc-forge:$cc") + "gametestCompileOnly"("cc.tweaked:cc-tweaked-$mc-forge-api:$cc") + "gametestRuntimeOnly"("cc.tweaked:cc-tweaked-$mc-forge:$cc") + } } // The client half of the Jade plugin (client/compat/jade) compiles against it too, as with Loom's client source set configurations.named("clientCompileOnly") { extendsFrom(configurations.compileOnly.get()) } diff --git a/docs/architecture.md b/docs/architecture.md index c5f85bd0..318f409a 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -66,7 +66,7 @@ This is the only place where the two meet, and the reason the core can be tested | `settings.LogicSettings` | `config.ConfigLogicSettings` | config values (turret stats, base tiers, entity lists) | | `security.SecurityEnvironment` (OMLib) | `security.LevelSecurityEnvironment` (OMLib, with `OMTOwnershipSettings`) | scoreboard teams, operator rights | | `computer.ComputerTurrets` | `blockentity.base.BaseComputerTurrets` | the turrets on a base's faces: aim, auto fire, forced shot | -| `computer.PlayerNames` | `platform.neoforge.opencomputers.NeoForgePlayerNames` | a player's UUID by name (online, or a player who joined before), without asking Mojang | +| `computer.PlayerNames` | `platform.neoforge.opencomputers.NeoForgePlayerNames`, `compat.computercraft.ServerPlayerNames` | a player's UUID by name (online, or a player who joined before), without asking Mojang | All positions the core sees are in the base's coordinates. On a Sable contraption these are the coordinates of its plot, far away from where the base is shown: `BlockEntityBaseWorld` converts entity positions into them with the base's `core.world.Pose` (from `compat.SubLevelCompat`), and converts the start of a line-of-sight check back into the world. @@ -124,7 +124,7 @@ Packages below `omtteam.openmodularturrets` (main): | `config` | the JSON config: fields, comments, ranges, migration, the server's config on clients | | `security`, `camo` | the mod's ownership rules (`OMTOwnershipSettings`); the trust lists' Minecraft side (NBT, player lookup) is in OMLib, and camouflage rules | | `compat` | the porting helpers that keep call sites identical on the version branches (`VersionCompat`, `CompatBlockEntity`, networking, menus; `compat.nbt.NbtCompat` for all NBT reads and `compat.block.BlockCompat` depend on Minecraft only, so any package may use them), small loader differences (`//? if fabric` / `neoforge`), Jade (server half here, tooltips in `client.compat.jade`), and Sable contraptions (`SubLevelCompat`: poses and velocities through Sable Companion; `client.compat.ClientSubLevelCompat` for the drawn pose) | -| `platform` | the loader services shared code calls (`Platform`: `LoaderInfo`, `Fuel`, `Network`, `Menus`, `Energy`); `platform.fabric` / `platform.neoforge` hold the entrypoints, the implementations and the energy/item adapters, and only compile for their loader; `platform.neoforge.opencomputers` is the OpenComputers: Rebooted driver and component | +| `platform` | the loader services shared code calls (`Platform`: `LoaderInfo`, `Fuel`, `Network`, `Menus`, `Energy`); `platform.fabric` / `platform.neoforge` hold the entrypoints, the implementations and the energy/item adapters, and only compile for their loader; `platform.neoforge.opencomputers` is the OpenComputers: Rebooted driver and component; `platform..computercraft` registers the CC: Tweaked peripheral | | `datagen` | recipes, loot tables, tags, damage types (Fabric only; the NeoForge build converts the Fabric output) | `./gradlew dependencyMap` draws these packages and every import between them as an interactive page. @@ -234,6 +234,10 @@ A computer reaches a turret base through three layers: 3. The mod integration, per loader: `platform.neoforge.opencomputers` (OpenComputers: Rebooted exists for NeoForge 1.21.1 only). `OMTNeoForge` registers `TurretBaseDriver` at common setup when OpenComputers is installed (`OpenComputersCompat`); an Adapter next to a base gets a `TurretBaseEnvironment`, the component `turret_base`, whose callbacks (1.12.2's names and docs) turn OpenComputers' arguments into plain values and call the commands. They are not direct, so OpenComputers runs them on the server thread. + **CC: Tweaked** (both loaders, `compat.computercraft`): `TurretBasePeripheral` is the peripheral `turret_base`, one class for both loaders; its `@LuaFunction(mainThread = true)` methods have the names of the OpenComputers component (`changeAccessLevel` and `forceShootAllTurrets` of 1.12.2 as well) and call the same commands, so CC runs them on the server thread. + Only the registration is per loader, and only when `computercraft` is loaded: `platform.fabric.computercraft.FabricComputerCraft` (`PeripheralLookup`) and `platform.neoforge.computercraft.NeoForgeComputerCraft` (`PeripheralCapability`, in `RegisterCapabilitiesEvent`). + `ServerPlayerNames` reads the server's `usercache.json` itself, as the profile cache has no lookup that never asks Mojang. + CC: Tweaked is compile-only (its API from `maven.squiddev.cc`, never bundled), and the full mod runs in the dev runs and on the game test servers (`cctweaked_version` in `versions//gradle.properties`). ## How to add … diff --git a/src/gametest/CLAUDE.md b/src/gametest/CLAUDE.md index 975f7e4c..c7ed3bfc 100644 --- a/src/gametest/CLAUDE.md +++ b/src/gametest/CLAUDE.md @@ -27,6 +27,7 @@ This branch needs no per-batch game rules (unlike `1.21.11`; root `CLAUDE.md`, " A local test run keeps its config file, and the merge keeps old values of addon turrets: delete `versions/1.21.1-fabric/build/run/gameTest/config/openmodularturrets*` and `versions/1.21.1-neoforge/run/config/openmodularturrets*` after a default changes. - `BaseGuiGameTests` clicks a base through `ServerPlayerGameMode#useItemOn` (the real server path, including the loader's block-use event) and checks that the menu opens for the owner only. The loaders' `FakePlayer`s refuse to open menus, so the test uses `GuiTestPlayer`, a small subclass that opens them without sending a packet (NeoForge opens block menus through the two-argument `openMenu`, which it overrides too); `CamoMenuGameTests` uses it for the camouflage menu and its "Back" to the base GUI. +- `ComputerCraftGameTests` (batch `computercraft`) finds the peripheral through each loader's real CC lookup (`PeripheralLookup` / `PeripheralCapability`) and calls its methods with `ObjectArguments`; CC: Tweaked itself runs on both test servers (`cctweaked_version`). - `TrustListGameTests`, `CamoMenuGameTests` and the light tests in `CamoGameTests` call OMLib's packet handlers (`TrustPacketHandler`, `CamoPacketHandler`) directly with fake players placed next to the block, as the server does on a packet, and check permission, reach and the access level steps. Fake players are not on the server's player list, so the test that adds an online player by name puts one there for the (synchronous) request only (`TrustListGameTests.online`), on Fabric only: NeoForge returns a read-only view of the list, and vanilla's mock players would log in for real (on the NeoForge test server Simulated sends them a payload that NeoForge refuses, which fails the test). Names of players who are not online go to the server's name cache, which the test server does not have (not found). diff --git a/src/gametest/java/omtteam/openmodularturrets/gametest/ComputerCraftGameTests.java b/src/gametest/java/omtteam/openmodularturrets/gametest/ComputerCraftGameTests.java new file mode 100644 index 00000000..a0fe2f5c --- /dev/null +++ b/src/gametest/java/omtteam/openmodularturrets/gametest/ComputerCraftGameTests.java @@ -0,0 +1,134 @@ +package omtteam.openmodularturrets.gametest; + +//? if neoforge { +/*import net.neoforged.neoforge.gametest.GameTestHolder; +import net.neoforged.neoforge.gametest.PrefixGameTestTemplate; +*///?} +//? if neoforge { +/*import omtteam.openmodularturrets.OMT; +*///?} +import dan200.computercraft.api.lua.LuaException; +import dan200.computercraft.api.lua.MethodResult; +import dan200.computercraft.api.lua.ObjectArguments; +import dan200.computercraft.api.peripheral.IPeripheral; +//? if fabric { +import dan200.computercraft.api.peripheral.PeripheralLookup; +//?} +//? if neoforge { +/*import dan200.computercraft.api.peripheral.PeripheralCapability; +*///?} +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.world.level.block.Blocks; +import omtteam.omlib.core.security.PlayerIdentity; +import omtteam.openmodularturrets.blockentity.TurretBaseBlockEntity; +import omtteam.openmodularturrets.compat.computercraft.TurretBasePeripheral; +import omtteam.openmodularturrets.core.computer.BaseComputerCommands; +import omtteam.openmodularturrets.registry.ModBlocks; + +import java.util.Arrays; +import java.util.UUID; + +/** + * The CC: Tweaked peripheral of the turret base (CC: Tweaked is on the game test server of both loaders). The + * loader's own peripheral lookup (what a computer or wired modem asks) finds the base and names the peripheral + * {@code turret_base}, and the methods work with arguments as CC passes them (Lua numbers as doubles). The commands + * themselves are tested in the unit tests of {@code BaseComputerCommands} and in {@code ComputerControlGameTests}. + */ +//? if neoforge { +/*@GameTestHolder(OMT.MOD_ID) +@PrefixGameTestTemplate(false) +*///?} +@SuppressWarnings("unused") +public class ComputerCraftGameTests implements OMTGameTests { + private static final BlockPos TIER_FIVE = new BlockPos(1, 1, 1); + private static final BlockPos TIER_ONE = new BlockPos(4, 1, 1); + private static final PlayerIdentity OWNER = new PlayerIdentity(UUID.randomUUID(), "CcTestOwner"); + + @GameTest(template = EMPTY_STRUCTURE, batch = "computercraft") + public void computersFindTheTurretBasePeripheral(GameTestHelper helper) { + BlockPos pos = helper.absolutePos(TIER_FIVE); + TurretBaseBlockEntity base = base(helper, TIER_FIVE, ModBlocks.TURRET_BASES.size() - 1); + try { + for (Direction side : Direction.values()) { + IPeripheral peripheral = lookup(helper, pos, side); + helper.assertTrue(peripheral != null, "CC: Tweaked has no peripheral on the " + side + " side of the base"); + helper.assertTrue(BaseComputerCommands.TYPE.equals(peripheral.getType()), + "The peripheral is not a turret_base: " + peripheral.getType()); + helper.assertTrue(peripheral.getTarget() == base, "The peripheral's target is not the base"); + helper.assertTrue(peripheral.equals(lookup(helper, pos, Direction.UP)), + "Two peripherals of one base are not equal, so a computer would detach and attach again"); + } + } finally { + helper.setBlock(TIER_FIVE, Blocks.AIR); + } + helper.succeed(); + } + + @GameTest(template = EMPTY_STRUCTURE, batch = "computercraft") + public void methodsControlTheBase(GameTestHelper helper) throws LuaException { + TurretBaseBlockEntity base = base(helper, TIER_FIVE, ModBlocks.TURRET_BASES.size() - 1); + TurretBaseBlockEntity tierOne = base(helper, TIER_ONE, 0); + try { + TurretBasePeripheral peripheral = TurretBasePeripheral.of(base); + helper.assertTrue(peripheral != null, "No peripheral for a base on a server level"); + assertResult(helper, peripheral.getOwner(args()), OWNER.name(), "getOwner"); + assertResult(helper, peripheral.setComputerControl(args(true)), true, "setComputerControl"); + helper.assertTrue(base.getLogic().isComputerControlled(), "setComputerControl did not reach the base"); + assertResult(helper, peripheral.isComputerControl(args()), true, "isComputerControl"); + assertResult(helper, peripheral.setAttacksMobs(args(false)), true, "setAttacksMobs"); + assertResult(helper, peripheral.isAttacksMobs(args()), false, "isAttacksMobs"); + assertResult(helper, peripheral.getMaxEnergyStorage(args()), base.getLogic().getEnergy().getCapacity(), + "getMaxEnergyStorage"); + // neither online nor in the server's name cache + assertResult(helper, peripheral.addTrustedPlayer(args("Never_Joined_OMT")), "Name not valid!", + "addTrustedPlayer of an unknown name"); + helper.assertTrue(peripheral.getMode().getResult() != null, "getMode returned nothing"); + + TurretBasePeripheral denied = TurretBasePeripheral.of(tierOne); + assertResult(helper, denied.getOwner(args()), BaseComputerCommands.NO_ACCESS, "getOwner on tier 1"); + assertResult(helper, denied.setComputerControl(args(true)), BaseComputerCommands.NO_ACCESS, + "setComputerControl on tier 1"); + helper.assertFalse(tierOne.getLogic().isComputerControlled(), "A tier 1 base accepted computer control"); + } finally { + helper.setBlock(TIER_FIVE, Blocks.AIR); + helper.setBlock(TIER_ONE, Blocks.AIR); + } + helper.succeed(); + } + + /** A base of the given tier index with {@link #OWNER} at {@code pos}. */ + private static TurretBaseBlockEntity base(GameTestHelper helper, BlockPos pos, int tierIndex) { + helper.setBlock(pos, ModBlocks.TURRET_BASES.get(tierIndex)); + TurretBaseBlockEntity base = (TurretBaseBlockEntity) helper.getLevel().getBlockEntity(helper.absolutePos(pos)); + base.getTrustManager().setOwner(OWNER); + return base; + } + + /** What a computer next to {@code pos} would get, through the loader's own lookup. */ + private static IPeripheral lookup(GameTestHelper helper, BlockPos pos, Direction side) { +//? if fabric { + return PeripheralLookup.get().find(helper.getLevel(), pos, side); +//?} +//? if neoforge { + /*return helper.getLevel().getCapability(PeripheralCapability.get(), pos, side); +*///?} + } + + /** The first value of a method's result equals {@code expected} (numbers compared as doubles). */ + private static void assertResult(GameTestHelper helper, MethodResult result, Object expected, String call) { + Object[] values = result.getResult(); + helper.assertTrue(values != null && values.length > 0, call + " returned nothing"); + Object actual = values[0]; + boolean equal = expected instanceof Number number && actual instanceof Number value + ? number.doubleValue() == value.doubleValue() + : expected.equals(actual); + helper.assertTrue(equal, call + " returned " + Arrays.toString(values) + ", expected " + expected); + } + + private static ObjectArguments args(Object... values) { + return new ObjectArguments(values); + } +} diff --git a/src/gametest/resources/fabric.mod.json b/src/gametest/resources/fabric.mod.json index bc1a68c2..43204d88 100644 --- a/src/gametest/resources/fabric.mod.json +++ b/src/gametest/resources/fabric.mod.json @@ -28,7 +28,8 @@ "omtteam.openmodularturrets.gametest.SolarPanelGameTests", "omtteam.openmodularturrets.gametest.ExpanderGameTests", "omtteam.openmodularturrets.gametest.AmmoSortGameTests", - "omtteam.openmodularturrets.gametest.ComputerControlGameTests" + "omtteam.openmodularturrets.gametest.ComputerControlGameTests", + "omtteam.openmodularturrets.gametest.ComputerCraftGameTests" ], "openmodularturrets": [ "omtteam.openmodularturrets.gametest.ApiTestTurrets" diff --git a/src/main/java/omtteam/openmodularturrets/CLAUDE.md b/src/main/java/omtteam/openmodularturrets/CLAUDE.md index 08acc1f1..2488eb21 100644 --- a/src/main/java/omtteam/openmodularturrets/CLAUDE.md +++ b/src/main/java/omtteam/openmodularturrets/CLAUDE.md @@ -35,10 +35,11 @@ omtteam.openmodularturrets ├── menu/ # TurretBaseMenu, GeneratorMenu ├── network/ # OMTPackets, BasePackets + BasePacketHandler (C2S), RayPacket (S2C) ├── config/ # self-written config (JSON via Gson, OMLib's machinery), no library -├── compat/ # SubLevelCompat (Sable), jade/ (server half); the porting helpers are in OMLib +├── compat/ # SubLevelCompat (Sable), jade/ (server half), computercraft/ (the CC: Tweaked peripheral turret_base); the porting helpers are in OMLib ├── mixin/ # LivingEntityMixin ├── platform/ # fabric/, neoforge/: entrypoints, services, adapters (each built for its loader only); -│ # neoforge/opencomputers: the OpenComputers: Rebooted driver and turret_base component +│ # neoforge/opencomputers: the OpenComputers: Rebooted driver and turret_base component; +│ # /computercraft: registers the CC: Tweaked peripheral └── datagen/ # recipes, loot tables, tags, damage types (Fabric only) ``` diff --git a/src/main/java/omtteam/openmodularturrets/compat/computercraft/ServerPlayerNames.java b/src/main/java/omtteam/openmodularturrets/compat/computercraft/ServerPlayerNames.java new file mode 100644 index 00000000..2403597a --- /dev/null +++ b/src/main/java/omtteam/openmodularturrets/compat/computercraft/ServerPlayerNames.java @@ -0,0 +1,65 @@ +package omtteam.openmodularturrets.compat.computercraft; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import omtteam.omlib.core.security.PlayerIdentity; +import omtteam.omlib.security.PlayerAdapter; +import omtteam.openmodularturrets.core.computer.PlayerNames; + +import java.io.IOException; +import java.io.Reader; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Optional; +import java.util.UUID; + +/** + * Player names for computers on both loaders: a player online on {@code server}, else one in the server's + * {@code usercache.json} (every player who joined before and whose entry has not expired). The file is read here + * because the profile cache only offers lookups that ask Mojang for an unknown name, and a computer's call runs on + * the server thread; a missing or unreadable file means no cached players. Names match without regard to case. + */ +final class ServerPlayerNames implements PlayerNames { + private static final String CACHE_FILE = "usercache.json"; + + private final MinecraftServer server; + + ServerPlayerNames(MinecraftServer server) { + this.server = server; + } + + @Override + public Optional find(String name) { + for (ServerPlayer player : server.getPlayerList().getPlayers()) { + PlayerIdentity identity = PlayerAdapter.identity(player); + if (identity.name().equalsIgnoreCase(name)) { + return Optional.of(identity); + } + } + return cached(name); + } + + private Optional cached(String name) { + Path file = server.getFile(CACHE_FILE); + if (!Files.isRegularFile(file)) { + return Optional.empty(); + } + try (Reader reader = Files.newBufferedReader(file, StandardCharsets.UTF_8)) { + for (JsonElement entry : JsonParser.parseReader(reader).getAsJsonArray()) { + JsonObject object = entry.getAsJsonObject(); + if (object.get("name").getAsString().equalsIgnoreCase(name)) { + return Optional.of(new PlayerIdentity(UUID.fromString(object.get("uuid").getAsString()), + object.get("name").getAsString())); + } + } + } catch (IOException | RuntimeException e) { + // unreadable or malformed cache: the same as an unknown name + return Optional.empty(); + } + return Optional.empty(); + } +} diff --git a/src/main/java/omtteam/openmodularturrets/compat/computercraft/TurretBasePeripheral.java b/src/main/java/omtteam/openmodularturrets/compat/computercraft/TurretBasePeripheral.java new file mode 100644 index 00000000..08b46a9d --- /dev/null +++ b/src/main/java/omtteam/openmodularturrets/compat/computercraft/TurretBasePeripheral.java @@ -0,0 +1,206 @@ +package omtteam.openmodularturrets.compat.computercraft; + +import dan200.computercraft.api.lua.IArguments; +import dan200.computercraft.api.lua.LuaException; +import dan200.computercraft.api.lua.LuaFunction; +import dan200.computercraft.api.lua.MethodResult; +import dan200.computercraft.api.peripheral.IPeripheral; +import net.minecraft.server.MinecraftServer; +import omtteam.openmodularturrets.blockentity.TurretBaseBlockEntity; +import omtteam.openmodularturrets.blockentity.base.BaseComputerTurrets; +import omtteam.openmodularturrets.core.computer.BaseComputerCommands; +import omtteam.openmodularturrets.core.computer.BaseComputerCommands.Command; +import omtteam.openmodularturrets.core.computer.PlayerNames; +import org.jetbrains.annotations.Nullable; + +/** + * The peripheral {@code turret_base} of one turret base for CC: Tweaked (the same on Fabric and NeoForge; only its + * registration is per loader, see {@code platform//computercraft}). The methods have the names, arguments and + * results of the 1.12.2 peripheral; the OpenComputers component's names ({@code TurretBaseEnvironment}: + * {@code changeTrustedPlayerAccess}, {@code forceShootAll}) work as aliases. The commands are + * {@link BaseComputerCommands}, so whether a computer may use the base is up to it + * ({@code TurretBaseLogic.acceptsComputers()}, checked by every command). Every method runs on the server thread, as it + * changes or reads the world. The peripheral keeps no state: a computer attached to two sides of one base uses the same + * commands on the same base. + */ +public final class TurretBasePeripheral implements IPeripheral { + private final TurretBaseBlockEntity base; + private final BaseComputerCommands commands; + + /** + * @param base the base + * @param names resolves the names given to {@code addTrustedPlayer} + */ + public TurretBasePeripheral(TurretBaseBlockEntity base, PlayerNames names) { + this.base = base; + this.commands = new BaseComputerCommands(base.getLogic(), new BaseComputerTurrets(base), names); + } + + /** + * A peripheral for the base, or null when its level is no server's (a computer only exists on a server). + */ + @Nullable + public static TurretBasePeripheral of(TurretBaseBlockEntity base) { + if (base.getLevel() == null) { + return null; + } + MinecraftServer server = base.getLevel().getServer(); + return server == null ? null : new TurretBasePeripheral(base, new ServerPlayerNames(server)); + } + + @Override + public String getType() { + return BaseComputerCommands.TYPE; + } + + /** Two peripherals of one base are the same peripheral, so a computer does not detach and attach again. */ + @Override + public boolean equals(@Nullable IPeripheral other) { + return this == other || other instanceof TurretBasePeripheral peripheral && peripheral.base == base; + } + + @Override + public Object getTarget() { + return base; + } + + private MethodResult call(Command command, IArguments args) throws LuaException { + return MethodResult.of((Object[]) commands.call(command, args.getAll())); + } + + @LuaFunction(mainThread = true) + public MethodResult getOwner(IArguments args) throws LuaException { + return call(Command.getOwner, args); + } + + @LuaFunction(mainThread = true) + public MethodResult isAttacksMobs(IArguments args) throws LuaException { + return call(Command.isAttacksMobs, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setAttacksMobs(IArguments args) throws LuaException { + return call(Command.setAttacksMobs, args); + } + + @LuaFunction(mainThread = true) + public MethodResult isAttacksNeutrals(IArguments args) throws LuaException { + return call(Command.isAttacksNeutrals, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setAttacksNeutrals(IArguments args) throws LuaException { + return call(Command.setAttacksNeutrals, args); + } + + @LuaFunction(mainThread = true) + public MethodResult isAttacksPlayers(IArguments args) throws LuaException { + return call(Command.isAttacksPlayers, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setAttacksPlayers(IArguments args) throws LuaException { + return call(Command.setAttacksPlayers, args); + } + + @LuaFunction(mainThread = true) + public MethodResult getTrustedPlayers(IArguments args) throws LuaException { + return call(Command.getTrustedPlayers, args); + } + + @LuaFunction(mainThread = true) + public MethodResult getTrustedPlayer(IArguments args) throws LuaException { + return call(Command.getTrustedPlayer, args); + } + + @LuaFunction(mainThread = true) + public MethodResult addTrustedPlayer(IArguments args) throws LuaException { + return call(Command.addTrustedPlayer, args); + } + + @LuaFunction(mainThread = true) + public MethodResult removeTrustedPlayer(IArguments args) throws LuaException { + return call(Command.removeTrustedPlayer, args); + } + + @LuaFunction(value = {"changeAccessLevel", "changeTrustedPlayerAccess"}, mainThread = true) + public MethodResult changeAccessLevel(IArguments args) throws LuaException { + return call(Command.changeAccessLevel, args); + } + + /** {@code getType()} of the 1.12.2 peripheral (not {@link #getType()}, which CC reads as the peripheral type). */ + @LuaFunction(value = "getType", mainThread = true) + public MethodResult typeName(IArguments args) throws LuaException { + return call(Command.getType, args); + } + + @LuaFunction(mainThread = true) + public MethodResult getMaxEnergyStorage(IArguments args) throws LuaException { + return call(Command.getMaxEnergyStorage, args); + } + + @LuaFunction(mainThread = true) + public MethodResult getCurrentEnergyStorage(IArguments args) throws LuaException { + return call(Command.getCurrentEnergyStorage, args); + } + + @LuaFunction(mainThread = true) + public MethodResult getActive(IArguments args) throws LuaException { + return call(Command.getActive, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setMode(IArguments args) throws LuaException { + return call(Command.setMode, args); + } + + @LuaFunction(mainThread = true) + public MethodResult getMode() { + return MethodResult.of((Object[]) commands.modeDescription()); + } + + @LuaFunction(mainThread = true) + public MethodResult getRedstone(IArguments args) throws LuaException { + return call(Command.getRedstone, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setAllYawPitch(IArguments args) throws LuaException { + return call(Command.setAllYawPitch, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setTurretYawPitch(IArguments args) throws LuaException { + return call(Command.setTurretYawPitch, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setAllAutoForceFire(IArguments args) throws LuaException { + return call(Command.setAllAutoForceFire, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setTurretAutoForceFire(IArguments args) throws LuaException { + return call(Command.setTurretAutoForceFire, args); + } + + @LuaFunction(value = {"forceShootAllTurrets", "forceShootAll"}, mainThread = true) + public MethodResult forceShootAllTurrets(IArguments args) throws LuaException { + return call(Command.forceShootAllTurrets, args); + } + + @LuaFunction(mainThread = true) + public MethodResult forceShootTurret(IArguments args) throws LuaException { + return call(Command.forceShootTurret, args); + } + + @LuaFunction(mainThread = true) + public MethodResult setComputerControl(IArguments args) throws LuaException { + return call(Command.setComputerControl, args); + } + + @LuaFunction(mainThread = true) + public MethodResult isComputerControl(IArguments args) throws LuaException { + return call(Command.isComputerControl, args); + } +} diff --git a/src/main/java/omtteam/openmodularturrets/platform/fabric/OMTFabric.java b/src/main/java/omtteam/openmodularturrets/platform/fabric/OMTFabric.java index d2c62edf..64e1883d 100644 --- a/src/main/java/omtteam/openmodularturrets/platform/fabric/OMTFabric.java +++ b/src/main/java/omtteam/openmodularturrets/platform/fabric/OMTFabric.java @@ -6,6 +6,7 @@ import net.fabricmc.loader.api.FabricLoader; import omtteam.openmodularturrets.api.OMTPlugin; import omtteam.openmodularturrets.entity.projectile.KillCounter; +import omtteam.openmodularturrets.platform.fabric.computercraft.FabricComputerCraft; import omtteam.openmodularturrets.registry.TurretRegistry; import omtteam.openmodularturrets.registry.ModBlockEntities; import omtteam.openmodularturrets.startup.OMTStartup; @@ -23,6 +24,9 @@ public void onInitialize() { OMTStartup.registrationSteps().forEach(step -> step.register().run()); FabricBlockLookups.register(ModBlockEntities.transferTypes()); FabricModuleEnabledCondition.register(); + if (FabricLoader.getInstance().isModLoaded(FabricComputerCraft.MOD_ID)) { + FabricComputerCraft.register(); + } ServerLivingEntityEvents.AFTER_DEATH.register(KillCounter::onDeath); } diff --git a/src/main/java/omtteam/openmodularturrets/platform/fabric/computercraft/FabricComputerCraft.java b/src/main/java/omtteam/openmodularturrets/platform/fabric/computercraft/FabricComputerCraft.java new file mode 100644 index 00000000..18c46b6e --- /dev/null +++ b/src/main/java/omtteam/openmodularturrets/platform/fabric/computercraft/FabricComputerCraft.java @@ -0,0 +1,24 @@ +package omtteam.openmodularturrets.platform.fabric.computercraft; + +import dan200.computercraft.api.peripheral.PeripheralLookup; +import omtteam.openmodularturrets.OMT; +import omtteam.openmodularturrets.compat.computercraft.TurretBasePeripheral; +import omtteam.openmodularturrets.registry.ModBlockEntities; + +/** + * CC: Tweaked on Fabric: a computer next to a turret base (or a wired modem on it) sees the peripheral + * {@code turret_base}. Only loaded when CC: Tweaked is installed (compile-only, never bundled). + */ +public final class FabricComputerCraft { + public static final String MOD_ID = "computercraft"; + + private FabricComputerCraft() { + } + + /** Registers the peripheral for the turret base block entity, on every side. */ + public static void register() { + PeripheralLookup.get().registerForBlockEntity((base, side) -> TurretBasePeripheral.of(base), + ModBlockEntities.TURRET_BASE); + OMT.LOGGER.info("CC: Tweaked found: turret bases are peripherals (turret_base)"); + } +} diff --git a/src/main/java/omtteam/openmodularturrets/platform/neoforge/OMTNeoForge.java b/src/main/java/omtteam/openmodularturrets/platform/neoforge/OMTNeoForge.java index a1a113ba..770d2f4e 100644 --- a/src/main/java/omtteam/openmodularturrets/platform/neoforge/OMTNeoForge.java +++ b/src/main/java/omtteam/openmodularturrets/platform/neoforge/OMTNeoForge.java @@ -17,6 +17,7 @@ import omtteam.openmodularturrets.api.OMTPlugin; import omtteam.openmodularturrets.compat.ModuleEnabledCondition; import omtteam.openmodularturrets.entity.projectile.KillCounter; +import omtteam.openmodularturrets.platform.neoforge.computercraft.NeoForgeComputerCraft; import omtteam.openmodularturrets.platform.neoforge.opencomputers.OpenComputersCompat; import omtteam.omlib.platform.Platform; import omtteam.omlib.registry.RegistrationStep; @@ -41,8 +42,12 @@ public OMTNeoForge(IEventBus modBus) { OMTStartup.init(NeoForgePlugins.find(OMTPlugin.Register.class, OMTPlugin.class, TurretRegistry.Plugin::new)); modBus.addListener(this::onRegister); modBus.addListener(this::onCommonSetup); - modBus.addListener((RegisterCapabilitiesEvent event) -> - NeoForgeCapabilities.register(event, ModBlockEntities.transferTypes())); + modBus.addListener((RegisterCapabilitiesEvent event) -> { + NeoForgeCapabilities.register(event, ModBlockEntities.transferTypes()); + if (Platform.loaderInfo().isModLoaded(NeoForgeComputerCraft.MOD_ID)) { + NeoForgeComputerCraft.register(event); + } + }); modBus.addListener((RegisterPayloadHandlersEvent event) -> ((NeoForgeNetwork) Platform.network()).applyRegistrations(event, OMT.MOD_ID)); // lowest priority: mods that cancel the death have run, and cancelled deaths do not arrive here @@ -63,7 +68,8 @@ private void onRegister(RegisterEvent event) { /** * A step whose registry fired no event would leave its content unregistered: fail loudly instead. With Create * installed, its contraptions may move bases and turrets ({@link NeoForgeCreateMovement}); with OpenComputers: - * Rebooted installed, turret bases are components ({@code OpenComputersCompat}). Both classes are only loaded then. + * Rebooted installed, turret bases are components ({@code OpenComputersCompat}); with CC: Tweaked they are + * peripherals ({@code NeoForgeComputerCraft}, registered in the capability event). The classes are only loaded then. */ private void onCommonSetup(FMLCommonSetupEvent event) { if (done.size() != steps.size()) { diff --git a/src/main/java/omtteam/openmodularturrets/platform/neoforge/computercraft/NeoForgeComputerCraft.java b/src/main/java/omtteam/openmodularturrets/platform/neoforge/computercraft/NeoForgeComputerCraft.java new file mode 100644 index 00000000..8fa39564 --- /dev/null +++ b/src/main/java/omtteam/openmodularturrets/platform/neoforge/computercraft/NeoForgeComputerCraft.java @@ -0,0 +1,25 @@ +package omtteam.openmodularturrets.platform.neoforge.computercraft; + +import dan200.computercraft.api.peripheral.PeripheralCapability; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; +import omtteam.openmodularturrets.OMT; +import omtteam.openmodularturrets.compat.computercraft.TurretBasePeripheral; +import omtteam.openmodularturrets.registry.ModBlockEntities; + +/** + * CC: Tweaked on NeoForge: a computer next to a turret base (or a wired modem on it) sees the peripheral + * {@code turret_base}. Only loaded when CC: Tweaked is installed (compile-only, never bundled). + */ +public final class NeoForgeComputerCraft { + public static final String MOD_ID = "computercraft"; + + private NeoForgeComputerCraft() { + } + + /** Registers the peripheral for the turret base block entity, on every side; called from the capability event. */ + public static void register(RegisterCapabilitiesEvent event) { + event.registerBlockEntity(PeripheralCapability.get(), ModBlockEntities.TURRET_BASE, + (base, side) -> TurretBasePeripheral.of(base)); + OMT.LOGGER.info("CC: Tweaked found: turret bases are peripherals (turret_base)"); + } +} diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index 712ec735..4b3711b2 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -46,6 +46,14 @@ versionRange = "*" ordering = "NONE" side = "BOTH" +# CC: Tweaked: the turret base becomes a peripheral when it is installed +[[dependencies.${mod_id}]] +modId = "computercraft" +type = "optional" +versionRange = "*" +ordering = "NONE" +side = "BOTH" + # OpenComputers: Rebooted (1.21.1 only): the turret base becomes a component when it is installed [[dependencies.${mod_id}]] modId = "opencomputers" diff --git a/src/main/resources/assets/openmodularturrets/lang/de_de.json b/src/main/resources/assets/openmodularturrets/lang/de_de.json index b94099ec..b691637d 100644 --- a/src/main/resources/assets/openmodularturrets/lang/de_de.json +++ b/src/main/resources/assets/openmodularturrets/lang/de_de.json @@ -174,7 +174,7 @@ "tooltip.openmodularturrets.addon.redstone.b": "RF pro", "tooltip.openmodularturrets.addon.redstone.c": "Redstone Staub im Munitionslager.", "tooltip.openmodularturrets.addon.redstone.flavour": "Sublimation, verbessert.", - "tooltip.openmodularturrets.addon.serial.a": "Erlaubt OpenComputers", + "tooltip.openmodularturrets.addon.serial.a": "Erlaubt Computer-", "tooltip.openmodularturrets.addon.serial.b": "Kompatibilität.", "tooltip.openmodularturrets.addon.serial.flavour": "Wer braucht OOP?", "tooltip.openmodularturrets.addon.solar.a": "Erzeugt", diff --git a/src/main/resources/assets/openmodularturrets/lang/en_gb.json b/src/main/resources/assets/openmodularturrets/lang/en_gb.json index 5cd3e43c..46ff666f 100644 --- a/src/main/resources/assets/openmodularturrets/lang/en_gb.json +++ b/src/main/resources/assets/openmodularturrets/lang/en_gb.json @@ -171,7 +171,7 @@ "tooltip.openmodularturrets.addon.redstone.b": "RF per", "tooltip.openmodularturrets.addon.redstone.c": "redstone dust in Ammo inventory.", "tooltip.openmodularturrets.addon.redstone.flavour": "Sublimation, refined.", - "tooltip.openmodularturrets.addon.serial.a": "Enables OpenComputers", + "tooltip.openmodularturrets.addon.serial.a": "Enables computer", "tooltip.openmodularturrets.addon.serial.b": "compatibility.", "tooltip.openmodularturrets.addon.serial.flavour": "Who needs OOP?", "tooltip.openmodularturrets.addon.solar.a": "Generates", diff --git a/src/main/resources/assets/openmodularturrets/lang/en_us.json b/src/main/resources/assets/openmodularturrets/lang/en_us.json index 0ff28d11..20feb091 100644 --- a/src/main/resources/assets/openmodularturrets/lang/en_us.json +++ b/src/main/resources/assets/openmodularturrets/lang/en_us.json @@ -171,7 +171,7 @@ "tooltip.openmodularturrets.addon.redstone.b": "RF per", "tooltip.openmodularturrets.addon.redstone.c": "redstone dust in Ammo inventory.", "tooltip.openmodularturrets.addon.redstone.flavour": "Sublimation, refined.", - "tooltip.openmodularturrets.addon.serial.a": "Enables OpenComputers", + "tooltip.openmodularturrets.addon.serial.a": "Enables computer", "tooltip.openmodularturrets.addon.serial.b": "compatibility.", "tooltip.openmodularturrets.addon.serial.flavour": "Who needs OOP?", "tooltip.openmodularturrets.addon.solar.a": "Generates", diff --git a/src/main/resources/assets/openmodularturrets/lang/pt_br.json b/src/main/resources/assets/openmodularturrets/lang/pt_br.json index 336c27cd..231f6e23 100644 --- a/src/main/resources/assets/openmodularturrets/lang/pt_br.json +++ b/src/main/resources/assets/openmodularturrets/lang/pt_br.json @@ -171,8 +171,8 @@ "tooltip.openmodularturrets.addon.redstone.b": "RF", "tooltip.openmodularturrets.addon.redstone.c": "pó de redstone no inventário para funcionar.", "tooltip.openmodularturrets.addon.redstone.flavour": "Sublimação, refinado.", - "tooltip.openmodularturrets.addon.serial.a": "Ativa OpenComputers", - "tooltip.openmodularturrets.addon.serial.b": "compatibilidade.", + "tooltip.openmodularturrets.addon.serial.a": "Ativa compatibilidade", + "tooltip.openmodularturrets.addon.serial.b": "com computadores.", "tooltip.openmodularturrets.addon.serial.flavour": "Quem precisa de OOP?", "tooltip.openmodularturrets.addon.solar.a": "Gera", "tooltip.openmodularturrets.addon.solar.b": "RF/t na luz do sol.", diff --git a/src/main/resources/assets/openmodularturrets/lang/ru_ru.json b/src/main/resources/assets/openmodularturrets/lang/ru_ru.json index 5182f960..95cd0c3d 100644 --- a/src/main/resources/assets/openmodularturrets/lang/ru_ru.json +++ b/src/main/resources/assets/openmodularturrets/lang/ru_ru.json @@ -171,7 +171,7 @@ "tooltip.openmodularturrets.addon.redstone.b": "RF per", "tooltip.openmodularturrets.addon.redstone.c": "redstone dust in Ammo inventory.", "tooltip.openmodularturrets.addon.redstone.flavour": "Sublimation, refined.", - "tooltip.openmodularturrets.addon.serial.a": "Enables OpenComputers", + "tooltip.openmodularturrets.addon.serial.a": "Enables computer", "tooltip.openmodularturrets.addon.serial.b": "compatibility.", "tooltip.openmodularturrets.addon.serial.flavour": "Who needs OOP?", "tooltip.openmodularturrets.addon.solar.a": "Generates", diff --git a/src/main/resources/assets/openmodularturrets/lang/zh_cn.json b/src/main/resources/assets/openmodularturrets/lang/zh_cn.json index 0577beab..da987e64 100644 --- a/src/main/resources/assets/openmodularturrets/lang/zh_cn.json +++ b/src/main/resources/assets/openmodularturrets/lang/zh_cn.json @@ -171,7 +171,7 @@ "tooltip.openmodularturrets.addon.redstone.b": "RF/红石", "tooltip.openmodularturrets.addon.redstone.c": "红石需放在弹药槽内充当燃料.", "tooltip.openmodularturrets.addon.redstone.flavour": "升华,精炼.", - "tooltip.openmodularturrets.addon.serial.a": "兼容Open_computers", + "tooltip.openmodularturrets.addon.serial.a": "兼容计算机", "tooltip.openmodularturrets.addon.serial.b": "兼容性.", "tooltip.openmodularturrets.addon.serial.flavour": "谁要OOP?", "tooltip.openmodularturrets.addon.solar.a": "在日照下产能", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f455b451..b7cd018b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -39,7 +39,8 @@ } ], "suggests": { - "jade": "*" + "jade": "*", + "computercraft": "*" }, "depends": { "fabricloader": ">=${loader_version}", diff --git a/versions/1.21.1-fabric/gradle.properties b/versions/1.21.1-fabric/gradle.properties index bb8d723e..b1a966f1 100644 --- a/versions/1.21.1-fabric/gradle.properties +++ b/versions/1.21.1-fabric/gradle.properties @@ -7,3 +7,6 @@ jade_version=15.10.6+fabric # loaders' files share the version number) is only in the dev client (see build.fabric.gradle.kts) sable_companion_version=1.6.0 sable_version=OLG7vDD6 +# CC: Tweaked (maven.squiddev.cc): compile-only API for the turret base peripheral; the full mod is only in the dev +# runs and on the game test server (1.120.2: 1.121.0 needs NeoForge 21.1.265, 1.122.0 Loom 1.19) +cctweaked_version=1.120.2 diff --git a/versions/1.21.1-neoforge/gradle.properties b/versions/1.21.1-neoforge/gradle.properties index 7ce1769a..1236078a 100644 --- a/versions/1.21.1-neoforge/gradle.properties +++ b/versions/1.21.1-neoforge/gradle.properties @@ -20,3 +20,6 @@ create_version=UjX6dr61 # OpenComputers: Rebooted (maven.michiyo.me, 1.21.1 NeoForge only): compile-only API for the turret base component; # the full mod is only in the dev runs and on the game test server opencomputers_version=1.9.4-5 +# CC: Tweaked (maven.squiddev.cc): compile-only API for the turret base peripheral; the full mod is only in the dev +# runs and on the game test server (1.120.2: 1.121.0 needs NeoForge 21.1.265, 1.122.0 Loom 1.19) +cctweaked_version=1.120.2