Commit Graph
425 Commits
Author SHA1 Message Date
Jonathan Coates 3469060b6b Update Gradle and dependencies
- Fix *some* cross-project isolation issues. This appears to be the
   bare minimum to make the configuration cache happy. There is
   obviously a lot more work to do here.

 - Enable Configuration cache.

 - Fix some new checkstyle/errorprone/nullaway warnings.
2026-08-27 16:33: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 7b7039c677 Fix turtle.place() not skipping ItemStack.useOn 2026-08-21 13:53:02 +01:00
Jonathan Coates 67732ace06 Sync translations from Crowdin 2026-08-08 17:04:50 +01:00
Jonathan Coates d37793d29a Some small cleanup to the block placing code
Just clarify a couple of things which are a little confusing.

 - Explicitly initialise the position within deployOnEntity, rather than
   relying on getWithPosition above.
 - Rename "position" to "blockPos" in deployOnBlock to make it clearer
   whose position it is.
 - Clarify that we need to call use(...) for all directions.
2026-07-26 12:36:34 +01:00
Jonathan Coates f2161f0765 Add all turtle/pocket upgrades to the search creative tab
This means we no longer need to register additional stacks with recipe
mods, as they'll pick them up from the creative tab instead.

Closes #2463.
2026-07-26 10:41:17 +01:00
Jonathan Coates e0c530efe2 Add missing @GuardedBy 2026-07-22 13:21:19 +01:00
Jonathan Coates 1ec5d53a68 Add test for brewing stand item limit
See #2480.
2026-07-22 12:01:35 +01:00
Jonathan Coates db070d7737 Add missing @Nullability annotations to arg lists
The *contents* of the array is nullable, but the array itself isn't.
2026-07-22 11:48:58 +01:00
Jonathan Coates e83fdd2d5d Fix several BE render bounds
- Monitors were one block taller/wider than they should be.
 - Lecterns are higher than one block, so got cut off if just looking at
   the top.
2026-07-21 11:59:02 +01:00
Jonathan Coates 6f16cd6b0e Reset pocket computer if family changes
When we upgrade a normal pocket computer to an advanced one, we need to
create a new ServerComputer instance (and destroy the old one).

On 1.20.1 the ComputerUpgradeRecipe does not preserve the
instance/session ID on the resulting stack. When the item is next
ticked, we create a new computer, with the old computer no longer being
kept alive and eventually dying.

On 1.21.1 we copy all components, *including* the the current computer
reference. This means a new computer is never created and so we continue
to use the old one (with the wrong family). We could exclude the
computer component from the recipe (and so have the same behaviour as
1.20.1), but by adding a hook in onCraftedBy we can destroy the old
computer immediately, ensuring it no longer continues to run.

Fixes #2479.
2026-07-12 16:30:46 +01:00
Jonathan Coates b4805fd765 Add tests to check dynamic recipes are well-formed
- Check whether impostor recipes (and other custom shaped/shapeless
   recipes) match the "real" recipe.
 - Check whether our upgrade recipe generator generates valid recipes.
   Reasoning about left/right upgrades (and top/back ones on 26.2) is a
   bit confusing, so this should prevent any errors.
2026-07-02 15:03:00 +01:00
Jonathan Coates defb713483 Add commands.getDimension()
Debated "commands.getBlockDimension()" instead, to match
getBlockPosition, but I think this is fine.

Fixes #1866.
2026-05-07 13:36:05 +01:00
Jonathan Coates 39a12893e3 Fix handling of integer indexes in CobaltLuaTable
- Add a new LuaTable.get(int) overload to handle getting an integer key
   instead.
 - Update CobaltLuaMachine for more sensible Java->LuaValue conversion
   for looking up keys.
 - Add some tests for our two LuaTable implementations.
 - Randomly reformat two files because spotless is ???

Fixes #2430
2026-05-02 13:50:58 +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
Mariano Alipi 4bc04f1416 Update TurtleAPI documentation for block breaking (#2380)
Clarified the description of block breaking capabilities for mining turtles.
2026-01-30 19:52:43 +00:00
Jonathan Coates b7d1d9d012 Limit lenght of sound name
Fixes #2366
2026-01-17 20:15:28 +00:00
Jonathan Coates 2105c5c13f Don't materialise the whole split list
This should avoid allocating slightly less memory *in some cases*. I
dare say there's still ways to OOM here. But also, if you want to OOM
the server, you don't need to place a sign to do it!

Closes #2365.
2026-01-17 20:03:41 +00:00
Jonathan Coates 24fd27d2a3 Add test for potion durations 2025-12-24 08:51:15 +00:00
Jonathan Coates 419d823d3b Update Redstone in onNeighborChange
We removed onNeighborChange in 676fb5fb53,
on the basis that this was no longer needed for peripheral updates.
However, it *is* required for redstone updates, as MoreRed does not
trigger any block updates for bundled cables.

Fixes #2316.
2025-12-18 15:06:01 +00:00
Jonathan Coates 8a1a545ab1 Add reference for item details
Also change potion display name to include potency, to match
enchantments.
2025-12-17 18:27:45 +00:00
Jonathan Coates 778805a8d8 Add reference for block details
I do not like the flow of this page, but did not know how better to
structure it.

We really need a way to write things which use the same type syntax as
parameters. I don't like how this (and events!) are formatted so
differently. It'll do for now though.
2025-12-16 23:13:21 +00:00
Jonathan Coates 60bcb9d4d3 Add potion effects to item details
There's some nasty hacks here around potion durations on other items.
This should get a bit cleaner in newer versions of the game, once we
switch to data components.

Fixes #2266.
2025-12-15 22:16:53 +00:00
Jonathan Coates 1ea84fe7d7 Clear turtle player inventory when syncing
Fixes #2332.

I *think* what's going on here is:
 - When we place a block with the turtle, we copy items between the
   turtle's inventory and the fake player's inventory. We *don't* clear
   items from the fake player's inventory after placing, as we'll do it
   next time we use the fake player.

 - At the start of the next tick, Stack Refill then loops over the
   fake player's inventory and moves some items around. However, because
   we just set the items directly (rather than using .copy()), this
   mutates the items in the turtle's inventory too!

To fix this, we just clear the player's inventory after finishing with
it, so Stack Refill never sees these items.
2025-12-15 20:58:01 +00:00
ShreksHellraiser a2ed5c385c Add MapColor metadata provider for block and item details (#2164) 2025-12-15 20:33:42 +00:00
Jonathan Coates 9ad3b03946 Let pocket computer on lecterns wrap the peripheral below
- Shuffle some of the accessors in PocketComputerItem around, to make
   them easier to use in the lectern code.

   I still don't think we've got a good interface here. We could
   possibly move more of the update code into PocketBrain, and just have
   PocketComputerItem responsible for syncing brain<->stack
   state. Something to fiddle with, but not sure it would be any
   cleaner.

 - Set the bottom peripheral when the pocket computer is placed in the
   lectern (and on block updates, etc...), and clear it when removed.

   Again, the code here is uglier than I would like (particularly with
   all the instanceofs). I did wonder about having some LecternBehaviour
   class, which holds the printout/pocket-specific state, but there's so
   many places we need to hook in (and they're so different between the
   two), I'm not sure it's worth it right now.

Fixes #2126, closes #2223.
2025-12-15 19:22:40 +00:00
Jonathan Coates 5f704b2c58 Test for relay initial input 2025-12-15 15:45:11 +00:00
Jonathan Coates 013f2e500f Refresh relay input/output on load
We now forcibly update all redstone inputs/outputs when the relay is
first placed.

It's not entirely clear to me if this is the right solution. The
alternative one would be to persist the redstone state instead. However,
most peripherals do *not* do this (e.g. monitor, speaker), so let's
match that for now.

Fixes #2175.
2025-12-15 14:47:27 +00:00
Jonathan Coates ff9f038275 Another build tooling bump
- Update to latest MDG, to avoid decompiling Minecraft in CI.
 - Fix several Gradle warnings.
 - Bump ErrorProne, and fix a few more nits.
2025-12-15 12:42:38 +00:00
Jonathan Coates 1f5339c86e Avoid using TickScheduler unless needed
Fixes #2190, or at least works around the problems in BuildingGadgets
enough.
2025-12-14 22:30:09 +00:00
Jonathan Coates 28e569f2b4 Support mouse events for lectern pocket computers
Ideally we'd be able to support right clicking on anything when we have
a NoTermComputerScreen open. However, that's incredibly awkward to do
(see c45fc94752, and discussion in #2160),
so instead we create a new PocketComputerLecternScreen, which handles
mouse events.

We need to do some awkward converting the player's position and look
vector into the terminal's coordinate space, and then projecting it onto
the terminal screen, but otherwise this is fairly straightforward.

Closes #2330.
2025-12-14 17:22:15 +00:00
Jonathan Coates 28682aa468 Rewrite computer input handling (again)
Hey, it lasted almost a year!

Computer input is somewhat stateful, as we need to track things like
which key(s) are currently held, and what the last mouse button/position
was. This code is currently duplicated in several places (specifically
TerminalWidget, ServerInputState and the standalone emulator).

In order to implement lectern pocket computer mouse interactions, we'd
have to duplicate this logic once again. Instead, we move this code into
a common class.

 - Replace the InputHandler interface with a simpler ComputerInput one
   (this no longer has computer actions, like reboot or terminate). This
   interface never made much sense (aside from hiding implementation
   details), as code only ever consumed a single implementation of it.

   On the client, this requires a new "ClientComputerActions" class.
   This feels a bit clunky to me, but it's simple and it works.

 - Replace ComputerEvents with a EventComputerInput class (terrible
   name, I know!), which queues events on a computer.

 - Move common input state tracking and validation into a single
   UserComputerInput class, which wraps an existing ComputerInput. This
   is used by both the terminal widget, and the server-side input state.
2025-12-14 16:53:18 +00:00
Jonathan Coates 6334a9df15 Clarify which sounds can be played with speaker
Closes #2327
2025-11-18 19:23:14 +00:00
Jonathan Coates fbdf0d677f Sync translations from Crowdin 2025-11-09 09:23:59 +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 d0fbec6c6b Add bounds checks for compartment lookup
This *shouldn't* be needed, as the compartment index is always >= 0, and
Inventory.getItem returns an empty stack if the item is not found.

However, some mods pass a negative compartment index, which causes
getItem to throw an AIOOB instead.

Fixes #2267
2025-08-28 08:10:35 +01:00
Jonathan Coates 5a9e21ccc3 Clarify behaviour of itemGroups field
The availability of this field changes between Minecraft versions, but we
didn't make that entirely clear.

See #2247
2025-07-20 11:16:39 +01:00
Jonathan Coates 44726827b4 Sync translations from Crowdin 2025-07-12 09:49:14 +01:00
Jonathan Coates 3cf914cb4c Fix NPE when loading mcfunctions
CommandSourceStack.getServer can be null, despite being marked as
non-nullable. Mojang!!! *shakes fist*

Fixes #2235.
2025-07-10 00:47:42 +01:00
Batári Balázs László 180156ff1c Add lang hu_hu (#2232) 2025-07-06 21:47:22 +00:00
Jonathan Coates 8344c0a5c2 Bump CC:T to 1.116.0 2025-06-28 11:03:52 +01:00
Jonathan Coates 798ceefafe Add test for crafting of disks
See #2221.
2025-06-18 21:00:32 +01:00
Jonathan Coates ff363dca5a Move sidebar_advanced.png down by one pixel
Apparently this has been broken since the file was created in
53546b9f57d9acaa4cdca14ae00eaf68ce8c50bd!? I'm sure I fixed this before,
but maybe that was a different but similar issue >_>.
2025-06-14 18:44:16 +01:00
Jonathan Coates b5c0c6e104 Fix out-of-bounds when pasting too-long text
Used a `<=` instead of a `<`! How did I mess this up!?

Fixes #2209
2025-06-02 08:58:43 +01:00
Jonathan Coates ee3b1343b5 Handle keyboard layouts for our computer shortcuts
Convert GLFW's key codes back to their actual key, and then use that
when checking keyboard shortcuts. We *don't* do this for the paste key,
just to be consistent with vanilla's behaviour.

Fixes #2207.
2025-05-25 22:32:39 +01:00
Jonathan Coates 5dfc401b45 Update build plugin versions 2025-05-18 10:05:27 +01:00
Jonathan Coates 4344c3072f Add a test for turtle upgrade crafting
Every few years I get confused about which side turtle upgrades go on
when crafting. The fact that it's flipped always throws me! Let's add a
comment to the recipe, and add some tests to reassure myself.
2025-05-10 14:39:51 +01:00
Jonathan Coates 8711512769 Remove allocation tracking for computers
Reverts 76968f2f28. We'd originally added
this to gather some numbers for #1580, with the hope that it would also
be useful for server admins. Sadly, it's not as accurate as I originally
hoped — the number sometimes goes down for unclear reasons (something to
do with the TLAB maybe??).

Closes #1739.
2025-04-21 08:32:03 +01:00
Jonathan Coates 9c0ce27ce6 Switch a few more places to use Java 17 features
New ErrorProne hint, and one which is actually pretty useful!
2025-03-22 09:39:47 +00:00
Jonathan Coates 09ad6c1905 Add tags for disks and floppies
Fixes #2158
2025-03-20 19:16:16 +00:00