Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<node>/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.

Expand Down Expand Up @@ -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 |
Expand All @@ -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/<loader>/computercraft`).

### Designing APIs

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions build.fabric.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down
16 changes: 16 additions & 0 deletions build.neoforge.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()) }
Expand Down
8 changes: 6 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.<loader>.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.
Expand Down Expand Up @@ -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/<node>/gradle.properties`).

## How to add …

Expand Down
1 change: 1 addition & 0 deletions src/gametest/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Loading