1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-26 07:03:22 +00:00
Commit Graph

74 Commits

Author SHA1 Message Date
Jonathan Coates
b3738a7a63
Use permission APIs for the /computercraft command
- Add a generic PermissionRegistry interface. This behaves similarly to
   our ShaderMod interface, searching all providers until it finds a
   compatible one.

   We could just make this part of the platform code instead, but this
   allows us to support multiple systems on Fabric, where things are
   less standardised.

   This interface behaves like a registry, rather than a straight
   `getPermission(node, player)` method, as Forge requires us to list
   our nodes up-front.

 - Add Forge (using the built-in system) and Fabric (using
   fabric-permissions-api) implementations of the above interface.

 - Register permission nodes for our commands, and use those
   instead. This does mean that the permissions check for the root
   /computercraft command now requires enumerating all child
   commands (and so potential does 7 permission lookups), but hopefully
   this isn't too bad in practice.

 - Remove UserLevel.OWNER - we never used this anywhere, and I can't
   imagine we'll want to in the future.
2023-08-27 12:22:40 +01:00
Jonathan Coates
5f8b1dd67f
Update Cobalt to 0.7.2
- Support printing and parsing hex float literals
 - Fix string.format "%q"'s handling of nan and inf (Kan18)
 - Fix string is-letter/is-digit patterns treating characters as
   unicode.
 - tostring(...) now uses __name.
2023-08-24 21:27:00 +01:00
Jonathan Coates
52b78f92cd
Use standard Markdown link syntax for references
References are now written using normal links: You now use [`print`] or
[print a string][`print`]) instead of @{print} or @{print|print a
string}.
2023-08-24 11:23:33 +01:00
Jonathan Coates
12ee47ff19
Bump illuaminate version
This has a new Markdown parser, so we need to remove our use of image
attributes.
2023-08-23 18:09:26 +01:00
Jonathan Coates
b6632c9ed9
Fix model hook nullability
Only an issue on the latest FAPI, so we also bump that.
2023-08-05 10:32:21 +01:00
Jonathan Coates
24d74f5c80
Update to latest Fabric
- Overhaul model loading to work with the new API. This allows for
   using the emissive texture system in a more generic way, which is
   nice!

 - Convert some of our custom models to use Fabric's model hooks (i.e.
   emitItemQuads). We don't make use of this right now, but might be
   useful for rendering tools with enchantment glints.

   Note this does /not/ change any of the turtle block entity rendering
   code to use Fabric/Forge's model code. This will be a change we want
   to make in the future.

 - Some cleanup of our config API. This fixes us printing lots of
   warnings when creating a new config file on Fabric (same bug also
   occurs on Forge, but that's a loader problem).

 - Fix a few warnings
2023-07-18 19:27:27 +01:00
Jonathan Coates
c2988366d8
Add EMI compatibility
This just adds stack comparisons, so that upgrades are considered (much
like JEI and REI). No dynamic recipes, as EMI doesn't support those :(.
2023-07-10 20:31:06 +01:00
Jonathan Coates
ec0765ead1
Bump Cobalt to 0.7.1
- Fix numbers ending in "f" or "d" being lexed.
 - Fix string.pack's "z" causing out-of-bounds errors.
2023-07-10 20:17:54 +01:00
Jonathan Coates
7f25c9a66b
Only load client config on the client 2023-07-09 18:44:33 +01:00
Jonathan Coates
e337a63712
Bump FG and Loom
Also split up CI steps a little, so that it's more clear what failed.
2023-07-05 20:58:15 +01:00
Jonathan Coates
f5b16261cc
Update to Gradle 8.x
- Update to Loom 1.2 and FG 6.0. ForgeGradle has changed how it
   generates the runXyz tasks, which makes running our tests much
   harder. I've raised an issue upstream, but for now we do some nasty
   poking of internals.

 - Fix Sodium/Iris tests. Loom 1.1 changed how remapped configurations
   are generated - we create a dummy source set and associate the
   remapped configuration with that. All nasty stuff.

 - Publish the common library. I'm not a fan of this, but given how much
   internals I'm poking elsewhere, should probably get off my high
   horse.

 - Add renderdoc support to the client gametests, enabled with
   -Prenderdoc.
2023-06-29 20:10:17 +01:00
JackMacWindows
c8523bf479
Add ability to serialize Unicode strings to JSON (#1489) 2023-06-18 21:42:28 +00:00
Jonathan Coates
ec52f3e0e8
Bump CC:T to 1.104.0 2023-06-10 08:55:07 +01:00
Drew Edwards
c91bb5ac33
Add support for proxying HTTP requests (#1461) 2023-06-06 18:58:24 +00:00
Jonathan Coates
8fdef542c9
Update to latest JEI 2023-06-04 12:49:46 +01:00
Jonathan Coates
3112f455ae
Support arguments being coerced from strings
In this case, we use Lua's tostring(x) semantics (well, modulo
metamethods), instead of Java's Object.toString(x) call. This ensures
that values are formatted (mostly) consistently between Lua and Java
methods.

 - Add IArguments.getStringCoerced, which uses Lua's tostring semantics.

 - Add a Coerced<T> wrapper type, which says to use the .getXCoerced
   methods. I'm not thrilled about this interface - there's definitely
   an argument for using annotations - but this is probably more
   consistent for now.

 - Convert existing methods to use this call.

Closes #1445
2023-05-20 18:54:22 +01:00
Jonathan Coates
232c051526
Update to latest Fabric
- Use Fabric FakePlayer class
 - Remove redundant explosion accessor
2023-05-04 18:50:00 +01:00
Jonathan Coates
5d7cbc8c64
Use Fabric's new SlottedStorage for inventory methods
This is a little more general than InventoryStorage and means we can get
rid of our nasty double chest hack.

The generic peripheral system doesn't currently support generics (hah),
and so we need to use a wrapper class for now.
2023-04-16 09:16:39 +01:00
Jonathan Coates
1f3815039f
Bump CC:T to 1.104.0 2023-04-05 20:50:01 +01:00
Jonathan Coates
f93a33aa5e
Bundle jzlib with our published jar
Netty requires this for handling compressed websockets with non-default
compression arguments.

Closes #1394
2023-03-29 09:32:06 +01:00
Jonathan Coates
5bb2e8e8cd
Update Cobalt to 0.7
- Timeouts are now driven by an interrupt system, rather than polling.
   While we do not impose memory limits, this should close #1333.

 - Update the table library to largely match Lua 5.4:
    - Add table.move
    - Table methods (with the exception of foreach/foreachi) now use
      metamethods (closes #1088).
   There's still some remaining quirks (for instance, table.insert
   accepts values out-of-bounds), but I think that's fine.

 - Cobalt's threaded-coroutine system is gone (load now supports
   yielding), so we no longer track coroutine metrics.

 - Type errors now use __name. See #1355, though this does not apply to
   CC methods (either on the Java or CraftOS side), so is not enough to
   resolve it.

See https://github.com/SquidDev/Cobalt/compare/v0.6.0...v0.7.0 for the
full delta.
2023-03-26 19:42:55 +01:00
Jonathan Coates
266182996d
Publish Fabric jars to CF/Modrinth
Like all publishing code, we'll only find out if it works when we run
it!
2023-03-15 23:20:13 +00:00
Jonathan Coates
895bc7721a
License CC:T according to the REUSE specification (#1351)
This adds SPDX license headers to all source code files, following the
REUSE[1] specification. This does not include any asset files (such as
generated JSON files, or textures). While REUSE does support doing so
with ".license" files, for now we define these licences using the
.reuse/dep5 file.

[1]: https://reuse.software/
2023-03-15 21:52:13 +00:00
Jonathan Coates
3e6e3e70e5
Update to 1.19.4 (#1376) 2023-03-15 21:04:11 +00:00
Jonathan Coates
44f945c040
Correctly obey stack limits in OffsetStorage.extract/insert
Many thanks to Lem for managing to reproduce it. It was actually an easy
bug bug to spot on second look, but having a reliable way to verify was
super helpful.

Fixes #1338
2023-03-15 20:07:17 +00:00
Jonathan Coates
e96ac35d67
Replace Forge Config port with a NYI version
While it is a really nice library, it ends up being a bit overkill for
our needs - we don't need config syncing or anything. By NIHing our own,
we can drop one dependency and ease the updating burden a little.

Closes #1296
2023-03-14 22:47:34 +00:00
Jonathan Coates
a74089d8ae
Bump dependency versions
Mostly in prep for 1.19.4.

 - Update to Loom 1.1.

   - Simplifies our handling of remapped configurations a little.
   - Removes the need for a fake fabric.mod.json in the API jar.

   For reasons I don't quite understand, this required us to bump the
   Fabric API version. Otherwise interfaces are not injected.

 - Update to Rollup 3.0.

 - Do NOT update NullAway: It now correctly checks @Nullable fields in
   inherited classes. This is good, but also a pain as Minecraft is a
   little over-eager in where it puts @Nullable.
2023-03-14 18:43:42 +00:00
Jonathan Coates
77fc2e3af4
Bump illuaminate
- Fix search failing when something is missing a summary (i.e. the
   window API)

 - Correctly use ":" or "." for type members - previously it was
   incredibly inconsistent.
2023-02-14 08:44:19 +00:00
Jonathan Coates
33b6f38339
Hide the internal redirect methods in multishell
Previously it was possible to access all methods of the multishell
redirect by calling term.current(). This is definitely not intended, as
it leaks all sorts of internals to the user.

Also bump illuaminate - the new version is about twice as fast on my
machine.
2023-02-12 21:26:01 +00:00
Jonathan Coates
5502412181
Improve display of runtime errors (#1320)
- Bump Cobalt to 0.6.0. We now track both line and column numbers of
   each bytecode instruction, allowing us to map an error to a concrete
   position.

 - `loadfile` (and similar functions) now use the full path, rather than
   the file name. Cobalt truncates this to 30 characters (rather than
   the previous 60) so this should be less noisy.

 - The shell, edit and Lua REPL now display the corresponding source
   code alongside an error.

   Note this is incredibly limited right now - it won't cope with errors
   which cross coroutine boundaries. Supporting this is on the roadmap,
   but requires some careful API design.
2023-02-09 20:53:50 +00:00
Jonathan Coates
b21e2f4e63
Update Cobalt to fix yielding inside __len
Closes #1307
2023-01-26 09:43:10 +00:00
Jonathan Coates
e076818b29
Bump Cobalt for even more verbose VM logging
See #1307
2023-01-25 18:47:27 +00:00
Jonathan Coates
d066d175bf
Attach a speaker peripheral inside its docs
This required a version bump to cct-javadoc to allow using attributes
inside <pre> blocks.
2023-01-22 12:24:36 +00:00
Jonathan Coates
9e1de23f4a
Log internal Cobalt VM errors
See #1307
2023-01-17 20:37:16 +00:00
Jonathan Coates
86b60855d6
Enforce version bounds for the Kotlin stdlib
We were pulling in an ancient version of the jdk8 stdlib via
kotlinx.coroutines, hence the conflict in versions.
2023-01-17 20:28:31 +00:00
Jonathan Coates
db6b6fd173
Bump Kotlin version to 1.8 2023-01-17 19:33:49 +00:00
Jonathan Coates
592ff84aea
Read computer threads directly from the config object (#1295)
This gives us slightly better guarantees that the config has actually
been loaded. This, along with a FCAP bump, fixes this config option
not doing anything on Fabric.
2023-01-07 22:16:06 +00:00
Jonathan Coates
34a31abd9c
Move our internal module into the main package path
I originally put cc.import in a separate directory from the main
modules. This means that programs must extend the package path in order
to import these modules.

However, this ends up being a mixed blessing: while it makes it much
harder for users to accidentally require user code, it also means we
can't expose a public interface which wraps a private module.

Instead, cc.import now lives on the main package path, but lives under
the cc.internal namespace and is not documented anywhere. Hopefully this
should be enough of a clue that one shouldn't use it :p.
2023-01-05 21:55:08 +00:00
Jonathan Coates
bdecb88cca
Support resource conditions in upgrade JSON 2023-01-02 15:56:01 +00:00
Jonathan Coates
e241575329
Prepare for 1.102.0
This is a stupid tradition.
2022-12-24 10:51:54 +00:00
Jonathan Coates
86c4c7483d
Bump Cobalt and ForgeConfigAPI versions
Fixes #1248, fixes #1249
2022-12-21 15:58:51 +00:00
Jonathan Coates
2b237332ce
Update to latest Forge
This fixes the issue with DeferredRegister crashing on non-wrapped
registries.
2022-12-15 17:53:50 +00:00
Jonathan Coates
06163e4f25
Fix a couple of packaging issues
- Fix client classes not being included in Forge.
 - Only remap Nettty's HTTP classes, not all of them. This feels a
   little more error prone - maybe we should jar-in-jar this in the
   future.
 - Use the correct refmaps on Forge.
 - Prevent the Fabric jar pulling in some other mods.

Closes #1247
2022-12-12 20:28:18 +00:00
Jonathan Coates
8007a30849
Actually update README with the new maven coordinates
Also bump REI to 1.19.3
2022-12-09 18:05:35 +00:00
Jonathan Coates
c3fe9f00d4
Update to Minecraft 1.19.3
Lots of minor changes, but nothing too nasty - just tedious.

Known bugs/issues:
 - REI and JEI haven't been updated at the time of writing, so our usage
   of their APIs may be incompatible.

 - Crash when opening the config UI in Fabric, as forgeconfigapi-port
   hasn't been updated yet.

Will hold off on doing a release until those mods have updated.
2022-12-08 19:45:02 +00:00
Jonathan Coates
020c5cd2d3
Support renaming files directly without copying/deleting
In classic squid tradition: 20% code, and 80% test logic.

Closes #962. Alas, whoever reported this has deleted their account, so
they can't even be happy about it :(.
2022-12-04 21:59:30 +00:00
Jonathan Coates
fa122a56cf
Resolve a few TODOs
- Update ForgeConfigAPI to the latest version, to fix the race
   condition.
 - Move WirelessNetwork lifecycle management to ServerContext.
 - Some doc fixes.
2022-12-03 15:55:48 +00:00
Jonathan Coates
95c57e843d
Pass project root to cct-javadoc
Fixes #1238
2022-12-02 22:00:00 +00:00
Jonathan Coates
2255d49d16
Update to latest Fabric
Love being on the bleedin' edge. More importantly, this fixes a couple
of issues:
 - Translations are loaded on the server, meaning .getItemDetail
   correctly translates modded items.
 - Shulker boxes cannot be moved inside other shulker boxes using the
   transfer API.
 - Start using Fab API's ItemStack.getRecipeRemainder().
2022-11-20 16:05:28 +00:00
Jonathan Coates
08df68dcc0
Generate en_us.json via datagen
I was originally pretty sceptical about this, but it actually ends up
being useful for the same reason any other form of datagen is: we can
ensure that names are well formed, and that every string is actually
translated.

There's some future work here to go through all the custom translation
keys and move them into constants (maybe also do something with the
/computercraft command?), but that's a separate chunk of work.

The main motivation for this is to add translation keys to our config:
the Fabric version of Forge Config API provides a config UI, so it's
useful to provide user-friendly strings. Our generator also
automatically copies comments over, turning them into tooltips.

This also updates all of the other language files to match en_us.json
again: it's a very noisy diff as the file is now sorted alphabetically.
Hopefully this won't affect weblate though

[^1]: Amusing really that the Fabric port actually is more useful than
the original.
2022-11-20 13:00:43 +00:00