1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-11-05 01:26:20 +00:00
Commit Graph

2089 Commits

Author SHA1 Message Date
Jonathan Coates
0f1f5247ca
Merge branch 'mc-1.18.x' into mc-1.19.x 2022-11-02 09:55:10 +00:00
Jonathan Coates
0db32bd0fe
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-11-02 09:55:10 +00:00
Jonathan Coates
1d3ecb551d
Improvee changelog 2022-11-02 07:58:31 +00:00
Jonathan Coates
aefda6a381
Fix a couple of issues with the release process
Only way to test these is in prod, alas :D:
2022-11-01 21:53:05 +00:00
Jonathan Coates
c1bf9f0b24
Prepare the public API for multi-loader support
Well, sort of. For now, we just mark a whole bunch of stuff as
@Deprecated.
2022-11-01 21:05:24 +00:00
Jonathan Coates
629abb65e3
Merge branch 'mc-1.18.x' into mc-1.19.x 2022-11-01 20:11:36 +00:00
Jonathan Coates
11ac865877
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-11-01 20:07:15 +00:00
Jonathan Coates
6b93fafc46
Bump CC:T to 1.101.0
These version numbers are very hard to type correctly.
2022-11-01 20:01:21 +00:00
Jonathan Coates
1acb8441ec
Add a couple of tests for file autocompletion 2022-11-01 19:22:07 +00:00
Ivo Leal
4b0988768d
Add include_hidden option to fs.complete (#1194) 2022-11-01 14:50:15 +00:00
Jonathan Coates
f528046535
Add a whole bunch of missing @since annotations 2022-10-31 20:09:47 +00:00
Jonathan Coates
93f747fb54
Fix incorrect reboot tooltip
This tooltip was a) using the wrong text and b) incorrect anyway!
Rebooting an off computer does nothing, rather than turning it on.
2022-10-31 20:08:50 +00:00
Jonathan Coates
5d4c34fbac
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-10-31 18:03:39 +00:00
Jonathan Coates
4c5b3a6ee5
Clear Origin header on websockets
Technically this removes Sec-Websocket-Origin, as that's what the
current version of Netty uses. We'll need to change this on 1.18+.

Closes ##1197.
2022-10-31 17:46:02 +00:00
Jonathan Coates
7701b343fb
Make PartialOptions immutable
- Switch to using OptionalInt/OptionalLong instead of @Nullable
   Long/Integers. I know IntelliJ complains, but it avoids the risk of
   implicit unboxing.

 - Instead of mutating PartialOptions, we now define a merge() function
   which returns the new options. This simplifies the logic in
   AddressRule a whole bunch.
2022-10-31 09:13:40 +00:00
Jonathan Coates
14cb97cba1
Sort NBT when writing
This should fix the worst cases of #1196.
2022-10-30 16:47:26 +00:00
Jonathan Coates
1490ca8624
Bump Cobalt version
Adds debug.getregistry() support
2022-10-30 16:39:25 +00:00
Jonathan Coates
f5b89982de
Don't unnecessarily scroll in edit run wrapper (#1195) 2022-10-30 15:17:33 +00:00
Jonathan Coates
1a87175ae7
Be a little more rigorous in KotlinLuaMachine's threading 2022-10-30 11:44:01 +00:00
Jonathan Coates
c4184a33bc
Rewrite our gametest system
This is a noisier diff than I'd like as this is just a direct copy from
the multi-loader branch.

 - Rename "ingame" package to "gametest"

 - Don't chain GameTestSequence methods - it's actually much cleaner if
   we just use Kotlin's implicit this syntax.

 - Use our work in 71f81e1201 to write
   computer tests using Kotlin instead of Lua. This means all the logic
   is in one place, which is nice!

 - Add a couple more tests for some of the more error-prone bits of
   functionality.
2022-10-30 10:50:16 +00:00
Jonathan Coates
b3702fed78
Remove all Minecraft references from the core package
This is an initial step before refactoring this into a separate module.
It's definitely not complete - there's a lot of work needed to remove
referneces to the main ComputerCraft class for instance - but is a
useful first step.
2022-10-30 09:20:26 +00:00
Jonathan Coates
b5056fc3b8
Merge branch 'mc-1.18.x' into mc-1.19.x 2022-10-30 09:06:40 +00:00
Jonathan Coates
38b2c944f3
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-10-30 08:49:52 +00:00
Jonathan Coates
5ee5b11995
Fix month and day names under Java 17
I still don't really understand why the ROOT locale is wrong here, but
there we go. We'll need to remember to uncomment the tests on the 1.18
branch!

Also add some code to map tests back to their definition side. Alas,
this only links to the file right now, not the correct line :/.
2022-10-29 23:54:35 +01:00
Jonathan Coates
b2d2153258
Add several missing version annotations
I probably need to add this to the pre-release checklist. Don't think
there's a good way to automate this :(
2022-10-29 22:49:45 +01:00
Jonathan Coates
3d6ef0cf96
Fix peripheral API using the wrong methods 2022-10-29 22:47:57 +01:00
Jonathan Coates
71f81e1201
Move some test support code into testFixtues
This offers very few advantages now, but helps support the following in
the future:

 - Reuse test support code across multiple projects (useful for
   multi-loader).
 - Allow using test fixture code in testMod. We've got a version of our
   gametest which use Kotlin instead of Lua for asserting computer
   behaviour.

We can't use java-test-fixtures here for Forge reasons, so have to roll
our own version. Alas.

 - Add an ILuaMachine implementation which runs Kotlin coroutines
   instead. We can use this for testing asynchronous APIs. This also
   replaces the FakeComputerManager.

 - Move most things in the .support module to .test.core. We need to use
   a separate package in order to cope with Java 9 modules (again,
   thanks Forge).
2022-10-29 18:17:02 +01:00
Jonathan Coates
1e88d37004
Add peripheral_hub type for wired-modem-like peripherals (#1193)
This allows other mods to create wired-modem alike blocks, which expose
peripherals on the wired network, without having to reimplement the main
modem interface.

This is not currently documented, but a peripheral_hub should provide
the following methods:

 - isPresentRemote
 - getTypeRemote
 - hasTypeRemote
 - getMethodsRemote
 - callRemote
2022-10-29 16:03:05 +01:00
Jonathan Coates
97387556fe
Handle file transfers inside CraftOS (#1190)
- Add a new file_transfer event. This has the signature
   "file_transfer", TransferredFiles.

   TransferredFiles has a single method getFiles(), which returns a list
   of all transferred files.

 - Add a new "import" program which waits for a file_transfer event and
   writes files to the current directory.

 - If a file_transfer event is not handled (i.e. its getFiles() method
   is not called) within 5 seconds on the client, we display a toast
   informing the user on how to upload a file.
2022-10-29 12:01:23 +01:00
Jonathan Coates
1f910ee2ba
Use a separate object for tracking TickScheduler state
This allows us to use non-TileGeneric block entities. This is a clever
trick which will help us later!
2022-10-28 23:40:55 +01:00
Jonathan Coates
a9ef874174
Regenerate assets using our new JSON printer
Haha. Hahahaah. I've gone mad with power.
2022-10-26 18:38:20 +01:00
Jonathan Coates
a2911038c5
Merge branch 'mc-1.18.x' into mc-1.19.x 2022-10-26 09:53:32 +01:00
Jonathan Coates
158850be09
Some Java-17ification
I might just stick on 1.18 for the rest of these refactors. Porting
across the mojmap boundary is painful.
2022-10-25 22:58:31 +01:00
Jonathan Coates
be827a21db
Merge branch 'mc-1.16.x' into mc-1.18.x
I dare say there's going to be some bugs with this. I was as careful as
I could be, but yikes it was nasty.
2022-10-25 22:38:26 +01:00
Jonathan Coates
562f224c01
Refactor out our JEI plugin into reusable components
Pretty useless right now, but either useful for CC:R or our eventual
multi-loader support.
2022-10-25 19:26:44 +01:00
Jonathan Coates
f45614175a
Some improvements to Javadoc publishing
- Use <p> everywhere. This is uglier, but also technically more
   correct. This requires a version bump to cct-javadoc, and will give
   me a massive headache when merging.

 - Link against the existing OpenJDK docs.
2022-10-25 19:17:55 +01:00
Jonathan Coates
af7af615c7
Correctly shut down computer threads
We now wait for workers to terminate when closing the computer thread.

I'll be honest, I'm not happy with this code. Multi-threading is really
hard to get right, and I can't say I'm convinced this is especially well
behaved. I did look at trying to model this in TLA+, but in the end
decided it wasn't worth it.

In the future we probably want to split ComputerExecutor into two
objects, where one is our entry in the ComputerThread queue (and so
holds timing information) while the other is responsible for actual
execution.
2022-10-25 09:32:32 +01:00
Jonathan Coates
8171578e80
Some minor build system improvements
- Correctly handle Git commands failing. We need an actual default
   value, not just null!

 - Use run/ and build/tmp/ for temporary test locations, not
   /test-files.
2022-10-24 19:21:09 +01:00
Jonathan Coates
f4e542b4db
Use our global logger instead of per-class ones
No slf4j available for 1.16.5, and I'll forget if I depend on
log4j.
2022-10-23 16:13:08 +01:00
Jonathan Coates
3e3bc8d4b1
Fix a whole bunch of GH action issues
- Switch over to the Gradle GH action. Not expecting massive changes,
   but might provide some better caching.

 - Bump some GH action versions.

 - Fix a Java 8 compatability issue in our build scripts.
2022-10-22 21:36:52 +01:00
Jonathan Coates
b48f590b92
Merge branch 'feature/gradle-vice' into mc-1.16.x
The hills are alive with the sound of build scripts!
2022-10-22 21:13:50 +01:00
Jonathan Coates
6ab90dc30d
Convert build script to Kotlin
- Add a new Node plugin. This automatically installs npm dependencies
   and provides a "NpxExecToDir" to dir task. This allows us to make the
   doc website task dependencies a little nicer, by simply chaining
   tasks together, rather than doing dependsOn + `input.files(the other
   task output)`.

 - Switch over to CurseForgeGradle from CurseGradle. The latter is
   super clunky to use in non-Groovy languages.

 - Copy our Modrinth description body to our repo, and add support for
   syncing it. We'll still have to do CF manually I think.
2022-10-22 21:09:08 +01:00
Jonathan Coates
0cfdd7b5e9
Move some more build logic to buildSrc
Look, I don't enjoy having 600 LOC long build.gradle files, it's just
very easy to do! This at least moves some of the complexity elsewhere,
so the build script is a little more declarative.
2022-10-22 20:47:47 +01:00
Jonathan Coates
af5d816798
Use spotless for enforcing licenses
It's more verbose as the default license plugin doesn't support multiple
license headers. However, it also gives us some other goodies (namely
formatting Kotlin and removing unused imports), so worth doing.
2022-10-22 18:19:51 +01:00
Jonathan Coates
57cf6084e2
Manage ComputerThread's lifecycle in ComputerContext
This converts ComputerThread from a singleton into a proper object,
which is setup when starting a computer, and tore down when the
ComputerContext is closed.

While this is mostly for conceptual elegance, it does offer some
concrete benefits:
 - You can now adjust the thread count without restarting the whole
   game (just leaving and rentering the world). Though, alas, no effect
   on servers.
 - We can run multiple ComputerThreads in parallel, which makes it much
   easier to run tests in parallel. This allows us to remove our rather
   silly IsolatedRunner test helper.
2022-10-22 14:36:25 +01:00
Jonathan Coates
e9cde9e1bf
Refactor out main thread tasks into an interface
Computers now use a MainThreadScheduler to construct a
MainThreadScheduler.Executor, which is used to submit tasks. Our
previous (singleton) MainThread and MainThreadExecutor now implement
these interfaces.

The main purpose of this is to better manage the lifetime of the server
thread tasks. We've had at least one bug caused by us failing to reset
its state, so good to avoid those! This also allows us to use a fake
implementation in tests where we don't expect main thread tasks to run.

As we're now passing a bunch of arguments into our Computer, we bundle
the "global" ones into ComputerContext (which now also includes the Lua
machine factory!). This definitely isn't the nicest API, so we might
want to rethink this one day.
2022-10-22 14:13:06 +01:00
Jonathan Coates
68da044ff2
Merge branch 'feature/new-metrics' into mc-1.16.x 2022-10-22 12:21:41 +01:00
Jonathan Coates
18d9993fa7
Merge branch 'feature/more-datagen' into mc-1.16.x 2022-10-22 12:04:07 +01:00
Jonathan Coates
0c3de1087e
Switch to vanilla's model data generators
In some ways this isn't as nice as the Forge version (requires ATs,
doesn't check texture/model existence). However, it's more multi-loader
friendly and in some cases has much less boilerplate.

Blockstate JSON files are incredibly verbose, so we add a custom JSON
pretty printer which writes things in a slightly more compact manner.

This also changes how turtle upgrades are loaded - we now support
standard ResourceLocations (so computercraft:blocks/some_turtle_upgrade)
as well as ModelResourceLocations (computercraft:items/some_turtle_upgrade#inventory).
I don't think any resource packs need to touch our upgrades, but
apologies if this breaks anything.
2022-10-22 11:55:30 +01:00
Jonathan Coates
ff89e5feeb
Some datagen improvements
- Convert remaining recipes over to datagen.

 - Switch loot tables to use vanilla's loot table generator. It's
   honestly not too different, just the earlier system confused me too
   much :).

Alas, a positive diff because the JSON is so verbose. I've got a really
nice patch which makes the JSON more compact, but alas the Mixin doesn't
apply on 1.16 :(.
2022-10-22 10:50:10 +01:00