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

2185 Commits

Author SHA1 Message Date
Jonathan Coates
1e703f1b07
Fix several off-by-one issues in UploadFileMessage
We now fuzz UploadFileMessage, generating random files and checking they
round-trip correctly.

The joy of having a long-lasting refactor branch with an absolutely
massive diff, is that you end up spotting bugs, and then it's a massive
pain to merge the fix back into trunk!
2022-10-21 23:10:18 +01:00
Jonathan Coates
b663028f42
Start work on curtailing our global state
The last 4 or 5 commits have simplified things. I can now have some
unnecessary complexity as a treat!

This is some initial work on better tying the lifecycle of
computers (and ComputerCraft) related state to the lifecycle of the
current Minecraft server.

 - Move server-wide methods in IComputerEnvironment (such as creating
   resource mounts) into a separate interface.
 - Add a new ServerContext class, which now holds the ID Assigner,
   server computer registry, and some other tiny bits and bobs. This can
   only be accessed by ServerContect.get(MinecraftServer), forcing
   slightly better discipline for how we use these globals.

This does allow us to nuke some of the ugliest bits in IDAssigner. Even
if it makes things much longer!
2022-10-21 21:02:24 +01:00
Jonathan Coates
cee60cdb5b
Require computers to have a fixed ID
Moves ID assigning out of the Computer class and into wherever we
construct the ServerComputer (so in computer blocks and pocket computer
items).

This is definitely not perfect - it'd be nice to make ServerComputers
more responsible for managing the lifecycle of computers (so assigning
ids, handling auto-starting, etc...), but I've not found a good way to
handle this yet!
2022-10-21 19:51:41 +01:00
Jonathan Coates
695ef0542a
Don't store a mutable array in Colour
It's kinda bad form, and we no longer need it anyway!
2022-10-21 19:07:58 +01:00
Jonathan Coates
c0d20b72c9
Remove ClientTerminal/ServerTerminal
They bring very little to the table now that computers do their own
thing! This also helps simplify the code in ServerMonitor a bit - turns
out we had two "dirty" flags in the implementation!
2022-10-21 19:00:29 +01:00
Jonathan Coates
cf05ab1db1
Store colour support in the Terminal
Previously we stored it alongside the terminal. While this makes sense -
it's not a property of the terminal itself, it ends up duplicating code
in a bunch of places.

We now track the colour flag on the terminal itself. This allows us to
simplify a couple of things:

 - The palette now also knows whether it supports colours or not, and so
   performs greyscale conversion. This means we no longer need to thread
   a "greyscale" flag throughout terminal rendering.

 - Remove isColour() getters from a whole load of
   places (TerminalMethods, ServerTerminal, IComputerEnvironment).
2022-10-21 18:26:57 +01:00
Jonathan Coates
c49547b962
Remove ClientComputer
Historically CC has maintained two computer registries; one on the
server (which runs the actual computer) and one on the client (which
stores the terminal and some small bits of additional data).

This means when a user opens the computer UI, we send the terminal
contents and store it in the client computer registry. We then send the
instance id alongside the "open container" packet, which is used to look
up the client computer (and thus terminal) in our client-side registry.

This patch makes the computer menu syncing behaviour more consistent
with vanilla. The initial terminal contents is sent alongside the "open
container" packet, and subsequent terminal changes apply /just/ to the
open container. Computer on/off state is synced via a vanilla
ContainerData/IIntArray.

Likewise, sending user input to the server now targets the open
container, rather than an arbitrary instance id.

The one remaining usage of ClientComputer is for pocket computers. For
these, we still need to sync the current on/off/blinking state and the
pocket computer light.

We don't need the full ClientComputer interface for this case (after
all, you can't send input to a pocket computer someone else is
holding!). This means we can tear out ClientComputer and
ClientComputerRegistry, replacing it with a much simpler
ClientPocketComputers store.

This in turn allows the following changes:

 - Remove IComputer, as we no longer need to abstract over client and
   server computers.

 - Likewise, we can merge ComputerRegistry into the server
   registry. This commit also cleans up the handling of instance IDs a
   little bit: ServerComputers are now responsible for generating their
   ID and adding/removing themselves from the registry.

 - As the client-side terminal will never be null, we can remove a whole
   bunch of null checks throughout the codebase.

 - As the terminal is available immediately, we don't need to explicitly
   pass in terminal sizes to the computer GUIs. This means we're no
   longer reliant on those config values on the client side!

 - Remove the "request computer state" packet. Pocket computers now
   store which players need to know the computer state, automatically
   sending data when a new player starts tracking the computer.
2022-10-21 18:17:43 +01:00
Jonathan Coates
c8e15f201c
Correctly bind VBOs before drawing them
Caused by 4228011b84. While correct on
1.18, this isn't correct on 1.19 - I clearly messed up the merge here.

Fixes #1183, possibly #1184 - haven't been able to reproduce.
2022-10-16 09:50:17 +01:00
Jonathan Coates
bc79100a2f
Merge branch 'mc-1.18.x' into mc-1.19.x 2022-10-14 22:09:13 +01:00
Jonathan Coates
9ed5ebb868
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-10-12 08:32:03 +01:00
Jonathan Coates
a9b74dc979
Make IRC links https 2022-10-09 11:22:24 +01:00
Jonathan Coates
12b8a0393f
Dump Cobalt's internal state on timeouts
Closes #1180
2022-10-09 11:22:16 +01:00
Jonathan Coates
cbfd83c2ba
Merge pull request #1182 from Quezler/patch-2
Add all but 3 of the missing dutch translations
2022-10-08 20:54:34 +01:00
Patrick 'Quezler' Mounier
8564c1e54b
Add all but 3 of the missing dutch translations 2022-10-08 21:00:58 +02:00
Jonathan Coates
66dff1523b
Merge branch 'mc-1.18.x' into mc-1.19.x 2022-10-01 12:37:10 +01:00
Jonathan Coates
08895cdecc
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-10-01 12:36:09 +01:00
Jonathan Coates
5be290a1e2
Bump version to 1.100.10
One more version and then it's a palendrome! Sort of.
2022-10-01 12:33:06 +01:00
Jonathan Coates
371f931140
Always add HTTP programs to the path (#1172) 2022-09-30 09:00:07 +00:00
Jonathan Coates
da5956e943
Make the sidebar a little wider
I was going to do something productive tonight, but then this happened.

Whatever, I'm retired, I'm allowed to make my entire existence just
adding 50px to things. Heck, maybe I'll do the same tomorrow too.
2022-09-29 22:21:38 +01:00
Jonathan Coates
e7533f2353
Improve community links a little 2022-09-29 22:01:51 +01:00
roland-a
0b7fbcde53
Send block updates to client when the turtle moves #1167 (#1170)
Fixes #1167
2022-09-29 17:49:02 +00:00
Jonathan Coates
76f8dd2d14
Properly bump to 1.19.2
We support 1.19.2 already (well, hopefully!), this just drops 1.19.1
support.
2022-09-21 18:11:50 +01:00
Jonathan Coates
c3b7302108
Remove some unused arguments in LuaDateTime
See comments in #1157
2022-09-11 15:03:09 +01:00
Jonathan Coates
61ac48c99f
Mention audio formats in speaker help
Closes #1133. I'm not super happy about any of the versions proposed
there, but I think this is better than nothing.

Co-authored-by: JackMacWindows <jackmacwindowslinux@gmail.com>
2022-09-11 14:57:45 +01:00
Jonathan Coates
d22e138413
Fix numerous off-by-one errors in help program
We clamped various values to the height of the screen, rather than the
height of the content box (height-1). We didn't notice this most of the
time as the last line of a file is empty - it only really mattered when
a file was the same height as the computer's screen.

We now do the following:
 - Strip the trailing new line from a file when reading.
 - Replace most usages of height with height-1.
2022-09-11 14:57:34 +01:00
Jonathan Coates
ba64e06ca7
Use a Gradle plugin to download illuaminate
Previously illumainate required manual users to manually download it and
place it in ./bin/. This is both inconvenient for the user, and makes it
hard to ensure people are running the "right" version.

We now provide a small Gradle plugin which registers illuaminate as a
ependency, downloading the appropriate (now versioned!) file. This also
theoretically supports Macs, though I don't have access to one to test
this.

This enables the following changes:

 - The Lua lint script has been converted to a Gradle task (./gradle
   lintLua).

 - illuaminateDocs now uses a task definition with an explicit output
   directory. We can now consume this output as an input to another
   task, and get a task dependency implicitly.

 - Move the pre-commit config into the root of the tree. We can now use
   the default GitHub action to run our hooks.

 - Simplify CONTRIBUTING.md a little bit. Hopefully it's less
   intimidating now.
2022-09-11 14:11:33 +01:00
Jonathan Coates
db8c979a06
Merge pull request #1156 from IvoLeal72/patch-1
Fixed usage example of textuils.pagedTabulate
2022-08-28 16:41:40 +01:00
Ivo Leal
9d18487dc5
Fixed usage example of textuils.pagedTabulate 2022-08-28 15:24:47 +01:00
Jonathan Coates
34a2e87735
Merge branch 'mc-1.18.x' into mc-1.19.x 2022-07-30 18:46:31 +01:00
Jonathan Coates
feb7681c9c
Add some missing test timeouts 2022-07-30 18:14:43 +01:00
Jonathan Coates
ad4a2aa68d
Mirror Oculus with our maven
In some ways it's probably less reliable than modrinth, but let's be
consistent here.
2022-07-30 17:56:56 +01:00
Jonathan Coates
4228011b84
Support Occulus shaders
This is mostly copied from the work Toad and I did for CC:R.

Instead of not writing to the depth buffer when rendering terminals, we
now render terminal forgrounds with a small glPolygonOffset (or an
emulation of it where not possible). This removes the need for custom
render types, while still avoiding z-fighting between the terminal
foreground and background.

The VBO monitors backend now uses Iris's TextVertexSink API when
available: Iris overwrites the vertex format for RenderType.text, and so
we need to use this API to avoid rendering garbage.

Performance is maybe a little worse than before (<3ms) and definitely
worse than CC:R. Unfortunately we can't do our upload batching as that
conflicts with Optifine's patches - instead we need to maintain two
separate VBOs. This is a bit slower, but not so bad it's unworkable.
2022-07-30 12:15:04 +01:00
Jonathan Coates
c43d851e63
Register turtle upgrade models separately
ITurtleUpgrade.getModel has always been rather error-prone to use, due
to its client-only nature. As ModelResourceLocation is now client-only
again in Forge 1.19.1, no seems a good time to fix this.

The getter for models is now a separate interface inside a new
dan200.computercraft.api.client package. These are registered
per-TurtleUpgradeSerialiser (as those should correspond to class
anyway). It's a little ugly, and we may rename the XxxSerialiser classes
to something more general in a future update.

I'm not wild about the interface here either - happy to change it in
future versions too.

   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Also clean up the generic arguments to IUpgradeBase/UpgradeSerialiser a
little bit. It's not great (wish Java had HKTs), but it's better.
2022-07-28 19:02:38 +01:00
Jonathan Coates
50fe7935a3
Merge branch 'mc-1.18.x' into mc-1.19.x 2022-07-28 09:49:25 +01:00
Jonathan Coates
bd19fdf350
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-07-28 09:43:06 +01:00
Jonathan Coates
c3615d9c5b
Update to 1.19.1 2022-07-28 08:52:03 +01:00
Jonathan Coates
e2041f7438
Bump version to 1.100.9 2022-07-27 08:25:31 +01:00
Jonathan Coates
d61202e2b8
Fix location of language file 2022-07-27 07:52:05 +01:00
Weblate
6ce88a7dcf Translations for Norwegian Bokmål
Co-authored-by: Erlend <erlend.bergersen@sandnesskolen.no>
2022-07-26 13:17:57 +00:00
Weblate
5d65b3e654 Added translation for Norwegian Bokmål
Co-authored-by: Erlend <erlend.bergersen@sandnesskolen.no>
2022-07-24 15:45:46 +00:00
Erlend
abf857f864
Clearify GPS documentation note (#1139) 2022-07-22 20:27:27 +00:00
Jonathan Coates
ebef3117f2
Update npm packages 2022-07-21 20:38:44 +01:00
Jonathan Coates
25a44bea6e
Correctly set VertexBuffer.format
Fixes #1137. Maybe.
2022-07-21 09:50:33 +01:00
Jonathan Coates
b28c1ac8e0
Test various time locales exist
Not clear if we can really test their behaviour too much.

See 69b211b4fb.
2022-07-21 09:44:40 +01:00
Jonathan Coates
69b211b4fb
Fix name of "ingame" time locale
This has been here since 1.17 :D. Class rename gone wrong!
2022-07-21 09:44:36 +01:00
Jonathan Coates
48147fa61c
Don't use MultiBufferSource for monitors
We're doing lots of weird OpenGL shenangins anyway, so it doesn't make
sense to use it. Instead just draw directly using the Tesselator
BufferBuilder.

This might improve compatiability with Sodium/Rubidium. Please don't let
me know if it doesn't though - I really don't want to have to deal with
it any more.
2022-07-16 22:07:23 +01:00
Jonathan Coates
ba976f9a16
Fix monitor depth blocker being too small
This allowed you to see transparent blocks through the bottom/right
margins of the monitor when using the VBO renderer.
2022-07-16 22:07:15 +01:00
Luiz Krüger
969feb4a1c
ItemGroup info on getItemDetail (#1127) 2022-07-16 20:30:20 +00:00
Jonathan Coates
4a273ae8e5
Update to latest Forge
- Lots of refactoring/cleanup to Forge's events and client APIs.
   - Render types/layers for blocks are now set on the model rather than
     in code.

   - Models now can work with multiple render types. As this would
     massively complicate the implementation of the turtle item model, we
     now implement a much simpler version, which makes use of Forge's
     BakedModel.getRenderPasses to return a separate model for the core
     turtle and each upgrade.

 - Send monitor contents to players immediately when they start watching
   the chunk. ChunkWatchEvent.Watch is now fired from a more sensible
   location, so this is much easier to implement!
2022-07-16 19:08:11 +01:00
JackMacWindows
bd5de11ad5
Add WAV support to speaker program (#1112) 2022-07-09 08:59:35 +01:00