Commit Graph
112 Commits
Author SHA1 Message Date
Jonathan Coates 646251ffd0 Remove deprecated upgrade methods
I'm not aware of any addon mods targetting 26.3, and the whole ecosystem
is pretty unstable. I think this is safe to do.
2026-10-27 18:10:51 +00:00
Jonathan Coates 31370387fe Merge branch 'mc-1.21.x' into mc-26.3 2026-10-26 23:12:32 +00:00
Jonathan Coates 2f6229f253 Merge branch 'mc-1.20.x' into mc-1.21.x 2026-10-25 15:08:19 +00:00
Jonathan Coates d5d8fc291d Replace ItemStack.isSameItemSameTags with matches
How have I never noticed this existed before :/.
2026-10-22 20:12:54 +01:00
Jonathan Coates 4f07d2d024 Handle upgrade items in data fixers
This is not perfect, but I think as good as we're going to get it.
Because ItemStack's data is not typed in older versions, we don't apply
data fixers to upgrade items (aside from the componentisation fix). This
means that any migration between 3564 and 3818.5 will be skipped.
2026-10-22 20:11:29 +01:00
Jonathan Coates 8acc600e42 Merge branch 'mc-1.20.x' into mc-1.21.x 2026-10-22 12:10:07 +01:00
Jonathan Coates 5c6e8e434b Rethink turtle/pocket upgrade API (#2513)
- `UpgradeData` now (optionally) stores the upgrade's item in addition
   to the upgrade's data. If the item is not explicitly specified, the
   item is created via `UpgradeBase.getUpgradeItem` as before.

 - Add `UpdateBase.getCraftingIngredient`, allowing upgrades to work with
   multiple items.

 - Add `Abstract{Turtle,Pocket}Upgrade.StackAware` class, for upgrades
   which support this new API.

 - Add `UpgradeHandle` (and matching `I{Turtle,Pocket}.getUpgradeHandle`
   getters), for reading/writing upgrade data.

 - Allow TransformedModel to also hold a list of tints for the model.

 - Update our turtle item colour provider to fetch tints from the
   upgrade's TransformedModel.

   This requires rewriting the quads in the upgrade model, mapping the
   existing tint indices to (2 * tintIndex) + (left ? 1 : 2). We already
   have to rewrite quads to apply transformations, so fortunately this
   isn't too bad.

   I have no clue how this is going to work on 26.3 though 😬.

 - Add a custom turtle upgrade modeller for the storage upgrade that
   applies the shulker tint colour.
2026-10-21 21:49:50 +00:00
Jonathan Coates 4cd6cdb69c Enable JSpecify support in NullAway
Except in the common main classes: there's a couple of bugs in the
current version which crash the type checker.
2026-10-19 20:15:53 +01:00
Jonathan Coates be75b7357f Ensure we have @NullMarked package-info files
- Add a new task to check/generate package-info files.
 - Add missing ones, and write some basic package summaries where
   appropriate.
2026-10-19 20:06:09 +01:00
Jonathan Coates 704ed90395 Merge branch 'mc-1.21.x' into mc-26.3 2026-09-15 22:18:25 +01:00
Jonathan Coates 5c0c51da0b Merge branch 'mc-1.20.x' into mc-1.21.x 2026-09-15 21:51:28 +01:00
Jonathan Coates 9275153dc0 Update to Minecraft 26.3
- Switch GUIs to use SDL. We map keys to the old GLFW key codes to
   avoid another hard-coding-the-keys debacle.

 - Some changes to data generation, as recipes and loot table providers
   now just use registry patches.

Still some small bits which need cleaning up (waiting on an Iris release
for NeoForge, would be good to switch some of our code to number
providers), but it mostly works.
2026-09-15 21:49:06 +01:00
Jonathan Coates c04b7599de Replace 26.2 with 26.3 in issue template 2026-09-15 21:48:57 +01:00
Jonathan Coates cf6a12a140 Merge branch 'mc-1.20.x' into mc-1.21.x 2026-09-11 20:58:46 +01:00
Jonathan Coates d449cbc3e7 Some basic datapack documentation 2026-09-09 10:07:36 +01:00
Jonathan Coates 99e9c72686 Fix a whole bunch of spelling mistakes
Using typos[^1]. I wrote a config for this years ago, but never checked
it in. All things considered, there's fewer than I expected.

Fun fact: the CCPL contains the text "if added to to the main
repository", and I can't/shouldn't fix it, because it's an external
license!

[^1]: https://github.com/crate-ci/typos/
2026-08-26 14:40:04 +01:00
Jonathan Coates 3829165629 Merge branch 'mc-1.21.x' into mc-26.2 2026-08-25 15:16:49 +01:00
Jonathan Coates 48ac79bc80 Merge branch 'mc-1.20.x' into mc-1.21.x 2026-08-25 15:09:15 +01:00
Jonathan Coates 8bdea64474 Fix multishell not culling after changing focus
When we resume a process, the code looks like:

  resumeProcess(nCurrentProcess, ...)
  if cullProcess(nCurrentProcess, ...) then ... end

However, if the focused tab changes while resuming (via
multishell.setFocus), then we don't cull the correct process!

To fix this, we just add a helper function which resumes+culls, meaning
we only read the mutable global once.
2026-08-14 16:45:46 +01:00
Jonathan Coates 14f047c80f Deprecate ITurtleUpgrade.createKey
There's no IPocketUpgrade version of this, and I'm not actually sure it
adds much benefit.
2026-07-05 11:30:11 +01:00
Jonathan Coates 51c7c1ce3f Update to Minecraft 26.2
- Move block and item ids into separate API-accessible classes, to
   match vanilla.
 - Switch to Fabric's built-in permission API. We no longer need to
   optionally support fabric-permission-api, which makes things a bit
   simpler.
 - Lots of rendering changes. Crucially, switch monitor rendering back
   to using VBOs, using the new FeatureRenderer system. This currently
   requires mixins on Fabric, but there's a PR open to add an API for
   it in the future.
2026-06-16 17:33:30 +01:00
Jonathan Coates b024d4af9a Merge branch 'mc-1.21.x' into mc-26.1 2026-04-26 18:31:12 +01:00
Jonathan Coates 6c701badc9 Merge branch 'mc-1.20.x' into mc-1.21.x 2026-04-26 18:11:59 +01:00
Jonathan Coates c526e9a40c Add commands.getEntity
- Add (very basic) details provider for entities.
 - Add commands.getEntity(selector) function, which gets details for all
   matching entities.

Fixes #2383
2026-04-25 18:22:06 +01:00
Jonathan Coates 8be5c28484 Update to 26.1
- Replace vanilla-extract with Fabric Loom for common mod. Now that we
   no longer have to worry about remapping, this probably makes more
   sense.

 - Switch turtle upgrades to use ItemStackTemplate. Yay, immutability! I
   think I might change up the upgrade API here a bit, but not a blocker
   for release.

 - Lots of small things. I'm very glad for our game tests — these caught
   a fair few bugs.
2026-04-13 19:06:44 +01:00
Jonathan Coates a072b116fa Update to 1.21.11
90% just ResourceLocation → Identifier. Also:
 - StandaloneModel now needs to detect which atlas to use, as the block
   and item atlases are different.

 - MultiLineLabel now always draws in white with a drop shadow, so we go
   back to manual word-wrapping for now.
2025-12-17 11:34:12 +00:00
Jonathan Coates 1ad20eea05 Pass registries to details providers
In 634cd52b60 we found out that NBT
hashing requires access to the current registries. However, passing that
around would have required an API change, so we just probed the current
server globally.

On 1.21.10 we can break the API, so let's do this properly:
 - DetailRegistry/DetailProvider now take a HolderLookup.Provider as an
   argument. I did debate whether non-basic details should use a
   MinecraftServer for now, but that makes the API less uniform.

 - This means our generic peripherals need access to the current server.
   We also update the API to support registering
   MinecraftServer->GenericSource factories
2025-12-09 23:57:23 +00:00
Jonathan Coates 52b127fcc7 Initial update to 1.21.10 (#2304)
The server side changes are pretty straightforward:

 - Level.isClientSide is now a method.
 - NeoForge has switched to a Fabric-style item/fluid storage API. This
   is a fairly simple migration, as we've got support for this already!

   This does mean that we need a wrapper type here too. We really should
   support generics in the generic method system :/.

Unfortunately, this is another rough update on the rendering front. The
main change here is that BE renderers now a) have separate extract/render
phases and b) "draw" to a scene graph (SubmitNodeCollector) rather than
directly.

 - Update lectern models to use the model/layer system, rather than
   constructing model parts directly. We don't *need* to do this, but
   makes this a bit more consistent with vanilla.

 - Remove TurtleUpgradeModel.renderForLevel. I could not figure out a way
   to make this look nice with the separate extract/render phases. This
   is made worse by the fact that CC:T doesn't actually use this
   anywhere, so not sure what we actually need! Something to bring back
   in the future, if other people need it.

 - The turtle/monitor F3 info now uses vanilla's debug renderer system.
   We could maybe make the monitor one use a gizmo in future updates, so
   it renders coordinates in-world instead. Not sure.

Unfortunately, some bits are entirely broken right now:

 - Breaking progress for turtles. There's no way to do custom breaking
   progress, so we just render this as normal custom geometry, which has
   all sorts of depth-buffer issues.

 - Monitors do not use a VBO (again, no way to do this), and render every
   frame. This means monitors are pretty slow to render right now (one or
   two is fine, but monitor arrays are unusable). Will need to submit PRs
   to the various mod loaders for this.
2025-11-02 20:24:09 +00:00
Jonathan Coates 569de7fafb Update to Gradle 9.2
- Update to Loom 1.12. This requires Java 21, so we now build with Java
   21, but targetting 17. The new "-release" flag does make this much
   easier, so hopefully shouldn't cause too many issues.

 - Bump versions of a lot of other things.

 - Fix various errorprone/checkstyle grumbles.
2025-10-31 19:50:44 +00:00
Jonathan Coates 67412a2b72 Update to Minecraft 1.21.7 2025-06-30 22:55:55 +01:00
Jonathan Coates e3fecb013a Update to Minecraft 1.26.1
Still one TODO left, but around data fixers, so fairly small.

 - GUI rendering got a big overhaul. I avoided the worst of it with
   9272e2efcd, but things like terminals
   and printouts still require some custom rendering.

 - Item models are now de-duplicated when rendering in the UI, so we
   need to keep track of their identity with
   (appendModelidentityElement). I'm not sure I've got this entirely
   right — whole thing feels unfortunately error-prone.

 - BE serialisation now goes through a Value{Input,Output} class, rather
   than using NBT directly. Fairly simple change, but has changed the
   format of the GameProfile used in turtle's owners. Need a DFU patch
   for this.
2025-06-18 21:19:04 +01:00
Jonathan Coates 0790a8346a Merge branch 'mc-1.21.x' into mc-1.21.y 2025-05-16 18:38:21 +01:00
Jonathan Coates acafc06449 Make turtle upgrade models data driven
It's ItemModel, but for upgrades!
2025-05-11 09:17:54 +01:00
Jonathan Coates 0a0c80db41 Allow equipping pocket computers on the bottom
This allows equipping pocket computers on both the back (as before) and
bottom of a pocket computer. The asymmetry is a little unfortunate here,
but makes some sense with the crafting recipe (above goes behind, below
goes on the bottom).

 - Move some functionality from IPocketAccess into a PocketComputer
   interface (and PocketComputerInternal) interface, used by the pocket
   API.

   IPocketAccess preserves the same interface as before. Unlike
   ITurtleAccess, we /don't/ expose the PocketSide in the public API.

 - Several pocket-computer methods (e.g. setUpgradeData, setColour) are
   now required to be called on the main thread, and when the computer
   is being held. This allows us to write back changes to the item
   immediately, rather than the next time the item is ticked.

   Sadly this doesn't actually remove the need for onCraftedPostProcess
   as I'd originally hoped, but I think does make the code a little
   simpler.

 - Rename "computercraft:pocket_computer" component to
   "computercraft:back_pocket_computer".

 - And finally, support multiple upgrades on the pocket computer. This
   is actually quite an easy change, just tedious — there's lots of
   places to update!

Fixes #1406, and I think fixes #1148 — you can use a speaker to notify
you now.
2025-05-10 17:15:41 +01:00
Jonathan Coates a1df196673 Update to Minecraft 1.21.5
0/10, would not recommend. Though increasingly feeling that about
modding as a whole — really not feeling as emotionally rewarding as it
once did.

Server-side changes are well, not simple, but relatively straightforward:

 - Block removal code is now called before the BE is removed, not after.

   - Monitors now need to track if they've being removed or not again.

   - Turtle drop consuming code no longer tries to insert items into
     the turtle immediately, instead waiting 'til the action is
     complete. Otherwise if the turtle gets destroyed mid-action
     (e.g. the block explodes), then it tries to insert its drops into
     itself!

     We previously guarded against this by checking if the turtle BE had
     been removed, but obviously this no longer works, so just easier to
     shift the insertion.

  - The interface for reading/writing NBT has been overhauled. It has
    native "getOr" and codec support (nice!) but also has been changed
    again in the latest snapshot (less nice!).

 - The dye item component no longer has a "hide tooltip" flag. We now
   hide the tooltip with a default component instead.

 - Related to the above, we can now do all the tooltip-related things we
   needed to do with vanilla's TooltipProvider. This did require
   splitting NonNegativeId into subclasses for disk/computer, but
   otherwise is quite nice.

 - Some changes to model datagen. Annoying, but boring.

 - Game tests got a complete overhaul. I'm keeping the interface the
   same for now (@GameTest), because I'm blowed if I'm datagenning test
   instances :p. If it's any consolation, both NF and Fabric are doing
   this too.

Client changes are a bit more involved though:

 - VertexBuffer has been entirely removed. We now construct the
   GpuBuffer directly.

 - BakedModel is gone! Oh this caused so much suffering for turtle
   models. I ended up rewriting the whole system in processes (which
   then involved PRs to NF and Fabric). Rather than returning a
   TransformedModel, turtle models are now responsible for rendering the
   model.

   This may see another rewrite in the future. I'd like to switch to
   JSON-based turtle models (like item models), but that's blocked on
   some changes to NF right now.

   Sorry to all add-on devs, I know this is a big change.
2025-04-30 22:31:30 +01:00
Jonathan Coates a939ad8b97 Merge branch 'mc-1.21.x' into mc-1.21.y 2025-03-25 08:45:03 +00:00
Jonathan Coates fdae94b3c1 Merge branch 'mc-1.20.x' into mc-1.21.x 2025-03-25 08:44:27 +00:00
Jonathan Coates 09ad6c1905 Add tags for disks and floppies
Fixes #2158
2025-03-20 19:16:16 +00:00
Jonathan Coates 995a6e7379 Merge branch 'mc-1.21.x' into mc-1.21.y 2025-03-18 09:29:35 +00:00
Jonathan Coates 8f4d4038f6 Merge branch 'mc-1.20.x' into mc-1.21.x 2025-03-09 12:35:44 +00:00
Jonathan Coates 9277aa33e9 Update to 1.21.4
Please don't talk to me about this. The first couple of hours of this
update were quite enjoyable, and then the rest was one of the most
miserable times I've had modding.

This has been a real slog, partly due to some large MC changes (item
models are a great change, but a pain to adapt to), and partly due to
mental health reasons — honestly, I've opened up my IDE so many times,
and then just closed it because I've hated the thought of even working
on this.

I will publish this to my maven, so mod authors can depend on it, but I
have no plans to publish a 1.21.4 version. 1.21.5 is right around the
corner (again, with some cool, but no-doubt painful changes), and I
need some time to focus on some breaking changes.

This commit actually includes the 1.21.3 update — the git history got so
messy here, so I just clobbered the whole thing. Sorry.

== Rendering ==

 - Remove TBO monitor renderer: There was a big overhaul to how shaders
   are defined and loaded in 1.21.2. It might have been possible to
   update the monitor shader code to this version, it doesn't see much
   use nowadays, so let's just delete it.

   This is a real shame — the TBO renderer was one of my favourite
   projects I've worked on. Unfortunately, it just doesn't seem worth
   the ongoing maintenance burden. It lives on in the standalone
   emulator :D.

 - Similarly, the VBO rendering code got a bit of an overhaul. We no
   longer use a custom VBO subclass, and instead just hack vanilla's to
   support changing the number of vertices rendered.

   This does mean we need to construct a MeshData, rather than a raw
   ByteBuffer. This isn't too hard, but not sure how it'll play with
   Iris. Given recent vanilla performance improvements, maybe we can
   remove our Unsafe code and use a normal BufferBuilder now.

 - Remove our custom emissive model code, now that vanilla supports
   it. We should add emissive textures to some other models at some
   point.

 - Remove mod-loader specific model code, and replace it with vanilla's
   ItemModel. This does constrain the design of turtle upgrade modellers
   quite a bit — we now only accept an untransformed BakedModel or a
   transformed ItemStack model. We may relax this in the future,
   unclear.

   This change does mean that updsidedown turtles are broken. RIP :(.

 - Entity rendering now separates reading state from the entity from
   actual rendering. This means we need to pass some extra state around
   for item frames. Easy on Forge, but requires a mixin on Fabric.

== Recipes ==

There were several major changes to ingredients this update. The code
here hasn't been very well tested right now — might be nice to add some
game tests for this.

 - Ingredients can no longer be constructed directly from a tag key (it
   needs to be fetched from the current registries), so the recipe
   generation code needs a bit of a reshuffle.

 - DiskRecipe now accepts a custom list of ingredients, rather than
   being hard-coded (fixes #1755). Recipes can now return custom
   `RecipeDisplay`s used to show a recipe in the crafting book. We use
   this to replace the impostor recipes.

   I'm not entirely sure how well this'll play with other recipe
   mods. Here's hoping.

 - Similarly, our recipe mod integration has been updated to use
   RecipeDisplay. We had to do this as ingredients no longer accept
   arbitrary ItemStacks (only a specific item).

== Misc ==

 - Blocks/items now need to know their ID ahead of time (so they can
   compute their description). This requires some reshuffling to the
   registration code, but it's pretty minor.

 - updateShape and neighborChanged no longer take a direction (the
   Orientation is mostly null) and so invalidates all redstone and
   peripherals.

 - All the positions were lowered by one in game tests. It's a good
   change (they now match the positions in structures), but annoying to
   update for!
2025-03-02 21:34:47 +00:00
Jonathan Coates 598fc4aefd Merge branch 'mc-1.20.x' into mc-1.21.x 2025-03-01 22:49:56 +00:00
Jonathan Coates 3acb231f01 Write some docs for migrating from MC 1.20 -> 1.21
Almost definitely too late (and not sure if anyone will read them
anyway), but we can but try.
2025-02-21 20:12:44 +00:00
Jonathan Coates 16324e1eac Flesh out detail provider/registry docs 2025-02-19 21:08:56 +00:00
Jonathan Coates 0c04d9de47 Merge branch 'mc-1.20.x' into mc-1.21.x 2025-02-16 21:04:28 +00:00
Jonathan Coates 0998acaa82 Switch to JSpecify annotations
Now, hear me out, what if instead of having three @Nullable annotations,
we had *four*?

I've been wanting to switch away from javax.annoations for a while. The
library has been deprecated for ever and, unlike other @Nullable
annotations, the annotation is attached to the parameter/function
itself, rather than the type.

We use JSpecify rather than one of the alternatives (JetBrains,
CheckerFramework) mostly because it's what NullAway recommends. We keep
CheckerFramework around for @DefaultQualifier, and JB's for @Contract.

There are some ugly changes here — for instance, `@Nullable byte[]` is
replace by `byte @Nullable`, and `@Nullable ILuaMachine.Factory` is
`ILuaMachine.@Nullable Factory`. Ughr, I understand why, but it does not
spark joy :).
2025-02-16 18:09:15 +00:00
Jonathan Coates 3f8c3b026a Merge branch 'mc-1.20.x' into mc-1.21.x 2025-02-14 20:44:39 +00:00
Jonathan Coates 237a0ac3bb Expose printout contents to the API
Closes #2099
2025-02-14 18:13:20 +00:00
Jonathan Coates 53425c1e76 Merge branch 'mc-1.20.x' into mc-1.21.x 2025-01-20 22:22:09 +00:00
Jonathan Coates dc969c5a78 Configure ServerComputer via a Properties builder
We currently need to pass a whole bunch of arguments to a ServerComputer
in order to construct it, and if we implement #1814, this will get a
whole lot worse. Instead, we now pass most parameters (computer id,
family, label, term size, components) via a separate Properties class,
much like Minecraft does for blocks and items.

I'm not wild about the design of the API here, but I think it's a step
in the right direction.
2025-01-20 19:47:18 +00:00