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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Before a release, `./gradlew releaseChangelog` turns *Unreleased* into the relea
- The turret item tooltip (with shift) and the Jade tooltip of a turret show its optimal range and its turn rate
- Turret API: `TurretStats.Builder.falloff(optimalShare, damageAtMaxRange)` and `turnRate(degreesPerTick)`; `TurretProjectile` has `damage(Entity)`, `damage(float, Entity)`, `damageFactor(…)`, `ampDamage(…)` and `hitPoint(…)` for projectiles with the range falloff
- Config: `turrets.aimTolerance` and, in every turret section, `optimalRange`, `falloffDamage` and `turnRate`
- 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)
- Computer control: a computer can stop a base's turrets from targeting on their own, so it aims and fires them itself
- CC: Tweaked support: turret bases are the peripheral `turret_base`, with the computer commands of the Serial Port addon.

### Changed

Expand Down
5 changes: 4 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Core gameplay:
- **MixinExtras** (`io.github.llamalad7:mixinextras-forge`), jar-in-jar in the **Forge jar only** (approved by the user on 2026-10-24): Fabric Loader ships it, Forge 1.20.1 does not, and `LivingEntityMixin` needs it.
- **OpenModularCore** (the team's shared core, `../../OpenModularCore`, module `omt-core` from JitPack, approved by the user on 2026-11-16): the game rules (`omtteam.openmodularturrets.core`), the same on every Minecraft version; compile-only, its classes are bundled into the mod's jar (see "Core Game Logic Source").
- **OMLib** (the user's own library, `../OMLib`, branch `1.20.1`), mounted as the git submodule `omlib` and bundled into every jar (jar-in-jar; requested by the user on 2026-10-27); see §4 "OMLib".
- **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 (on Forge also `-core-api`, as its `-forge-api` module lists no dependencies), never bundled, an optional dependency in the loader metadata (`suggests` on Fabric, an optional dependency in `mods.toml`); the full mod is in the dev runs (`modLocalRuntime`), on the game test servers and in `runenv`.
Gated on `cctweaked_version` in `versions/<node>/gradle.properties` (1.121.0: 1.122.0 needs Loom 1.19, this branch has 1.18); 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 @@ -223,7 +225,8 @@ 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.
- OpenComputers / ComputerCraft integration is **out of scope** on this branch (OpenComputers: Rebooted belongs to `1.21.1` only; ask before adding).
- Computers: the loader-free base is present (the commands in `core/computer`, `BaseComputerCommands`, a port of 1.12.2's plus computer control; computer control of a base and its turrets, `blockentity/base/BaseComputerTurrets`; the Serial Port addon, `addon_serial_port`), and **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`) reuses `BaseComputerCommands`; only its registration is per loader (`platform/<loader>/computercraft`: `PeripheralLookup` on Fabric, `ForgeComputerCraftAPI.registerPeripheralProvider` on Forge).
OpenComputers: Rebooted belongs to `1.21.1` only.
- New APIs (public interfaces for other mods, such as `api/`, and new cross-cutting interfaces inside the mod) are designed step by step with the user: workspace `CLAUDE.md`, "Designing APIs".

---
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ 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 Forge build uses its energy capability (FE) instead
- Optional **NEEPMeat** support (Fabric): vascular conduits power turret bases, 1 eJ per energy unit
- Optional **Jade** support for turret bases and turrets, on both loaders
- Computer control of turret bases (a Serial Port addon, or tier 5): a computer can aim and fire the turrets itself
- Optional **CC: Tweaked** support (both loaders): turret bases are the peripheral `turret_base`, with the same functions as 1.12.2's computer commands, so a computer finds and controls a base with the Serial Port addon or at tier 5

## Requirements

Expand Down
15 changes: 15 additions & 0 deletions build.fabric.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ tasks.withType<net.fabricmc.loom.task.AbstractRunTask>().configureEach {
doFirst { clientResources.get().asFile.mkdirs() }
}

repositories {
// CC: Tweaked comes only from its own maven
exclusiveContent {
forRepository { maven("https://maven.squiddev.cc") { name = "CC-Tweaked" } }
filter { includeGroup("cc.tweaked") }
}
}

dependencies {
minecraft("com.mojang:minecraft:$minecraftVersion")
mappings(loom.officialMojangMappings())
Expand All @@ -81,6 +89,13 @@ 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 ->
modCompileOnly("cc.tweaked:cc-tweaked-$minecraftVersion-fabric-api:$cc")
modLocalRuntime("cc.tweaked:cc-tweaked-$minecraftVersion-fabric:$cc")
}

// NEEPMeat: OMLib's FabricNeepMeatPower lets its vascular network charge the bases. Not bundled, the mod needs
// nothing of it; NEEPMeat (with the mods nested in its jar, which Loom leaves out of its remapped copy:
// nestedModJars in omlib/build-logic) and GeckoLib (which it requires, also with the library nested in its jar) are
Expand Down
30 changes: 30 additions & 0 deletions build.forge.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ val localRuntime: Configuration = configurations.create("localRuntime")
val modLocalRuntime: Configuration = obfuscation.createRemappingConfiguration(localRuntime)
configurations.runtimeClasspath { extendsFrom(localRuntime) }
// Not on the GameTest server.
// The same for the game test source set (CC: Tweaked, see dependencies): configurations of their own, so the remapping
// leaves the game test's other dependencies (OMLib) alone
val gametestLocalCompile: Configuration = configurations.create("gametestLocalCompile")
val gametestModLocalCompile: Configuration = obfuscation.createRemappingConfiguration(gametestLocalCompile)
configurations.getByName("gametestCompileOnly").extendsFrom(gametestLocalCompile)
val gametestLocalRuntime: Configuration = configurations.create("gametestLocalRuntime")
val gametestModLocalRuntime: Configuration = obfuscation.createRemappingConfiguration(gametestLocalRuntime)
configurations.getByName("gametestRuntimeOnly").extendsFrom(gametestLocalRuntime)

repositories {
// CC: Tweaked comes only from its own maven
exclusiveContent {
forRepository { maven("https://maven.squiddev.cc") { name = "CC-Tweaked" } }
filter { includeGroup("cc.tweaked") }
}
}

dependencies {
annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
Expand Down Expand Up @@ -127,6 +143,20 @@ dependencies {
// Jade plugin (compat/jade, client/compat/jade): optional, not bundled; present in dev runs to try it
"modCompileOnly"("maven.modrinth:jade:${property("jade_version")}")
modLocalRuntime("maven.modrinth:jade:${property("jade_version")}")

// CC: Tweaked (optional, not bundled: the peripheral provider in platform/forge/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. Its jars are SRG-named like the mod's own, so they go through the remapping configurations too.
findProperty("cctweaked_version")?.let { cc ->
val mc = property("minecraft_version")
// the Forge API jar has no dependency metadata, so the core API (IPeripheral, @LuaFunction, MethodResult) is named too
"modCompileOnly"("cc.tweaked:cc-tweaked-$mc-core-api:$cc")
"modCompileOnly"("cc.tweaked:cc-tweaked-$mc-forge-api:$cc")
modLocalRuntime("cc.tweaked:cc-tweaked-$mc-forge:$cc")
// the game test (compile: CC's own peripheral lookup, which the API does not have; run: the mod itself)
gametestModLocalCompile("cc.tweaked:cc-tweaked-$mc-forge:$cc")
gametestModLocalRuntime("cc.tweaked:cc-tweaked-$mc-forge:$cc")
}
}
// The client half of the Jade plugin (client/compat/jade) compiles against it too (remapped, through compileOnly)
configurations.named("clientCompileOnly") { extendsFrom(configurations.compileOnly.get()) }
Expand Down
19 changes: 18 additions & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ This is the only place where the two meet, and the reason the core can be tested
| `target.TargetEntity` | `blockentity.base.LivingTargetEntity` | one living entity: position and eyes (in the base's coordinates), health, armor, category, owner (pets) |
| `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` | `compat.computercraft.ServerPlayerNames` | a player's UUID by name (online, or a player who joined before), without asking Mojang |

The block entities own one core object each and forward to it: `TurretBaseBlockEntity` → `core.base.TurretBaseLogic`, `TurretBlockEntity` → `core.turret.TurretState`, `GeneratorBlockEntity` → `core.generator.GeneratorLogic`.
`TurretBaseBlockEntity` also owns the base's `TrustManager` (OMLib's core): it builds it with a change callback that saves and syncs the base, and hands it to the logic, which only reads it.
Expand Down Expand Up @@ -106,6 +108,7 @@ Packages below `omtteam.openmodularturrets` (main):
| `core.security` | `DamageRules` (who turret damage may hit); the owner, trusted players and access levels (`TrustManager`) are in OMLib |
| `core.generator`, `core.card` | generator burning, the memory card's copy rules for a base's settings (`BaseCardRules`; the card data and the trust list copy rules are OMLib's `core.card`, camouflage permissions OMLib's `core.camo`, machine mode and targeting settings OMLib's `core.machine`) |
| `core.item`, `core.settings`, `core.world` | upgrade/addon types, config value types, the world interfaces above |
| `core.computer` | `BaseComputerCommands`: the commands a computer may send to a turret base (1.12.2's, plus computer control), with the interfaces it needs from the game |
| `core.storage` | `SlotCapacity`: how much an ammo or fuel slot holds with the attached inventory expanders; `AmmoSort`: the order of the sort button (`TurretBaseInventory.sortAmmo`) |
| `api`, `api.weapon` | public turret API for other mods; the built-in turrets use it too |
| `registry` | registration of blocks, items, block entities, entities, menus, sounds, creative tab; `TurretRegistry` (turret definitions) |
Expand All @@ -118,7 +121,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` / `forge`), Jade (server half here, tooltips in `client.compat.jade`), and the contraption pose hooks (`SubLevelCompat`, `client.compat.ClientSubLevelCompat`; always the identity pose here, as there is no Sable) |
| `platform` | the loader services shared code calls (`Platform`: `LoaderInfo`, `Fuel`, `Network`, `Menus`, `Energy`); `platform.fabric` / `platform.forge` hold the entrypoints, the implementations and the energy/item adapters, and only compile for their loader |
| `platform` | the loader services shared code calls (`Platform`: `LoaderInfo`, `Fuel`, `Network`, `Menus`, `Energy`); `platform.fabric` / `platform.forge` hold the entrypoints, the implementations and the energy/item adapters, and only compile for their loader; `platform.<loader>.computercraft` registers the CC: Tweaked peripheral |
| `datagen` | recipes, loot tables, tags, damage types (Fabric only; the Forge build converts the Fabric output) |

`./gradlew dependencyMap` draws these packages and every import between them as an interactive page.
Expand Down Expand Up @@ -215,6 +218,20 @@ The base learns of its expanders through `Neighbour.Expanders` in `TurretBaseLog
The stacks above one stack are OMLib's large stacks: `TurretBaseInventory` and `FuelContainer` implement `LargeStackContainer` (also on the client, with the bonus stacks synced as menu data), the menus extend `LargeStackMenu` with `LargeStackSlot`s, the screens `LargeStackScreen`, and `VersionCompat.saveItems` saves the counts.
Removing an expander leaves larger stacks in the slots; they only cannot grow until they are below the new limit.

### Computers

A computer reaches a turret base through three layers:

1. `core.computer.BaseComputerCommands` holds the commands (1.12.2's, ported with their names, arguments and messages): plain Java values in, an `Object[]` result out, a wrong argument gives an error message, not an exception.
Every command first asks `TurretBaseLogic.acceptsComputers()` (tier 5, or a Serial Port addon); trust changes act as the base's owner through its `TrustManager`, which saves and syncs.
The turrets are reached through `ComputerTurrets` (`blockentity.base.BaseComputerTurrets` over the turrets mounted on the base), player names through `PlayerNames`.
2. Computer control (`setComputerControl`, `TurretBaseLogic.isComputerControlled()`, saved with the base): the base drops its targets and searches none, and its turrets stay deployed and fire only when told to (`TurretBlockEntity.setYawPitch`, `setAutoFire`, `forceShot`).
Control and auto fire only apply while the base accepts computers (tier 5 or a Serial Port): a base that lost its Serial Port targets on its own again, since no computer could switch control off.
3. The mod integration: **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 1.12.2's commands (`changeAccessLevel` and `forceShootAllTurrets` as well as the aliases `changeTrustedPlayerAccess` and `forceShootAll`, `getType`) and call `BaseComputerCommands`, 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.forge.computercraft.ForgeComputerCraft` (`ForgeComputerCraftAPI.registerPeripheralProvider`, in the common setup).
`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 …

### A turret
Expand Down
2 changes: 1 addition & 1 deletion docs/id-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ The inventory expanders of 4.x (`inventory_expander_tier_one` to `_three`, the m
| `openmodularturrets:addon_meta` | 2 | *(not ported: potentia converter, no function in oldmod)* |
| `openmodularturrets:addon_meta` | 3 | `openmodularturrets:addon_recycler` |
| `openmodularturrets:addon_meta` | 4 | `openmodularturrets:addon_redstone_reactor` |
| `openmodularturrets:addon_meta` | 5 | *(not ported: serial port, computer integration out of scope)* |
| `openmodularturrets:addon_meta` | 5 | `openmodularturrets:addon_serial_port` |
| `openmodularturrets:addon_meta` | 6 | `openmodularturrets:addon_solar_panel` |
| `openmodularturrets:addon_meta` | 7 | `openmodularturrets:addon_fake_drops` |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ private static void appendAddon(AddonItem item, List<Component> lines) {
lines.add(flavour("addon.fakedrops.flavour"));
}
case SERIAL_PORT -> {
lines.add(text("addon.serial.a"));
lines.add(text("addon.serial.b"));
lines.add(Component.empty());
lines.add(flavour("addon.serial.flavour"));
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/gametest/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The day still passes: a test that needs daylight sets the time itself (`SolarPan
- `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; `CamoMenuGameTests` uses it for the camouflage menu and its "Back" to the base GUI.
Cast `getBlockEntity` results, which are a plain `BlockEntity` here.
- `ComputerCraftGameTests` (batch `computercraft`) finds the peripheral through each loader's real CC lookup (`PeripheralLookup` on Fabric, CC's `Peripherals.getPeripheral` on Forge, which sees the registered provider) and calls its methods with `ObjectArguments`; CC: Tweaked itself runs on both test servers (`cctweaked_version`; on Forge through the remapped `gametestLocalRuntime` configuration in `build.forge.gradle.kts`).
- `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: Forge returns a read-only view of the list, and vanilla's mock players would log in for real, which breaks Forge's login handling.
Names of players who are not online go to the server's name cache: the test server has none (not found).
Expand Down
Loading