1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-15 14:07:38 +00:00

Compare commits

...

249 Commits

Author SHA1 Message Date
SquidDev
9134f243c1 Merge branch 'master' into mc-1.14.x 2020-06-15 22:05:02 +01:00
SquidDev
c0f3ca81fb Bump to 1.89.0 2020-06-15 21:37:08 +01:00
SquidDev
b9b8121be9 Expose tags for turtle.{inspect,getItemDetail}
This is simply exposed as a table from tag -> true. While this is less
natural than an array, it allows for easy esting of whether a tag is
present.

Closes #461
2020-06-01 11:17:05 +01:00
Lignum
014bf55cd4 Cherry pick several improvements from #455
- Use texture over texture2D - the latter was deprecated in GLSL 1.30.
 - Cache the tbo buffer - this saves an allocation when monitors update.

Closes #455. While the rest of the PR has some nice changes, it
performs signlificantly worse on my system.
2020-05-31 17:23:49 +01:00
Lignum
085ae2e74a Use an older version of GLSL (#459)
This ensures that the MVP matrix is available within the monitor
fragment shader, without requiring the ARB_compatibility extension.
2020-05-28 11:06:14 +01:00
Lignum
4ff33f165d Fetch MVP matrix in monitor shader instead (#454) 2020-05-25 11:19:03 +01:00
SquidDev
d929c02d2a Fix settings loading failing for defined settings
Yes, this was the only piece of code which wasn't tested :/. Fixes #457.
2020-05-24 12:16:51 +01:00
Jonathan Coates
d50a08a549 Rewrite monitor networking (#453)
This moves monitor networking into its own packet, rather than serialising
using NBT. This allows us to be more flexible with how monitors are
serialised.

We now compress terminal data using gzip. This reduces the packet size
of a max-sized-monitor from ~25kb to as little as 100b.

On my test set of images (what I would consider to be the extreme end of
the "reasonable" case), we have packets from 1.4kb bytes up to 12kb,
with a mean of 6kb. Even in the worst case, this is a 2x reduction in
packet size.

While this is a fantastic win for the common case, it is not abuse-proof.
One can create a terminal with high entropy (and so uncompressible). This
will still be close to the original packet size.

In order to prevent any other abuse, we also limit the amount of monitor
data a client can possibly receive to 1MB (configurable).
2020-05-20 08:44:44 +01:00
SquidDev
13de2c4dd0 Fix location of cc.require
Yay for 1.12->1.13 changes!
2020-05-15 10:28:35 +01:00
SquidDev
906280225e Merge branch 'master' into mc-1.14.x 2020-05-15 10:19:57 +01:00
SquidDev
161a5b4707 Document and test the redstone library
The tests may be a little agressive, but I wanted some sanity checks for
the 1.15 API rewrite.
2020-05-15 10:03:47 +01:00
SquidDev
c6b6b4479c Update changelog and fix doc typo 2020-05-14 19:23:57 +01:00
SquidDev
96e7b60285 Display function arguments and positions in the REPL
- cc.pretty.pretty now accepts two additional options:
   - function_args: Show function arguments
   - function_source: Show where functions are defined.
 - Expose the two options as lua.* settings (defaulting function_args to
   true, and function_source to false).
   These are then used in the Lua REPL.

Closes #361
2020-05-14 19:11:57 +01:00
SquidDev
086fccd997 Move the package library into a separate module
Hopefully this makes it a little easier for people to use in custom
shells (and anything else where it might be useful).
2020-05-14 17:27:50 +01:00
Jonathan Coates
e251dd066c Fix test failures 2020-05-13 15:27:50 +01:00
SquidDev
c60dcb4f5a Fix deprecated usage 2020-05-13 14:04:32 +01:00
SquidDev
4be0b15afa Merge branch 'master' into mc-1.14.x 2020-05-13 14:04:28 +01:00
SquidDev
a4ae36b6b3 Bump version to 1.88.0
There's probably some other stuff I'll get in before release, but let's
do this just in case.
2020-05-13 13:43:40 +01:00
SquidDev
ac075d9f53 Allow using command computers in survival mode
I'm really not a fan of this change, but it's gated behind a config
option and there's apparently sufficient demand that it's worthwhile.
Closes #442.
2020-05-13 10:26:59 +01:00
Lupus590
05d7be0362 Improvements to the various file system programs (rm, mv, rename) (#440)
This enforces several sanity checks before actually attempting
the move, allowing us to produce friendlier error messages.
2020-05-12 11:32:48 +01:00
SquidDev
9a71dc1a26 Copy across a bunch of 5.1/5.3 io tests
I've been meaning to do this for ages. Woops.
2020-05-11 18:05:40 +01:00
SquidDev
156023b154 Create more work for myself
This ensures no lines start with an empty line, and all files finish
with exactly one "\n".
2020-05-11 16:08:25 +01:00
SquidDev
6b3773a862 Run tests with coverage
- Use jacoco for Java-side coverage. Our Java coverage is /terrible
   (~10%), as we only really test the core libraries. Still a good thing
   to track for regressions though.

 - mcfly now tracks Lua side coverage. This works in several stages:
   - Replace loadfile to include the whole path
   - Add a debug hook which just tracks filename->(lines->count). This
     is then submitted to the Java test runner.
   - On test completion, we emit a luacov.report.out file.

   As the debug hook is inserted by mcfly, this does not include any
   computer startup (such as loading apis, or the root of bios.lua),
   despite they're executed.

   This would be possible to do (for instance, inject a custom header
   into bios.lua). However, we're not actually testing any of the
   behaviour of startup (aside from "does it not crash"), so I'm not
   sure whether to include it or not. Something I'll most likely
   re-evaluate.
2020-05-11 15:47:30 +01:00
Jonathan Coates
376d628cf0 Make the local Lua message a little shorter
Co-authored-by: exerro <benedict.allen2514@gmail.com>
2020-05-09 08:30:55 +01:00
Lupus590
44062ebd52 Allow lua REPL to warn about using local variables (#367)
`local varname = value` results in `varname` being inaccessible in
the next REPL input. This is often unintended and can lead to confusing
behaviour. We produce a warning when this occurs.
2020-05-08 16:07:33 +01:00
Jonathan Coates
5739285fc2 Finish off documentation for the commands API 2020-05-05 21:17:52 +01:00
Jonathan Coates
70b457ed18 Add a monitor renderer using TBOs (#443)
This uses the system described in #409, to render monitors in a more
efficient manner.

Each monitor is backed by a texture buffer object (TBO) which contains
a relatively compact encoding of the terminal state. This is then
rendered using a shader, which consumes the TBO and uses it to index
into main font texture.

As we're transmitting significantly less data to the GPU (only 3 bytes
per character), this effectively reduces any update lag to 0. FPS appears
to be up by a small fraction (10-15fps on my machine, to ~110), possibly
as we're now only drawing a single quad (though doing much more work in
the shader).

On my laptop, with its Intel integrated graphics card, I'm able to draw
120 full-sized monitors (with an effective resolution of 3972 x 2330) at
a consistent 60fps. Updates still cause a slight spike, but we always
remain above 30fps - a significant improvement over VBOs, where updates
would go off the chart.

Many thanks to @Lignum and @Lemmmy for devising this scheme, and helping
test and review it! ♥
2020-05-05 13:05:23 +01:00
SquidDev
6816931659 Merge branch 'master' into mc-1.14.x 2020-05-04 10:28:15 +01:00
SquidDev
1547ecbeb3 Fix incorrect palette serialisation 2020-05-04 10:26:33 +01:00
SquidDev
c28b468844 Update languages and language script 2020-05-04 09:57:38 +01:00
SquidDev
052cf8ee7d Merge branch 'master' into mc-1.14.x 2020-05-04 09:39:54 +01:00
SquidDev
550ada2f9e Restore previous behaviour for unknown colours
Unknown blit colours, such as " " will be translated to black for the
background or white for the foreground. This restores the behaviour from
before #412.
2020-05-04 09:15:23 +01:00
SquidDev
17b7727262 Improve serialisation of terminals
- Write to a PacketBuffer instead of generating an NBT tag. This is
   then converted to an NBT byte array when we send across the network.
 - Pack background/foreground colours into a single byte.

This derives from some work I did back in 2017, and some of the changes
made/planned in #409. However, this patch does not change how terminals
are represented, it simply makes the transfer more compact.

This makes the patch incredibly small (100 lines!), but also limited in
what improvements it can make compared with #409. We send 26626 bytes
for a full-sized monitor. While a 2x improvement over the previous 58558
bytes, there's a lot of room for improvement.
2020-05-03 10:38:31 +01:00
Jonathan Coates
4553e404b2 Merge pull request #437 from SquidDev-CC/feature/keep-ids
Preserve computer ids on unlabelled computers
2020-05-03 06:54:04 +01:00
Drew Lemmy
a565a571f9 Return the peripheral name when wrapping (#436) 2020-05-03 06:53:42 +01:00
SquidDev
fb64b6017b Add shell.execute
This functions the same as shell.run, but does not tokenise the
arguments. This allows us to pass command line arguments through to
another program without having to re-quote them.

Closes #417
2020-05-02 11:05:09 +01:00
SquidDev
ed4229ab70 Keep ids of unlabelled computers and turtles 2020-05-02 10:38:18 +01:00
SquidDev
3fb906ef6c Show computer/disk ids in the tool tip more often
- Remove the parenthesis around the text (so it's now
   "Computer ID: 12"), rather than "(Computer ID: 12").
 - Show the tooltip if the computer has an ID and no label (as well as
   when in advanced mode).
2020-05-02 10:38:17 +01:00
Jonathan Coates
e1663f3df0 Fix malformed doc comments 2020-05-01 08:50:44 +01:00
SquidDev
358289b5f9 Merge branch 'master' into mc-1.14.x 2020-04-29 17:37:36 +01:00
SquidDev
5eec24676f Prevent computers scanning peripherals twice 2020-04-29 17:37:02 +01:00
Jonathan Coates
447c3ab125 Clean up dance.lua
Not sure what keys.escape was doing there. That's very old.
2020-04-28 09:51:06 +01:00
Jonathan Coates
8fac68386e Fix usages of global variables
- Lint references to unknown fields of modules, excluding the keys and
   colours modules. This caught several silly errors in our stub files,
   but nothing else.
 - Lint on using unknown globals. This highlighted a couple of really
   silly mistakes. Fixes #427.
 - Add documentation for fs.attributes, fs.getCapacity and pocket, as
   they were not defined before.

Co-authored-by: JackMacWindows <jackmacwindowslinux@gmail.com>
2020-04-28 09:42:34 +01:00
SquidDev
b7c61f9c6d Bump version 2020-04-24 18:34:01 +01:00
SquidDev
08a0342618 Fix block drop data being generated in the incorrect place
Fixes half of #421
2020-04-24 16:41:46 +01:00
SquidDev
48cb032ddf Also publish on releases
This'll probably break. Let's see :)
2020-04-23 10:54:12 +01:00
SquidDev
a049502d12 Merge branch 'master' into mc-1.14.x 2020-04-23 10:03:45 +01:00
SquidDev
ae7ef66dfa Bump version
Oh no. I don't want to have to beta test this :D:.
2020-04-23 09:56:56 +01:00
JakobDev
9748679484 Add mouse support for the menu in edit and paint (#419) 2020-04-23 09:33:35 +01:00
SquidDev
da419b24e7 Enable motd on non-pocket and command computers
- I'm excluding pocket computers, as they have such a tiny screen I'm
   not sure the screen estate is worth it.
   Pocket computers /generally/ aren't people's starter machine, so I
   think this is fine.
 - Prune the motd list, and try to make them a little shorter. I think
   this list is more of the interesting ones. We can modify this list in
   the future, as we get more feedback.[^1]
 - Also fix paint/edit not adding an extension when they should. This
   was caused by the settings rewrite, as the explicitly provided
   default shadowed the one provided by bios.lua.

[^1]: ~5 months ago I asked for some feedback about enabling motds by
      default. I only got something constructive back today >_>.
2020-04-22 17:45:06 +01:00
Jonathan Coates
7f57a977a1 Make the CF link https on tweaked.cc
It doesn't play nice on GH, but we need it on our actual website.
2020-04-22 14:48:42 +01:00
Jonathan Coates
2f42a4e85b Add documentation for shell and multishell
Heh, one place we're more complete than cc.cc :p.
2020-04-22 14:39:39 +01:00
SquidDev
ee391ae9ea Register a fake renderer for turtle players
Fixes #383, probably.
2020-04-22 10:17:31 +01:00
SquidDev
4ed4a6409b Skip the src/generated file in check-lines 2020-04-22 10:07:43 +01:00
SquidDev
e5cc345f49 Some cleanup to the Lua programs 2020-04-22 10:00:43 +01:00
SquidDev
d847a4d9e0 Merge branch 'master' into mc-1.14.x
This also deletes display list support - MC 1.14 now requires VBOs to be
supported in some capacity.
2020-04-22 09:45:23 +01:00
JakobDev
f3de97d67f Remove / and \ at the start of shell.setDir() (#410)
Uses fs.combine to normalise the file path. This removes leading/trailing
slashes, as well as any redundant "../"s within the path.
2020-04-22 06:30:49 +01:00
Jonathan Coates
544f276ff0 Merge pull request #418 from Wojbie/settings-save-fix
Fix settings.save() sPath param.
2020-04-21 17:52:10 +01:00
Wojbie
463635a459 Fix save() sPath param. 2020-04-21 18:28:55 +02:00
SquidDev
3b7b845930 Some tiny bits of documentation cleanup
I'm really good at this English lark :D:.
2020-04-21 12:12:44 +01:00
Jonathan Coates
1fc0214857 Some redesigning of the settings API (#408)
- The store is now split into two sections:
   - A list of possible options, with some metadata about them.
   - A list of values which have been changed.
 - settings.define can be used to register a new option. We have
   migrated all existing options over to use it. This can be used to
   define a default value, description, and a type the setting must have
   (such as `string` or `boolean).

 - settings.{set,unset,clear,load,store} operate using this value list.
   This means that only values which have been changed are stored to
   disk.
   Furthermore, clearing/unsetting will reset to the /default/ value,
   rather than removing entirely.

 - The set program will now display descriptions.

 - settings.{load,save} now default to `.settings` if no path is given.
2020-04-21 11:37:56 +01:00
Jonathan Coates
11bf601db9 Backport 1.15's terminal rendering code (#412)
This is a backport of 1.15's terminal rendering code with some further
improvements. This duplicates a fair bit of code, and is much more
efficient.

I expect the work done in #409 will supersede this, but that's unlikely
to make its way into the next release so it's worth getting this in for
now.

 - Refactor a lot of common terminal code into
   `FixedWithFontRenderer`. This shouldn't change any behaviour, but
   makes a lot of our terminal renderers (printed pages, terminals,
   monitors) a lot cleaner.

 - Terminal rendering is done using a single mode/vertex format. Rather
   than drawing an untextured quad for the background colours, we use an
   entirely white piece of the terminal font. This allows us to batch
   draws together more elegantly.

 - Some minor optimisations:
   - Skip rendering `"\0"` and `" "` characters. These characters occur
     pretty often, especially on blank monitors and, as the font is empty
     here, it is safe to skip them.
   - Batch together adjacent background cells of the same colour. Again,
     most terminals will have large runs of the same colour, so this is a
     worthwhile optimisation.

   These optimisations do mean that terminal performance is no longer
   consistent as "noisy" terminals will have worse performance. This is
   annoying, but still worthwhile.

 - Switch monitor rendering over to use VBOs.

   We also add a config option to switch between rendering backends. By
   default we'll choose the best one compatible with your GPU, but there
   is a config option to switch between VBOS (reasonable performance) and
   display lists (bad).

When benchmarking 30 full-sized monitors rendering a static image, this
improves my FPS[^1] from 7 to 95. This is obviously an extreme case -
monitor updates are still slow, and so more frequently updating screens
will still be less than stellar.

[^1]: My graphics card is an Intel HD Graphics 520. Obviously numbers
      will vary.
2020-04-21 10:43:26 +01:00
SquidDev
7c1154ddfc Avoid shadowing of names in peripheral.isPresent
Fixes #415
2020-04-21 08:51:49 +01:00
SquidDev
df557e03fa Fix turtles incorrectly handling waterlogged blocks
This would return true for any block with a fluid in it, including
waterlogged blocks. This resulted in much broken behaviour

 - Turtles cannot place blocks when waterlogged (fixedd #385)
 - Turtles could move into waterlogged blocks (such as fences),
   replacing them.
2020-04-20 20:25:09 +01:00
SquidDev
524b6f1d8a Make a bunch of config fields private 2020-04-20 20:24:16 +01:00
SquidDev
cea8be7efa Fix terrible grammar in the README 2020-04-20 12:01:44 +01:00
SquidDev
c5f918ad95 Increase the maximum limit for websocket messages
The constructor for the websocket handshaker has a default
maxFramePayloadLength of 64kb, hence me being confused.

Closes #376
2020-04-19 21:29:39 +01:00
Jonathan Coates
b14c7842fc Add textutils.unserialiseJSON (#407)
This is relatively unoptimised right now, but should be efficient enough
for most practical applications.

 - Add textutils.json_null. This will be serialized into a literal
   `null`. When deserializing, and parse_null is true, this will be
   returned instead of a nil.

 - Add textutils.unserializeJSON (and textutils.unserializeJSON). This
   is a standard compliant JSON parser (hopefully).

 - Passing in nbt_style to textutils.unserializeJSON will handle
   stringified NBT (no quotes around object keys, numeric suffices). We
   don't currently support byte/long/int arrays - something to add in
   a future commit.
2020-04-19 15:08:46 +01:00
SquidDev
eead8b5755 A small amount of Lua documentation
I'd forgotten how tedious this was. I can't say any of these docs are
especially good, but it's something.
2020-04-18 21:42:59 +01:00
SquidDev
10a27a7a25 Add utility to check table keys
expect.field acts very similarly to expect.expect, though checks a
specific table key rather than a function argument.
2020-04-18 14:38:20 +01:00
SquidDev
865fc239a0 Reformat bracketed expressions in Lua
- Parenthesised expressions (function calls, arguments, etc...) should
   never have spaces in them.
 - Tables always will have spaces inside.
2020-04-18 10:09:40 +01:00
SquidDev
f9f94b8304 Rewrite our documentation index
We're going to flesh this out a lot in the future, but this'll have to
do for now.
2020-04-16 18:18:36 +01:00
SquidDev
cb8135a0d1 Bump Cobalt version
- Remove stub for table.pack/table.unpack.
 - Remove Lua 5.3 bitlib stub. We're not on 5.3, there's no
   point emulating it.
 - Change peripheral.call to correctly adjust the error level. This is a
   terrible hack, but I believe the only good option.

It'd be good to remove load as well, but it's a little more complex due
to our injecting of _ENV.

Closes #363
2020-04-16 10:48:26 +01:00
SquidDev
ef4b0a5632 Fix config name for enabling http API
It hasn't been http_enable for yonks - slightly worried I didn't notice
this earlier.
Also don't refer to ComputerCraft.cfg - the name has changed several
times across versions, so let's leave it ambiguous.
2020-04-13 11:00:31 +01:00
SquidDev
6a6a87489c Add a separate CONTRIBUTING.md file
Hopefully provides a /little/ more information about the build process.
Hey, also means I only need to add a CoC to complete GH's community tab!

In all seriousness, there's probably a lot more I need to flesh out
here, such as some kind of vision and guides for issues/PRs. But this at
least documents the local development process. Somewhat.
2020-04-13 10:54:57 +01:00
SquidDev
062977336a Handle missing file metadata on zip files
- Return EPOCH if a zip entry's creation/modification/access time is
   missing.
 - If a BasicFileAttributes.*Time method returns null, use 0 as our
   time. This shouldn't happen, but is a good sanity check.

Fixes #371
2020-04-10 14:43:42 +01:00
SquidDev
e52d98ad8b Make IDAssigner.getNextID synchronized
This should prevent race conditions when allocating IDs. Fixes #386.
2020-04-10 14:29:17 +01:00
Jonathan Coates
ef8da8054f An initial stab at documentation generation (#360)
This adds documentation comments to many of CC's Lua APIs, and
a couple of the Java ones, through the use of stubs. We then
export these to HTML using illuaminate [1] and upload them to our
documentation site [2].

Uploads currently occur on pushes to master and any release/tag. The
site is entirely static - there is no way to switch between versions,
etc... but hopefully we can improve this in the future.

[1]: github.com/SquidDev/illuaminate/
[2]: https://tweaked.cc/
2020-04-10 10:27:53 +01:00
E. Kim
1ccd687c00 Create ko_kr.lang (#381) 2020-04-09 22:31:20 +01:00
Christian L.W
a8ce5a5b20 Add Danish translation (#395) 2020-04-09 22:30:20 +01:00
Jonathan Coates
68e6bc464b Bump illuaminate version
For now, we just perform the minimal number of changes to get this
working. We'll switch to a more strict bracket handling system in the
future.
2020-04-09 22:15:06 +01:00
SquidDev
68762fe84c Switch FileMount to use Files.walkFileTree
This means we are already provided with file attributes, which halfs[^1]
the time taken to scan folders.

[^1]: This dropped the fastest scan time from ~1.3s to ~0.6. It's by no
means a perfect benchmark, but this is still an obvious improvement.
2020-04-09 22:06:53 +01:00
SquidDev
419f29321a Port most recipes to use generators
Closes #354
2020-02-08 23:26:05 +00:00
SquidDev
00b41d29c1 Update README to mention fg.deobf 2020-02-08 22:16:38 +00:00
Jonathan Coates
0ffd5fcf85 Add fs.getCapacity and fs.attributes (#365)
- fs.getCapacity just returns the capacity of the current drive, if
   available. This will be nil on rom mounts.
 - fs.attributes returns an lfs like table of various file attributes.
   Currently, this contains:
    - access, modification, created: When this file was last accessed,
      modified and created. Time is measured in milliseconds since the
      epoch, same as os.epoch("utc") and what is accepted by os.date.
    - size: Same as fs.getSize
    - isDir: same as fs.isDir

Closes #262
2020-02-08 21:04:58 +00:00
Jonathan Coates
95fee95006 Fix spelling of Ctrl 2020-02-08 20:26:16 +00:00
Jonathan Coates
239bd769df Cache the gradle dependency cache
This'll preserve the FG and general module cache. Note, this doesn't
include gradle wrappers, but that's normally pretty fast to download.
2020-02-08 11:19:34 +00:00
Jonathan Coates
b4e0e9984f Try to get CI working again
- Mirror all dependencies, like we've done on master
 - Run gradle build twice. Apparently the first time the dependencies
   aren't always available.
2020-02-08 11:02:09 +00:00
SquidDev
79f42e35ce Add a timeout to websocket.receive
- Move timer handling to IAPIEnvironment, rather than OSAPI. This means
   the environment is reset on startup/shutdown, much like normal APIs.
 - Websocket.receive now accepts an optional timetout (much like
   rednet.receive). This starts a timer, and waits for it to complete.

Closes #201
2020-02-07 14:50:51 +00:00
SquidDev
be89fc25f9 Prevent copying folders inside themselves
- contains now performs a case-insensitive comparison. While this is a
   little dubious, it's required for systems like Windows, where foo and
   Foo are the same folder.
 - Impose a depth limit on copyRecursive. If there are any other cases
   where we may try to copy a folder into itself, this should prevent
   the computer entirely crashing.
2020-02-07 14:17:09 +00:00
Fatboychummy
8eae02c037 Fire mouse_up events in monitor.lua (#358)
We schedule a mouse_up event 0.1 seconds after receiving a
monitor_touch event.
2020-02-04 17:00:49 +00:00
Jonathan Coates
930fd59298 Remove dvs1 as a maven repository
This thing consistently goes down and breaks the build. For now, let's
just rehost it on squiddev.cc/maven.
2020-02-04 16:53:22 +00:00
Jonathan Coates
bf13bac152 Update illuaminate config 2020-02-04 16:41:29 +00:00
SquidDev
03caf9d805 Fix a checkstyle warning 2020-01-29 16:52:37 +00:00
SquidDev
d6ea3aab1c Switch generation of resources over to data generators
See #354

 - Remove Lua script to generate recipes/advancements for coloured
   disks, turtle upgrades and pocket upgrades. Replacing them with Lua
   ones.
 - Generate most block drops via the data generator system. Aside from
   cables, they all follow one of two templates.
2020-01-29 16:41:26 +00:00
SquidDev
0de5969ec1 Lint whitespace during CI 2020-01-23 15:12:12 +00:00
magiczocker10
3f98b2785e Fix turtle texture layout (#350) 2020-01-23 15:08:11 +00:00
Jonathan Coates
798868427e Use a Wadler style pretty printer in the Lua REPL (#334)
- Add a cc.pretty module, which provides a Wadler style pretty printer [1].

 - The cc.pretty.pretty function converts an arbitrary object into a
   pretty-printed document. This can then be printed to the screen with
   cc.pretty.{write, print} or converted to a string with cc.pretty.render.

 - Convert the Lua REPL to use the pretty printer rather than
   textutils.serialise.

[1]: http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf
2020-01-17 22:51:36 +00:00
Jonathan Coates
c79f643ba7 Remove redundant illuaminate options 2020-01-17 10:18:46 +00:00
Jonathan Coates
1db3a14c54 Eta-reduce several calls to pcall 2020-01-15 09:29:11 +00:00
SquidDev
bf6d017ad1 Merge branch 'master' into mc-1.14.x 2020-01-14 08:52:59 +00:00
SquidDev
8b1773dd60 Fix peripheral.getMethods returning {}
I don't even know how this snuck past.

Closes #346
2020-01-14 08:45:08 +00:00
SquidDev
a706300598 Update changelog/version 2020-01-13 15:10:32 +00:00
SquidDev
2541c3c5e6 Licenses, again 2020-01-13 15:08:09 +00:00
SquidDev
41a1b99f7d Merge branch 'master' into mc-1.14.x 2020-01-13 15:05:50 +00:00
SquidDev
1862a439e2 Correctly offset scroll cursor positions
Fixes #330
2020-01-13 14:59:56 +00:00
SquidDev
018ecfbaa0 ▲ version 2020-01-13 13:43:38 +00:00
SquidDev
4c8fd4fc35 Allow returning collections and arrays from Java
Closes #344
2020-01-13 13:20:15 +00:00
Oliver Marks
35c1b10224 Anonymized GPS (#341)
GPS requests are now sent and received on CHANNEL_GPS by default
instead. This means it should not be possible to distinguish
computers (and thus locate them) via their GPS requests.
2020-01-08 17:07:01 +00:00
SquidDev
c1c01bef7c Fix argument index in expect call 2020-01-01 09:55:44 +00:00
SquidDev
a48c3d0ba8 A couple of io fixes
- Use expect within io.write before calling the handle's write
   function. Closes #338
 - Coerce to string in write before doing any writing. Fixes #339
2020-01-01 09:01:00 +00:00
SquidDev
93a9ebc4f6 Happy new year 2020-01-01 00:09:18 +00:00
JakobDev
7cc2bd43c6 Make builded Jar downloadable (#332) 2020-01-01 00:08:31 +00:00
Oliver Marks
393e628721 More MOTDs (#333) 2019-12-30 16:26:57 +00:00
Jonathan Coates
0bcd28e58c Fix incorrect module names 2019-12-29 19:47:52 +00:00
SquidDev
42f5389fb8 Make Lua's "exit" function a little prettier
"exit" now has a custom __tostring method, which prints an explanation
message. This is very similar to how Python achives the same
functionality:

    lua> exit
    Call exit() to exit
    lua> exit()
    > Actually leaves the REPL
2019-12-29 18:51:39 +00:00
Jacob
041cfe91b4 wilcards > wildcards (#331) 2019-12-29 06:12:55 +00:00
SquidDev
0f82a4589b Fix complaints 2019-12-24 19:31:14 +00:00
SquidDev
4320a4f851 Update CT integration
Sadly we have to disable -Werror, as the annotation class files are not
available on maven, so this produces a warning.
2019-12-24 19:16:06 +00:00
SquidDev
037cbabb32 Merge branch 'master' into mc-1.14.x
Unfortunately we can't apply the config changes due to backwards
compatibility. This'll be something we may need to PR into Forge.

CraftTweaker support still needs to be added.
2019-12-23 22:34:30 +00:00
SquidDev
0dde859582 Bump version 2019-12-23 22:10:32 +00:00
SquidDev
e59c043fb6 Fix a couple of comments to use the new config names 2019-12-23 21:34:03 +00:00
SquidDev
ae928c4397 Make http domain configuration a little clearer 2019-12-23 18:59:36 +00:00
SquidDev
da41c65128 Update proguard configuration
- Remove redundant preservation of cobalt lib constructors. We use
   lambdas now, so this is no longer needed.
 - Fix Java crypto lib not being included.
2019-12-23 18:54:19 +00:00
SquidDev
4d18234714 Use a fake network handler too
It appears that WB opens containers manually, and thus all of our stubs
network stubs are entirely ignored. Thus the only solution here is to
stub out the whole network handler code.

Thankfully this is simple enough - we do the same for Plethora and 1.14.

Fixes #328
2019-12-23 17:17:32 +00:00
JakobDev
d254c6464b Add more MOTD messages again (#241) 2019-12-23 14:43:48 +00:00
Jonathan Coates
3a5d50e572 Basic Minetweaker support (#327)
This provides the following methods:

 - dan200.computercraft.turtle.removeUpgrade(id: String)
 - dan200.computercraft.turtle.removeUpgrade(stack: IItemStack)
 - dan200.computercraft.turtle.addTool(id: String, craftItem: IItemStack[, toolItem: IItemStack][, kind: string])

While it's pretty minimal, it should allow for a reasonable amount of
functionality.

Closes #327 and #97.
2019-12-18 15:29:24 +00:00
Jonathan Coates
03b6d2f1ab Replace string.len with # 2019-12-10 18:55:11 +00:00
Jared Allard
b0397ed3c5 Add support for HTTP PATCH and TRACE (#324) 2019-12-08 17:10:58 +00:00
Jonathan Coates
fa70ebcac2 Fix spacing on all of the rom (#323) 2019-12-07 10:33:47 +00:00
SquidDev
86e0330100 Lint bios and the rom (#321)
We now use illuaminate[1]'s linting facilities to check the rom and
bios.lua for a couple of common bugs and other problems.

Right now this doesn't detect any especially important bugs, though it
has caught lots of small things (unused variables, some noisy code). In
the future, the linter will grow in scope and features, which should
allow us to be stricter and catch most issues.

As a fun aside, we started off with ~150 bugs, and illuaminate was able
to fix all but 30 of them, which is pretty neat.

[1]: https://github.com/SquidDev/illuaminate
2019-12-03 23:26:13 +00:00
SquidDev
92567b4d7e Merge branch 'master' into mc-1.14.x 2019-11-29 20:23:56 +00:00
SquidDev
0ae70fed13 Correctly implement mouse movement within read
Note to self: if you're going to modify the rom, make sure you test on a
computer which doesn't overwrite the rom with something else.
2019-11-29 20:15:58 +00:00
SquidDev
3b7300543a Correctly invalidate the ROM mount cache
Before it would remain the same across world reloads, and thus would be
out-of-date after leaving the first world. This architecture technically
allows for running multiple servers at once, though that's not going to
matter that soon.
2019-11-26 18:16:49 +00:00
SquidDev
642351af1a Merge branch 'master' into mc-1.14.x 2019-11-25 09:15:20 +00:00
SquidDev
121802a683 Bump version 2019-11-25 08:58:36 +00:00
SquidDev
08cf55e55f Correct implementation of clamp
That's what I get for inlining definitions.
2019-11-23 14:36:43 +00:00
SquidDev
3c8c0d78ef Use correct render type for turtles
This fixes them not rendering particles when broken. Particle rendering
is a little janky right now, as it uses the whole texture - we should
probably split up the texture into smaller images. Fixes #315
2019-11-23 13:24:36 +00:00
SquidDev
c4d18aa9ca Allow navigating read's input using the mouse 2019-11-23 13:21:07 +00:00
SquidDev
2d4a87adc9 Fix the eye height for turtle fake players
This was causing the eye height of the turtle to be above it when
placing down, causing all sorts of funkiness. Fixes #297
2019-11-23 13:05:26 +00:00
SquidDev
bedac71e3d Add a fake network handler to the TurtleFakePlayer
This should fix several issues (see #304, etc...). I'll try to get round
to PRing this into Forge at some point, though on the other hand this is
/super/ ugly.
2019-11-23 12:12:02 +00:00
SquidDev
ee4e42e730 Dont' remove treasure disks from JEI
This shouldn't matter either way - we don't expose it in the creative
menu, and there's no recipes for it. This should shut up a log message
though. Fixes #305.
2019-11-23 11:23:25 +00:00
SquidDev
0de75f05dd Make parameter name a bit nicer
Woops
2019-11-23 11:17:03 +00:00
SquidDev
be6dd21e54 Make monitors "properly" solid blocks
This fixes monitor rendering underwater (closes #314). By default,
isSolid returns true if the render layer is SOLID. As we use CUTOUT due
to our funky TE rendering, we need to override this to return true
anyway.

This will cause some side effects, as monitors now blocking light
propagation, but I don't think that's the end of the world.
2019-11-23 10:31:55 +00:00
SquidDev
927ddb0bde Remove Charset and MCMP integration for now
It's not clear if either of these are coming back soon, and it should be
fairly simple to add them back when needed.
2019-11-23 10:14:32 +00:00
SquidDev
a8fadabaf1 Correct spelling in error message 2019-11-23 09:59:37 +00:00
SquidDev
44d0f78c1b Bump versions 2019-11-23 09:58:54 +00:00
SquidDev
38f9a015ca Wrap all remaining uses of Grgit
This allows you to build from a zip folder of CC:T. Fixes #307. Also fix
the build, woops.
2019-10-30 17:07:29 +00:00
SquidDev
c311cdc6f5 Make our Javadoc validation a little stricter
I'm not sure there's much utility in this, but still feels worth doing.
2019-10-27 15:16:47 +00:00
SquidDev
a93e0f3284 Expose ArgumentHelper in the public API
This is sufficiently useful a class, that it's worthwhile exposing it.
Hopefully we can slowly encourage other mods to migrate to it (well, at
least in 1.14), and so make error messages more consistent.

Also:
 - Add Javadoc for all public methods
 - Clarify the method names a little (getNumber -> getDouble,
   getReal -> getFiniteDouble).
 - Make the *Table methods return a Map<?,?> instead of
   Map<Object, Object>.
2019-10-27 14:29:07 +00:00
SquidDev
14b3065ba4 Check for trailing whitespace
I'd rather assumed one of the existing checkers did this already, but
apparently not.
2019-10-16 09:22:38 +01:00
SquidDev
3ea2d6a0a8 Merge branch 'master' into mc-1.14.x 2019-10-04 19:56:49 +01:00
SquidDev
c802290437 Bump version 2019-10-04 19:52:02 +01:00
SquidDev
f7781defe5 Merge branch 'master' into mc-1.14.x 2019-10-04 19:44:34 +01:00
SquidDev
418420523a Proxy the current turtle's inventory
Previously we were just returning the current tile. However, if someone
was holding a reference to this inventory (such as a GUI), then it'd be
outdated and invalid once the turtle had moved.

This caused a couple of issues:
 - turtle_inventory events would not be fired when moving items in the
   turtle GUI.
 - As of 75e2845c01, turtles would no
   longer share their inventory state after moving. Thus, removing items
   from a GUI using an invalid inventory would move them from an old
   tile, duplicating the items.

Fixes #298, fixes #300
2019-10-04 16:53:48 +01:00
SquidDev
d342a1f368 Prevent wired modems dropping on block change
Fixes #303
2019-10-01 20:06:38 +01:00
SquidDev
81f85361d5 Move Lua files to the correct location
I really need to fix this.
2019-10-01 19:43:03 +01:00
SquidDev
f1621b30ec Remove redundant imports 2019-10-01 19:15:13 +01:00
SquidDev
d4f6a594b6 Merge branch 'master' into mc-1.14.x 2019-10-01 18:58:40 +01:00
SquidDev
ff5ba5c131 Update GUI code to be compatible with 1.14.4
Not quite sure when this changed, but I'm fairly sure isMouseOver wasn't
a thing when I wrote this. Or I'm a plonker. Both are possible.

Also fixes mouse dragging not being handled in turtles.

Fixes #299
2019-10-01 18:53:46 +01:00
SquidDev
4243f30308 Bump Forge version 2019-10-01 18:53:38 +01:00
Jonathan Coates
813e91073d Merge pull request #302 from Wendelstein7/master
Fixed turtle property category
2019-09-30 15:59:55 +01:00
Jonathan Coates
7250f22ff6 Update CI to also run on PRs 2019-09-30 15:37:52 +01:00
Wendelstein7
db31a53bba Fixed turtle property category
Likely was a leftover from copy pasting and a tired programmer.
2019-09-30 15:15:22 +02:00
SquidDev
3023f235a4 Goodbye Travis, I'm with GH Actions now 2019-09-27 08:56:53 +01:00
SquidDev
79cd8b4da5 Also return the number of affected entities
Closes #293. Doesn't really solve anything there aside from exposing the
number, but sadly there's not really anything obvious I can do on my end
- the command API just doesn't expose anything else.
2019-09-15 18:48:51 +01:00
Jonathan Coates
8e4d311cd9 Refactor shell completion into a separate module (#281)
- Adds cc.completions module, with a couple of helper functions for
   working with the more general completion functionality (i.e. that
   provided by read).
 - Adds cc.shell.completions module, which provides shell-specific
   completion functions.
 - Add a "program completion builder", which allows you to write stuff
   like this:

       shell.setCompletionFunction( "rom/programs/redstone.lua", 
         completion.build(
           { completion.choice, { "probe", "set ", "pulse " } },
           completion.side) )

Closes #232
2019-09-15 18:48:40 +01:00
SquidDev
9bd8c86a94 Change event priority to HIGHEST
See the comments in a802f25dd6 -
effectively we want to make sure we arrive before any other thing which
may capture items (some magnet mods, etc...).
2019-09-15 16:42:21 +01:00
Jonathan Coates
cbc0c1d0b6 A little experiment with GitHub actions
Let's give this a go.
2019-09-14 09:16:13 +01:00
SquidDev
49c37857d4 Window.reposition now allow changing the redirect buffer
See #270
2019-09-13 20:55:20 +01:00
SquidDev
b1139a4bf6 Bump to Forge RB 2019-09-12 21:09:57 +01:00
Jonathan Coates
7e8559278e Merge pull request #291 from parly/patch-1.14.x-1
Fix os.time() and os.day() behavior on 1.14
2019-08-19 15:34:20 +01:00
parly
1e7f1c98fc Fix os.time() and os.day() behavior 2019-08-19 23:04:57 +09:00
SquidDev
a802f25dd6 Do not listen to block/entity drop events
It appears several mods inject their own drops on the LOWEST priority,
meaning that we capture the existing drops, and the other mod will clear
the (now empty) drop list and add its own, resulting in dupe bugs.

While I'd argue it's somewhat dubious doing this on the LOWEST priority,
it's not a battle I'm prepared to fight. For now, we just remove the
block/entity drop handlers, and handle all drop logic when entities are
spawned.

Fixes #288
2019-08-19 10:33:53 +01:00
SquidDev
f1d6d21d6d Add back texture registration hook
I totally forgot to do this when Forge re-added this functionality.

Fixes #285
2019-08-18 16:12:16 +01:00
Jonathan Coates
a80302c513 Merge pull request #287 from Lignum/patch-1
The pettiest of spelling fixes
2019-08-15 06:59:59 +01:00
Lignum
1c46949da7 Available 2019-08-15 07:37:02 +02:00
SquidDev
07a56454a0 Bumpity bumpity bump 2019-08-09 09:38:30 +01:00
SquidDev
a0e72d02c8 Bump Forge version 2019-08-06 08:33:39 +01:00
SquidDev
455a59ca85 Sure, you can be an actual release now 2019-08-04 17:01:52 +01:00
SquidDev
46d78af068 Fix changelog being out-of-sync 2019-08-04 11:05:44 +01:00
SquidDev
08d22fd3df Fix changelog being out-of-sync 2019-08-04 11:05:14 +01:00
SquidDev
e6c691a8f8 Fix rom's location
This isn't going to get annoying or anything
2019-08-04 11:02:07 +01:00
SquidDev
4b0e5c445c Merge branch 'master' into mc-1.14.x 2019-08-04 10:57:20 +01:00
SquidDev
eb5cff1045 Alright, let's do this one last time 2019-08-04 09:27:48 +01:00
SquidDev
35c7792aa2 Limit the titles of printed pages
Just enforce the same restrictions as we do for computer/disk labels.
2019-08-04 08:59:44 +01:00
Jonathan Coates
521688d630 Merge pull request #183 from SquidDev-CC/feature/thread-safe-inventories 2019-08-01 14:30:32 +01:00
SquidDev
75e2845c01 Remove synchronized from turtle inventory code
These should never be called off the server thread, so this doesn't make
much difference.
2019-08-01 14:09:57 +01:00
SquidDev
2f96283286 Make disk drives thread-safe 2019-08-01 13:48:03 +01:00
SquidDev
cbe6e9b5f5 Make printers thread-safe 2019-08-01 13:48:03 +01:00
SquidDev
2ab79cf474 Version bumps 'n stuff 2019-07-30 15:48:05 +01:00
SquidDev
6ce34aba79 A quick attempt at fixing Travis
Oracle JDK 8 is EOL (I think at least).
2019-07-30 15:25:14 +01:00
SquidDev
5eeb320b60 Include all mods within a resource mount
This is the behaviour on 1.14 already, so it makes sense to backport to
1.12.

Any mod may now insert files into assets/computercraft/lua/rom, and
they'll be automatically added to the default ROM mount. This allows
other mods to easily register new programs or autorun files.

See #242
2019-07-30 15:20:08 +01:00
SquidDev
93310850d2 Use the "cc" module namespace instead of "craftos"
This is what we actually discussed in the issue, and I failed to
remember.
2019-07-27 11:34:59 +01:00
powerboat9
a2880b12ca Do not refuel beyond the turtle limit (#274) 2019-07-24 08:15:02 +01:00
SquidDev
cef2657048 Fix turtles being replaced by leaves
And logs. Well, hopefully at least.

Fixes #278
2019-07-21 10:28:22 +01:00
SquidDev
ccd85eb055 Bump Forge version 2019-07-21 09:41:58 +01:00
powerboat9
303b57779a Fix turtles harvesting blocks when they shouldn't (#276)
harvestBlock should only be called when removedByPlayer and canHarvestBlock
return true, otherwise we run the risk of causing dupe bugs.

See #273.
2019-07-17 09:23:14 +01:00
SquidDev
6279816ecc Try using the HTTP one instead 2019-07-15 08:45:22 +01:00
SquidDev
4ae77261fa Petty changes because I'm petty 2019-07-13 08:29:28 +01:00
liquid
4b7d843b78 Removed term.getLine 2019-07-13 01:45:16 -05:00
liquid
1c28df65c3 Fixed style errors 2019-07-12 23:56:49 -05:00
liquid
85b740f484 Added term.getLine and window.getLine 2019-07-12 22:54:37 -05:00
SquidDev
f9929cb27d Fix the signature of loadfile
Lua 5.2+ uses loadfile(filename, mode, env), not loadfile(filename,
env). While this is a minor incompatibility, it'd be nice to be
consistent as much as possible.

We try to handle the incorrect case too, as obviously we don't want to
break existing programs.
2019-07-12 22:04:28 +01:00
SquidDev
bafab1ac07 Expose expect as a module (#267)
This moves expect from the bios into a new craftos.expect module,
removing the internal _G["~expect"] definition. Apparently people were
using this irrespective of the "don't use this" comment, so we need to
find another solution.

While this does introduce some ugliness (having to load the module in
weird ways for programs, duplicating the expect function in memory), it
does allow people to use the function in a supported way, and removes
the global ugliness.
2019-07-09 08:04:49 +01:00
JakobDev
e05c262468 Add more tests (#253)
I'm not entirely sure how useful all of these will be yet - still
trying to work out what/when to test things, but hopefully this'll
be a useful datapoint.
2019-07-08 09:24:05 +01:00
SquidDev
acfb72246c Bump JEI version 2019-07-07 15:52:52 +01:00
SquidDev
9d51c4c340 Use world-specific collider entity
This is equally an ugly hack, but means we're at least not constructing
entities with null worlds any more.

Ideally we could always use the turtle entity, but this will require a
bit more of a refactor.

Fixes #265
2019-07-05 22:09:42 +01:00
SquidDev
18068effec Use reflection to get the record's sound
getSound is client side only - I could have sworn it became shared at
some point, but that may have been reverted again (or I imagined it).

Fixes #263
2019-07-05 21:51:54 +01:00
SquidDev
7a3f7d3bba I'm a muppet
Even worse, I enabled branch protection for some reason, and so can't
force push and pretend this never happened.
2019-06-29 15:49:14 +01:00
SquidDev
95aa48c456 Allow running expectations against stubbed functions
Co-authored-by: hydraz <urn@semi.works>
2019-06-29 15:37:41 +01:00
SquidDev
6ea8ca991b Bump Forge to 1.14.3
Guess it's time for another release?
2019-06-26 08:25:32 +01:00
SquidDev
f1e551b960 Bump Forge version
Turtle models now work (though texture registration is still broken).
2019-06-23 15:30:29 +01:00
SquidDev
772c54ec74 Copy the item stack before merging
Otherwise we would mutate the stack, and so the current mount was
considered empty. Closes #240 (though would be nice to improve this).
2019-06-21 22:00:21 +01:00
SquidDev
13cb789c18 Fix "can deploy" check being entirely incorrect
Closes #258
2019-06-21 21:51:22 +01:00
SquidDev
42220c4268 Fix several other client-only methods 2019-06-21 21:32:15 +01:00
SquidDev
3052506e2e Reload configs from the file 2019-06-21 21:32:02 +01:00
SquidDev
0741daa7eb Fix usage of a client-only method
Should probably run forge-lint on this at some point, but it's a good
start.

Fixes #255
2019-06-21 21:02:09 +01:00
SquidDev
b4aa554279 Do not fetch the current block within onLoad
The chunk has not been fully loaded when onLoad is called, which means
we try to load it again, and so the server deadlocks.
2019-06-21 20:57:38 +01:00
SquidDev
8fe2abe0ae Forward tab key directly to the terminal
Fixes #256
2019-06-21 20:31:28 +01:00
SquidDev
5af789ae11 Bump Forge version 2019-06-21 20:31:17 +01:00
SquidDev
904a168d5c Fix incorrect explosion check
We should block explosions if the turtle is advanced /or/ if it's from
a fireball or entity, not if both.

Fixes #257
2019-06-21 18:53:28 +01:00
JakobDev
724441eddc Change URLs in build.gradle to https (#259) 2019-06-21 16:51:55 +01:00
SquidDev
f68ab3edd1 Minor tweaks to build script
Mostly just rearranging. Bump JUnit version in an attempt to fix test
outputs, but it appears this is a mix of gradle/gradle#5975 and
gradle/gradle#4438.
2019-06-15 11:05:45 +01:00
SquidDev
68542aca3a Fix cable breaking rendering
Texture locations have changed a little
2019-06-15 09:19:41 +01:00
SquidDev
594bc4203c Fix block drops for computers and turtles 2019-06-15 09:07:31 +01:00
SquidDev
57318b022d Merge branch 'master' into mc-1.14.x 2019-06-15 08:00:20 +01:00
SquidDev
761159aa93 Bump Forge version 2019-06-15 07:40:27 +01:00
SquidDev
29dce26bf6 Clean up checkstyle warning
Fixes #251, closes #252
2019-06-14 20:55:32 +01:00
JakobDev
717ab69093 Add a few Checks (#248)
- Add some basic tests for several built-in programs.
 - Preserve the state of the shell between tests
2019-06-14 08:15:12 +01:00
SquidDev
138a2cf08f Merge branches 'copycheck' and 'renamefix' 2019-06-13 08:03:35 +01:00
JakobDev
81daf82647 Add Checks to copy.lua 2019-06-13 08:03:01 +01:00
JakobDev
f3798bfb63 Improve rename.lua's argument validation 2019-06-13 08:00:06 +01:00
SquidDev
bc07dfad2e Make sure all writeDescription methods are pure
We don't want to be firing block updates or anything from here! That
runs the ricks of causing CMEs and the like.

Fixes #245
2019-06-12 21:03:11 +01:00
SquidDev
8dd1c2a6cc Finish off containers, somewhat fix block drops
- Add Forge's "name" field to the loot tables. This doesn't resolve all
   our missing loot providers, but it's a start.
 - Add back GUIs for pocket computers, printouts, view computer, etc...
2019-06-12 08:40:20 +01:00
SquidDev
d10b657a54 Initial work on GUIs
Needs a bit of a cleanup, but it's a start!
2019-06-11 21:03:40 +01:00
SquidDev
f90da739eb And bump Forge again 2019-06-09 10:15:53 +01:00
SquidDev
d9cadf64e8 Get the build working I guess? 2019-06-09 09:07:31 +01:00
SquidDev
15d4a55cd8 Bump mappings and Forge versions
Things are shaping up nicely!
2019-06-09 08:58:49 +01:00
JakobDev
309cbdb8be Add wget run (#218)
Equivalent to `pastebin run`, but allows running arbitrary URLs
instead.

Is this a little questionable? Yes - people shouldn't be downloading
and running code from the internet. But hey, people do that already,
so we might as well make it convenient.
2019-06-08 14:49:42 +01:00
SquidDev
39a9ad0ce7 Initial update to 1.14
So very little works, but it compiles and runs.

Things to resolve over the next few days:
 - Horrible mappings (should largely be resolved by tomorrow).
 - Cannot send extra data over containers - we'll have to see what Forge
   does here.
 - Turtle models are broken
 - No block drops yet - this will largely be cherry-picking whatever I
   did on Fabric.
 - Weird inventory desyncs (items don't show up initially when
   interacting with a CC inventory).
 - Probably lots of other things.
2019-06-08 13:36:31 +01:00
SquidDev
0f3c44c926 Merge branch 'master' into mc-1.13.x 2019-06-08 08:21:08 +01:00
SquidDev
a0e7c4a74c Add a little bit of source code checking to Gradle
- Adds a CheckStyle configuration which is pretty similar to CC's
   existing one.
 - Add the Gradle license plugin.
 - Ensure the existing source code is compatible with these additional
   checks.

See #239
2019-06-08 00:28:03 +01:00
Lignum
7d428030df Fix some warnings (#235)
Remove some unused code and fix a bunch of warnings
2019-06-07 14:35:17 +01:00
JakobDev
00c395f689 Add Check to delete.lua (#236) 2019-06-06 16:43:48 +01:00
SquidDev
d8e1c73d26 Ensure files cannot be closed multiple times
Also fix an NPE if we try to close them twice.

Fixes #230
2019-06-04 21:34:19 +01:00
SquidDev
ffa4cc241b Add a test utility for capturing program output
- Make mcfly's stubbing system a little more fault-tolerant.
 - Add a small utility function which redirects print, printError and
   write to capture their output, rather than printing to the terminal.
   This can then be matched against in order to determine a program's
   output.
   It's a little flakey - you can't use it multiple times in an it
   block, etc... but it's a nice feature.
 - Add a small couple of tests to delete as a proof-of-concept.
2019-06-03 20:33:09 +01:00
SquidDev
6f1b740c8f Un-localise paths in mount error messages
This is probably a little more complex than it needs to be, as we try to
handle the mounts as well (which generally don't error).

Fixes #229
2019-06-03 19:58:16 +01:00
SquidDev
3406ba3ebf Fix a build from a clean state failing 2019-06-02 18:48:36 +01:00
1248 changed files with 24816 additions and 13118 deletions

View File

@@ -11,5 +11,12 @@ insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[*.sexp]
indent_size = 2
[*.yml]
indent_size = 2
[*.properties]
insert_final_newline = false

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Ignore changes in generated files
src/generated/resources/data/** linguist-generated

53
.github/workflows/main-ci.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Build
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache gradle dependencies
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew build --no-daemon || ./gradlew build --no-daemon
- name: Upload Jar
uses: actions/upload-artifact@v1
with:
name: CC-Tweaked
path: build/libs
- name: Upload Coverage
run: bash <(curl -s https://codecov.io/bash)
lint-lua:
name: Lint Lua
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Lint Lua code
run: |
test -d bin || mkdir bin
test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/linux-x86-64/illuaminate
chmod +x bin/illuaminate
bin/illuaminate lint
- name: Check whitespace
run: python3 tools/check-lines.py

16
.github/workflows/make-doc.sh vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eu
DEST="${GITHUB_REF#refs/*/}"
echo "Uploading docs to https://tweaked.cc/$DEST"
# Setup ssh key
mkdir -p "$HOME/.ssh/"
echo "$SSH_KEY" > "$HOME/.ssh/key"
chmod 600 "$HOME/.ssh/key"
# And upload
rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \
"$GITHUB_WORKSPACE/doc/" \
"$SSH_USER@$SSH_HOST:/var/www/tweaked.cc/$DEST"

31
.github/workflows/make-doc.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: Build documentation
on:
push:
branches: [ master ]
tags:
release:
types: [ published ]
jobs:
make_doc:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build documentation
run: |
test -d bin || mkdir bin
test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/linux-x86-64/illuaminate
chmod +x bin/illuaminate
bin/illuaminate doc-gen
- name: Upload documentation
run: .github/workflows/make-doc.sh 2> /dev/null
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}

10
.gitignore vendored
View File

@@ -3,6 +3,8 @@
/logs
/build
/out
/doc/**/*.html
/doc/index.json
# Runtime directories
/run
@@ -15,3 +17,11 @@
.idea
.gradle
*.DS_Store
.classpath
.project
.settings/
bin/
*.launch
/src/generated/resources/.cache

View File

@@ -1,34 +0,0 @@
std = "max"
ignore = {
-- Allow access to undefined globals or their fields. In the future we'll
-- define all of CC's globals within this file
'113', '143',
-- FIXME: Ignore unused arguments and loop variables
'212', '213',
-- Disable line is too long for now. It would be possible to clean
-- this up in the future.
'631',
}
-- Only run the linter on ROM and bios for now, as the treasure disks
-- are largely unsupported.
include_files = {
'src/main/resources/assets/computercraft/lua/rom',
'src/main/resources/assets/computercraft/lua/bios.lua'
}
files['src/main/resources/assets/computercraft/lua/bios.lua'] = {
-- Allow declaring and mutating globals
allow_defined_top = true,
ignore = { '112', '121', '122', '131', '142' },
}
files['src/main/resources/assets/computercraft/lua/rom/apis'] = {
-- APIs may define globals on the top level. We'll ignore unused globals,
-- as obviously they may be used outside that API.
allow_defined_top = true,
ignore = { '131' },
}

View File

@@ -1,14 +0,0 @@
language: java
script: ./gradlew build --no-daemon
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/s
jdk:
- oraclejdk8

36
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,36 @@
# Contributing to CC: Tweaked
As with many open source projects, CC: Tweaked thrives on contributions from other people! This document (hopefully)
provides an introduction as to how to get started in helping out.
If you've any other questions, [just ask the community][community] or [open an issue][new-issue].
## Reporting issues
If you have a bug, suggestion, or other feedback, the best thing to do is [file an issue][new-issue]. When doing so,
do use the issue templates - they provide a useful hint on what information to provide.
## Developing
In order to develop CC: Tweaked, you'll need to download the source code and then run it. This is a pretty simple
process.
- **Clone the repository:** `git clone https://github.com/SquidDev-CC/CC-Tweaked.git && cd CC-Tweaked`
- **Setup Forge:** `./gradlew build`
- **Run Minecraft:** `./gradlew runClient` (or run the `GradleStart` class from your IDE).
If you want to run CC:T in a normal Minecraft instance, run `./gradlew build` and copy the `.jar` from `build/libs`.
These commands may take a few minutes to run the first time, as the environment is set up, but should be much faster
afterwards.
### Code linters
CC: Tweaked uses a couple of "linters" on its source code, to enforce a consistent style across the project. While these
are run whenever you submit a PR, it's often useful to run this before committing.
- **[Checkstyle]:** Checks Java code to ensure it is consistently formatted. This can be run with `./gradlew build` or
`./gradle check`.
- **[illuaminate]:** Checks Lua code for semantic and styleistic issues. See [the usage section][illuaminate-usage] for
how to download and run it.
[new-issue]: https://github.com/SquidDev-CC/CC-Tweaked/issues/new/choose "Create a new issue"
[community]: README.md#Community "Get in touch with the community."
[checkstyle]: https://checkstyle.org/
[illuaminate]: https://github.com/SquidDev/illuaminate/
[illuaminate-usage]: https://github.com/SquidDev/illuaminate/blob/master/README.md#usage

View File

@@ -1,5 +1,5 @@
# ![CC: Tweaked](logo.png)
[![Current build status](https://travis-ci.org/SquidDev-CC/CC-Tweaked.svg?branch=master)](https://travis-ci.org/SquidDev-CC/CC-Tweaked "Current build status") [![Download CC: Tweaked on CurseForge](https://cf.way2muchnoise.eu/title/cc-tweaked.svg)](https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked on CurseForge")
[![Current build status](https://github.com/SquidDev-CC/CC-Tweaked/workflows/Build/badge.svg)](https://github.com/SquidDev-CC/CC-Tweaked/actions "Current build status") [![Download CC: Tweaked on CurseForge](http://cf.way2muchnoise.eu/title/cc-tweaked.svg)](https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked on CurseForge")
CC: Tweaked is a fork of [ComputerCraft](https://github.com/dan200/ComputerCraft), adding programmable computers,
turtles and more to Minecraft.
@@ -37,20 +37,14 @@ several features have been included, such as full block modems, the Cobalt runti
computers.
## Contributing
Any contribution is welcome, be that using the mod, reporting bugs or contributing code. In order to start helping
develop CC:T, you'll need to follow these steps:
- **Clone the repository:** `git clone https://github.com/SquidDev-CC/CC-Tweaked.git && cd CC-Tweaked`
- **Setup Forge:** `./gradlew setupDecompWorkspace`
- **Test your changes:** `./gradlew runClient` (or run the `GradleStart` class from your IDE).
If you want to run CC:T in a normal Minecraft instance, run `./gradlew build` and copy the `.jar` from `build/libs`.
Any contribution is welcome, be that using the mod, reporting bugs or contributing code. If you want to get started
developing the mod, [check out the instructions here](CONTRIBUTING.md#developing).
## Community
If you need help getting started with CC: Tweaked, want to show off your latest project, or just want to chat about
ComputerCraft we have a [forum](https://forums.computercraft.cc/) and [Discord guild](https://discord.gg/H2UyJXe)!
There's also a fairly populated, albeit quiet [IRC channel](http://webchat.esper.net/?channels=#computercraft), if
that's more your cup of tea.
ComputerCraft we have a [forum](https://forums.computercraft.cc/) and [Discord guild](https://discord.computercraft.cc)!
There's also a fairly populated, albeit quiet [IRC channel](http://webchat.esper.net/?channels=computercraft), if that's
more your cup of tea.
I'd generally recommend you don't contact me directly (email, DM, etc...) unless absolutely necessary (i.e. in order to
report exploits). You'll get a far quicker response if you ask the whole community!
@@ -66,7 +60,7 @@ dependencies {
}
dependencies {
implementation "org.squiddev:cc-tweaked-${mc_version}:${cct_version}"
implementation fg.deobf("org.squiddev:cc-tweaked-${mc_version}:${cct_version}")
}
```

View File

@@ -4,19 +4,22 @@ buildscript {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
url = "https://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'com.google.code.gson:gson:2.8.1'
classpath 'net.minecraftforge.gradle:ForgeGradle:3.0.117'
classpath 'net.minecraftforge.gradle:ForgeGradle:3.0.154'
classpath 'net.sf.proguard:proguard-gradle:6.1.0beta2'
classpath 'org.ajoberstar.grgit:grgit-gradle:3.0.0'
}
}
plugins {
id 'com.matthewprenger.cursegradle' version '1.2.0'
id "checkstyle"
id "jacoco"
id "com.github.hierynomus.license" version "0.15.0"
id "com.matthewprenger.cursegradle" version "1.3.0"
id "com.github.breadmoirai.github-release" version "2.2.4"
}
@@ -46,7 +49,7 @@ minecraft {
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
@@ -55,6 +58,19 @@ minecraft {
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', 'computercraft', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
computercraft {
source sourceSets.main
}
}
}
}
mappings channel: 'snapshot', version: "${mappings_version}".toString()
@@ -62,23 +78,15 @@ minecraft {
accessTransformer file('src/main/resources/META-INF/accesstransformer.cfg')
}
sourceSets.main.resources {
srcDir 'src/generated/resources'
}
repositories {
maven {
name "JEI"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name "SquidDev"
url "https://squiddev.cc/maven"
}
ivy {
name "Charset"
artifactPattern "https://asie.pl/files/mods/Charset/LibOnly/[module]-[revision](-[classifier]).[ext]"
}
maven {
name "Amadornes"
url "http://maven.amadornes.com/"
}
}
configurations {
@@ -88,30 +96,24 @@ configurations {
}
dependencies {
checkstyle "com.puppycrawl.tools:checkstyle:8.25"
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
compileOnly fg.deobf("mezz.jei:jei-1.13.2:5.0.0.20:api")
// deobfProvided "pl.asie:Charset-Lib:0.5.4.6"
// deobfProvided "MCMultiPart2:MCMultiPart:2.5.3"
compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.27:api")
compileOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.14.4:5.0.1.162")
runtimeOnly fg.deobf("mezz.jei:jei-1.13.2:5.0.0.20")
runtimeOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.27")
shade 'org.squiddev:Cobalt:0.5.0-SNAPSHOT'
shade 'org.squiddev:Cobalt:0.5.1-SNAPSHOT'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
deployerJars "org.apache.maven.wagon:wagon-ssh:3.0.0"
}
sourceSets {
main {
java {
exclude 'dan200/computercraft/shared/integration/mcmp'
exclude 'dan200/computercraft/shared/integration/charset'
}
}
}
// Compile tasks
javadoc {
include "dan200/computercraft/api/**/*.java"
@@ -123,7 +125,7 @@ jar {
manifest {
attributes(["Specification-Title": "computercraft",
"Specification-Vendor": "SquidDev",
"Specification-Version": "25.0",
"Specification-Version": "1",
"Implementation-Title": "CC: Tweaked",
"Implementation-Version": "${mod_version}",
"Implementation-Vendor" :"SquidDev",
@@ -137,12 +139,22 @@ jar {
from configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }
}
[compileJava, compileTestJava].forEach {
it.configure {
options.compilerArgs << "-Xlint" << "-Xlint:-processing"
}
}
import java.nio.charset.StandardCharsets
import java.nio.file.*
import java.util.zip.*
import com.google.gson.GsonBuilder
import com.google.gson.JsonElement
import com.hierynomus.gradle.license.tasks.LicenseCheck
import com.hierynomus.gradle.license.tasks.LicenseFormat
import org.ajoberstar.grgit.Grgit
import proguard.gradle.ProGuardTask
@@ -155,6 +167,7 @@ task proguard(type: ProGuardTask, dependsOn: jar) {
// Add the main runtime jar and all non-shadowed dependencies
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
libraryjars "${System.getProperty('java.home')}/lib/jce.jar"
doFirst {
sourceSets.main.compileClasspath
.filter { !it.name.contains("Cobalt") }
@@ -170,9 +183,6 @@ task proguard(type: ProGuardTask, dependsOn: jar) {
// Preserve ComputerCraft classes - we only want to strip shadowed files.
keep 'class dan200.computercraft.** { *; }'
// Preserve the constructors in Cobalt library class, as we init them via reflection
keepclassmembers 'class org.squiddev.cobalt.lib.** { <init>(...); }'
// LWJGL and Apache bundle Java 9 versions, which is great, but rather breaks Proguard
dontwarn 'module-info'
dontwarn 'org.apache.**,org.lwjgl.**'
@@ -242,6 +252,7 @@ task compressJson(dependsOn: jar) {
// Copy over all files in the current jar to the new one, running json files from GSON. As pretty printing
// is turned off, they should be minified.
new ZipFile(jarPath).withCloseable { inJar ->
tempPath.getParentFile().mkdirs()
new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(tempPath))).withCloseable { outJar ->
inJar.entries().each { entry ->
if(entry.directory) {
@@ -269,6 +280,65 @@ task compressJson(dependsOn: jar) {
assemble.dependsOn compressJson
// Check tasks
test {
useJUnitPlatform()
testLogging {
events "skipped", "failed"
}
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
}
}
check.dependsOn jacocoTestReport
license {
mapping("java", "SLASHSTAR_STYLE")
strictCheck true
ext.year = Calendar.getInstance().get(Calendar.YEAR)
}
[licenseMain, licenseFormatMain].forEach {
it.configure {
include("**/*.java")
exclude("dan200/computercraft/api/**")
header rootProject.file('config/license/main.txt')
}
}
[licenseTest, licenseFormatTest].forEach {
it.configure {
include("**/*.java")
header rootProject.file('config/license/main.txt')
}
}
gradle.projectsEvaluated {
tasks.withType(LicenseFormat) {
outputs.upToDateWhen { false }
}
}
task licenseAPI(type: LicenseCheck);
task licenseFormatAPI(type: LicenseFormat);
[licenseAPI, licenseFormatAPI].forEach {
it.configure {
source = sourceSets.main.java
include("dan200/computercraft/api/**")
header rootProject.file('config/license/api.txt')
}
}
// Upload tasks
task checkRelease {
group "upload"
description "Verifies that everything is ready for a release"
@@ -307,7 +377,7 @@ task checkRelease {
if (!ok) throw new IllegalStateException("Could not check release")
}
}
check.dependsOn checkRelease
curseforge {
apiKey = project.hasProperty('curseForgeApiKey') ? project.curseForgeApiKey : ''
@@ -379,7 +449,9 @@ githubRelease {
token project.hasProperty('githubApiKey') ? project.githubApiKey : ''
owner 'SquidDev-CC'
repo 'CC-Tweaked'
targetCommitish { Grgit.open(dir: '.').branch.current().name }
try {
targetCommitish = Grgit.open(dir: '.').branch.current().name
} catch(Exception ignored) { }
tagName "v${mc_version}-${mod_version}"
releaseName "[${mc_version}] ${mod_version}"
@@ -399,19 +471,3 @@ task uploadAll(dependsOn: uploadTasks) {
group "upload"
description "Uploads to all repositories (Maven, Curse, GitHub release)"
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
gradle.projectsEvaluated {
reobfJar.dependsOn proguardMove
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint" << "-Xlint:-processing" // Causes Forge build to fail << "-Werror"
}
}

View File

@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="tabWidth" value="4"/>
<property name="charset" value="UTF-8" />
<module name="SuppressionFilter">
<property name="file" value="config/checkstyle/suppressions.xml" />
</module>
<module name="TreeWalker">
<!-- Annotations -->
<module name="AnnotationLocation" />
<module name="AnnotationUseStyle" />
<module name="MissingDeprecated" />
<module name="MissingOverride" />
<!-- Blocks -->
<module name="EmptyBlock" />
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="ignored" />
</module>
<module name="LeftCurly">
<property name="option" value="nl" />
<!-- The defaults, minus lambdas. -->
<property name="tokens" value="ANNOTATION_DEF,CLASS_DEF,CTOR_DEF,ENUM_CONSTANT_DEF,ENUM_DEF,INTERFACE_DEF,LITERAL_CASE,LITERAL_CATCH,LITERAL_DEFAULT,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,METHOD_DEF,OBJBLOCK,STATIC_INIT" />
</module>
<module name="NeedBraces">
<property name="allowSingleLineStatement" value="true"/>
</module>
<module name="RightCurly">
<property name="option" value="alone" />
</module>
<!-- Class design. As if we've ever followed good practice here. -->
<module name="FinalClass" />
<module name="InterfaceIsType" />
<module name="MutableException" />
<module name="OneTopLevelClass" />
<!-- Coding -->
<module name="ArrayTrailingComma" />
<module name="EqualsHashCode" />
<!-- FallThrough does not handle unreachable code well -->
<module name="IllegalInstantiation" />
<module name="IllegalThrows" />
<module name="ModifiedControlVariable" />
<module name="NoClone" />
<module name="NoFinalizer" />
<module name="OneStatementPerLine" />
<module name="PackageDeclaration" />
<module name="SimplifyBooleanExpression" />
<module name="SimplifyBooleanReturn" />
<module name="StringLiteralEquality" />
<module name="UnnecessaryParentheses" />
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration" />
<module name="UnnecessarySemicolonInTryWithResources" />
<module name="UnnecessarySemicolonInEnumeration" />
<!-- Imports -->
<module name="CustomImportOrder" />
<module name="IllegalImport" />
<module name="RedundantImport" />
<module name="UnusedImports" />
<!-- Javadoc -->
<!-- TODO: Missing* checks for the dan200.computercraft.api package? -->
<module name="AtclauseOrder" />
<module name="InvalidJavadocPosition" />
<module name="JavadocBlockTagLocation" />
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocStyle" />
<module name="NonEmptyAtclauseDescription" />
<module name="SingleLineJavadoc" />
<module name="SummaryJavadocCheck"/>
<!-- Misc -->
<module name="ArrayTypeStyle" />
<module name="CommentsIndentation" />
<module name="Indentation" />
<module name="OuterTypeFilename" />
<!-- Modifiers -->
<module name="ModifierOrder" />
<module name="RedundantModifier" />
<!-- Naming -->
<module name="ClassTypeParameterName" />
<module name="InterfaceTypeParameterName" />
<module name="LambdaParameterName" />
<module name="LocalFinalVariableName" />
<module name="LocalVariableName" />
<!-- Allow an optional m_ on private members -->
<module name="MemberName">
<property name="applyToPrivate" value="false" />
<property name="applyToPackage" value="false" />
</module>
<module name="MemberName">
<property name="format" value="^(m_)?[a-z][a-zA-Z0-9]*$" />
<property name="applyToPrivate" value="true" />
<property name="applyToPackage" value="true" />
</module>
<module name="MethodName" />
<module name="MethodTypeParameterName" />
<module name="PackageName">
<property name="format" value="^dan200\.computercraf(\.[a-z][a-z0-9]*)*" />
</module>
<module name="ParameterName" />
<module name="StaticVariableName">
<property name="format" value="^[a-z][a-zA-Z0-9]*|CAPABILITY(_[A-Z]+)?$" />
<property name="applyToPrivate" value="false" />
</module>
<module name="StaticVariableName">
<property name="format" value="^(s_)?[a-z][a-zA-Z0-9]*|CAPABILITY(_[A-Z]+)?$" />
<property name="applyToPrivate" value="true" />
</module>
<module name="TypeName" />
<!-- Whitespace -->
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad">
<property name="option" value="space"/>
</module>
<module name="GenericWhitespace" />
<module name="MethodParamPad" />
<module name="NoLineWrap" />
<module name="NoWhitespaceAfter">
<property name="tokens" value="AT,INC,DEC,UNARY_MINUS,UNARY_PLUS,BNOT,LNOT,DOT,ARRAY_DECLARATOR,INDEX_OP" />
</module>
<module name="NoWhitespaceBefore" />
<!-- TODO: Decide on an OperatorWrap style. -->
<module name="ParenPad">
<property name="option" value="space" />
<property name="tokens" value="ANNOTATION,ANNOTATION_FIELD_DEF,CTOR_CALL,CTOR_DEF,ENUM_CONSTANT_DEF,LITERAL_CATCH,LITERAL_DO,LITERAL_FOR,LITERAL_IF,LITERAL_NEW,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_WHILE,METHOD_CALL,METHOD_DEF,RESOURCE_SPECIFICATION,SUPER_CTOR_CALL,LAMBDA" />
</module>
<module name="ParenPad">
<property name="option" value="nospace" />
<property name="tokens" value="DOT,EXPR,QUESTION" />
</module>
<module name="SeparatorWrap">
<property name="option" value="eol" />
<property name="tokens" value="COMMA,SEMI,ELLIPSIS,ARRAY_DECLARATOR,RBRACK,METHOD_REF" />
</module>
<module name="SeparatorWrap">
<property name="option" value="nl" />
<property name="tokens" value="DOT,AT" />
</module>
<module name="SingleSpaceSeparator" />
<module name="TypecastParenPad" />
<module name="WhitespaceAfter">
<property name="tokens" value="COMMA" />
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true" />
<property name="ignoreEnhancedForColon" value="false" />
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAMBDA,LAND,LCURLY,LE,LITERAL_RETURN,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND" />
</module>
</module>
<module name="FileTabCharacter" />
<module name="NewlineAtEndOfFile" />
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Trailing whitespace"/>
</module>
</module>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<!-- All the config options and method fields. -->
<suppress checks="StaticVariableName" files=".*[\\/]ComputerCraft.java" />
<suppress checks="StaticVariableName" files=".*[\\/]ComputerCraftAPI.java" />
<!-- Do not check for missing package Javadoc. -->
<suppress checks="JavadocStyle" files=".*[\\/]package-info.java" />
</suppressions>

3
config/license/api.txt Normal file
View File

@@ -0,0 +1,3 @@
This file is part of the public ComputerCraft API - http://www.computercraft.info
Copyright Daniel Ratcliffe, 2011-${year}. This API may be redistributed unmodified and in full only.
For help using the API, and posting your mods, visit the forums at computercraft.info.

3
config/license/main.txt Normal file
View File

@@ -0,0 +1,3 @@
This file is part of ComputerCraft - http://www.computercraft.info
Copyright Daniel Ratcliffe, 2011-${year}. Do not distribute without permission.
Send enquiries to dratcliffe@gmail.com

11
doc/index.md Normal file
View File

@@ -0,0 +1,11 @@
# ![CC: Tweaked](logo.png) [![Download CC: Tweaked on CurseForge](https://cf.way2muchnoise.eu/title/cc-tweaked.svg)](https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked on CurseForge")
CC: Tweaked is a fork of [ComputerCraft], adding programmable computers, turtles and more to Minecraft.
This website contains documentation for all Lua libraries and APIs from the latest version of CC: Tweaked. This
documentation is still in development, so will most likely be incomplete. If you've found something you think is wrong,
or would like to help out [please get in touch on GitHub][gh].
[bug]: https://github.com/SquidDev-CC/CC-Tweaked/issues/new/choose
[computercraft]: https://github.com/dan200/ComputerCraft "ComputerCraft on GitHub"
[gh]: https://github.com/SquidDev-CC/CC-Tweaked "CC:Tweaked on GitHub"

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

77
doc/stub/commands.lua Normal file
View File

@@ -0,0 +1,77 @@
--- Execute a specific command.
--
-- @tparam string command The command to execute.
-- @treturn boolean Whether the command executed successfully.
-- @treturn { string... } The output of this command, as a list of lines.
-- @treturn number|nil The number of "affected" objects, or `nil` if the command
-- failed. The definition of this varies from command to command.
-- @usage Set the block above the command computer to stone.
--
-- commands.exec("setblock ~ ~1 ~ minecraft:stone")
function exec(command) end
--- Asynchronously execute a command.
--
-- Unlike @{exec}, this will immediately return, instead of waiting for the
-- command to execute. This allows you to run multiple commands at the same
-- time.
--
-- When this command has finished executing, it will queue a `task_complete`
-- event containing the result of executing this command (what @{exec} would
-- return).
--
-- @tparam string command The command to execute.
-- @treturn number The "task id". When this command has been executed, it will
-- queue a `task_complete` event with a matching id.
-- @usage Asynchronously sets the block above the computer to stone.
--
-- commands.execAsync("~ ~1 ~ minecraft:stone")
-- @see parallel One may also use the parallel API to run multiple commands at
-- once.
function execAsync(commad) end
--- List all available commands which the computer has permission to execute.
--
-- @treturn { string... } A list of all available commands
function list() end
--- Get the position of the current command computer.
--
-- @treturn number This computer's x position.
-- @treturn number This computer's y position.
-- @treturn number This computer's z position.
-- @see gps.locate To get the position of a non-command computer.
function getBlockPosition() end
--- Get some basic information about a block.
--
-- The returned table contains the current name, metadata and block state (as
-- with @{turtle.inspect}). If there is a tile entity for that block, its NBT
-- will also be returned.
--
-- @tparam number x The x position of the block to query.
-- @tparam number y The y position of the block to query.
-- @tparam number z The z position of the block to query.
-- @treturn table The given block's information.
-- @throws If the coordinates are not within the world, or are not currently
-- loaded.
function getBlockInfo(x, y, z) end
--- Get information about a range of blocks.
--
-- This returns the same information as @{getBlockInfo}, just for multiple
-- blocks at once.
--
-- Blocks are traversed by ascending y level, followed by z and x - the returned
-- table may be indexed using `x + z*width + y*depth*depth`.
--
-- @tparam number min_x The start x coordinate of the range to query.
-- @tparam number min_y The start y coordinate of the range to query.
-- @tparam number min_z The start z coordinate of the range to query.
-- @tparam number max_x The end x coordinate of the range to query.
-- @tparam number max_y The end y coordinate of the range to query.
-- @tparam number max_z The end z coordinate of the range to query.
-- @treturn { table... } A list of information about each block.
-- @throws If the coordinates are not within the world.
-- @throws If trying to get information about more than 4096 blocks.
function getBlockInfos(min_x, min_y, min_z, max_x, max_y, max_z) end

84
doc/stub/fs.lua Normal file
View File

@@ -0,0 +1,84 @@
--- The FS API allows you to manipulate files and the filesystem.
--
-- @module fs
function list(path) end
function combine(base, child) end
function getName(path) end
function getSize(path) end
function exists(path) end
function isDir(path) end
function isReadOnly(path) end
function makeDir(path) end
function move(from, to) end
function copy(from, to) end
function delete(path) end
function open(path, mode) end
function getDrive(path) end
function getFreeSpace(path) end
function find(pattern) end
function getDir(path) end
--- Returns true if a path is mounted to the parent filesystem.
--
-- The root filesystem "/" is considered a mount, along with disk folders and
-- the rom folder. Other programs (such as network shares) can exstend this to
-- make other mount types by correctly assigning their return value for getDrive.
--
-- @tparam string path The path to check.
-- @treturn boolean If the path is mounted, rather than a normal file/folder.
-- @throws If the path does not exist.
-- @see getDrive
function isDriveRoot(path) end
--- Get the capacity of the drive at the given path.
--
-- This may be used in conjunction with @{getFreeSpace} to determine what
-- percentage of this drive has been used.
--
-- @tparam string path The path of the drive to get.
-- @treturn number This drive's capacity. This will be 0 for "read-only" drives,
-- such as the ROM or treasure disks.
function getCapacity(path) end
--- Get attributes about a specific file or folder.
--
-- The returned attributes table contains information about the size of the
-- file, whether it is a directory, and when it was created and last modified.
--
-- The creation and modification times are given as the number of milliseconds
-- since the UNIX epoch. This may be given to @{os.date} in order to convert it
-- to more usable form.
--
-- @tparam string path The path to get attributes for.
-- @treturn { size = number, isDir = boolean, created = number, modified = number }
-- The resulting attributes.
-- @throws If the path does not exist.
-- @see getSize If you only care about the file's size.
-- @see isDir If you only care whether a path is a directory or not.
function attributes(path) end
-- Defined in bios.lua
function complete(sPath, sLocation, bIncludeFiles, bIncludeDirs) end
--- A file handle which can be read from.
--
-- @type ReadHandle
-- @see fs.open
local ReadHandle = {}
function ReadHandle.read(count) end
function ReadHandle.readAll() end
function ReadHandle.readLine(with_trailing) end
function ReadHandle.seek(whence, offset) end
function ReadHandle.close() end
--- A file handle which can be written to.
--
-- @type WriteHandle
-- @see fs.open
local WriteHandle = {}
function WriteHandle.write(text) end
function WriteHandle.writeLine(text) end
function WriteHandle.flush(text) end
function WriteHandle.seek(whence, offset) end
function WriteHandle.close() end

229
doc/stub/http.lua Normal file
View File

@@ -0,0 +1,229 @@
--- The http library allows communicating with web servers, sending and
-- receiving data from them.
--
-- #### `http_check` event
--
-- @module http
--- Asynchronously make a HTTP request to the given url.
--
-- This returns immediately, a [`http_success`](#http-success-event) or
-- [`http_failure`](#http-failure-event) will be queued once the request has
-- completed.
--
-- @tparam string url The url to request
-- @tparam[opt] string body An optional string containing the body of the
-- request. If specified, a `POST` request will be made instead.
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of this request.
-- @tparam[opt] boolean binary Whether to make a binary HTTP request. If true,
-- the body will not be UTF-8 encoded, and the received response will not be
-- decoded.
--
-- @tparam[2] {
-- url = string, body? = string, headers? = { [string] = string },
-- binary? = boolean, method? = string, redirect? = boolean,
-- } request Options for the request.
--
-- This table form is an expanded version of the previous syntax. All arguments
-- from above are passed in as fields instead (for instance,
-- `http.request("https://example.com")` becomes `http.request { url =
-- "https://example.com" }`).
--
-- This table also accepts several additional options:
--
-- - `method`: Which HTTP method to use, for instance `"PATCH"` or `"DELETE"`.
-- - `redirect`: Whether to follow HTTP redirects. Defaults to true.
--
-- @see http.get For a synchronous way to make GET requests.
-- @see http.post For a synchronous way to make POST requests.
function request(...) end
--- Make a HTTP GET request to the given url.
--
-- @tparam string url The url to request
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of this request.
-- @tparam[opt] boolean binary Whether to make a binary HTTP request. If true,
-- the body will not be UTF-8 encoded, and the received response will not be
-- decoded.
--
-- @tparam[2] {
-- url = string, headers? = { [string] = string },
-- binary? = boolean, method? = string, redirect? = boolean,
-- } request Options for the request. See @{http.request} for details on how
-- these options behave.
--
-- @treturn Response The resulting http response, which can be read from.
-- @treturn[2] nil When the http request failed, such as in the event of a 404
-- error or connection timeout.
-- @treturn string A message detailing why the request failed.
-- @treturn Response|nil The failing http response, if available.
--
-- @usage Make a request to [example.computercraft.cc](https://example.computercraft.cc),
-- and print the returned page.
-- ```lua
-- local request = http.get("https://example.computercraft.cc")
-- print(request.readAll())
-- -- => HTTP is working!
-- request.close()
-- ```
function get(...) end
--- Make a HTTP POST request to the given url.
--
-- @tparam string url The url to request
-- @tparam string body The body of the POST request.
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of this request.
-- @tparam[opt] boolean binary Whether to make a binary HTTP request. If true,
-- the body will not be UTF-8 encoded, and the received response will not be
-- decoded.
--
-- @tparam[2] {
-- url = string, body? = string, headers? = { [string] = string },
-- binary? = boolean, method? = string, redirect? = boolean,
-- } request Options for the request. See @{http.request} for details on how
-- these options behave.
--
-- @treturn Response The resulting http response, which can be read from.
-- @treturn[2] nil When the http request failed, such as in the event of a 404
-- error or connection timeout.
-- @treturn string A message detailing why the request failed.
-- @treturn Response|nil The failing http response, if available.
function post(...) end
--- A http response. This acts very much like a @{fs.ReadHandle|file}, though
-- provides some http specific methods.
--
-- #### `http_success` event
-- #### `http_failure` event
--
-- @type Response
-- @see http.request On how to make a http request.
local Response = {}
--- Returns the response code and response message returned by the server
--
-- @treturn number The response code (i.e. 200)
-- @treturn string The response message (i.e. "OK")
function Response.getResponseCode() end
--- Get a table containing the response's headers, in a format similar to that
-- required by @{http.request}. If multiple headers are sent with the same
-- name, they will be combined with a comma.
--
-- @treturn { [string]=string } The response's headers.
-- Make a request to [example.computercraft.cc](https://example.computercraft.cc),
-- and print the returned headers.
-- ```lua
-- local request = http.get("https://example.computercraft.cc")
-- print(textutils.serialize(request.getResponseHeaders()))
-- -- => {
-- -- [ "Content-Type" ] = "text/plain; charset=utf8",
-- -- [ "content-length" ] = 17,
-- -- ...
-- -- }
-- request.close()
-- ```
function Response.getResponseHeaders() end
function Response.read(count) end
function Response.readAll() end
function Response.readLine(with_trailing) end
function Response.seek(whence, offset) end
function Response.close() end
--- Asynchronously determine whether a URL can be requested.
--
-- If this returns `true`, one should also listen for [`http_check`
-- events](#http-check-event) which will container further information about
-- whether the URL is allowed or not.
--
-- @tparam string url The URL to check.
-- @treturn true When this url is not invalid. This does not imply that it is
-- allowed - see the comment above.
-- @treturn[2] false When this url is invalid.
-- @treturn string A reason why this URL is not valid (for instance, if it is
-- malformed, or blocked).
--
-- @see http.checkURL For a synchronous version.
function checkURLAsync(url) end
--- Determine whether a URL can be requested.
--
-- If this returns `true`, one should also listen for [`http_check`
-- events](#http-check-event) which will container further information about
-- whether the URL is allowed or not.
--
-- @tparam string url The URL to check.
-- @treturn true When this url is valid and can be requested via @{http.request}.
-- @treturn[2] false When this url is invalid.
-- @treturn string A reason why this URL is not valid (for instance, if it is
-- malformed, or blocked).
--
-- @see http.checkURLAsync For an asynchronous version.
--
-- @usage
-- ```lua
-- print(http.checkURL("https://example.computercraft.cc/"))
-- -- => true
-- print(http.checkURL("http://localhost/"))
-- -- => false Domain not permitted
-- print(http.checkURL("not a url"))
-- -- => false URL malformed
-- ```
function checkURL(url) end
--- Open a websocket.
--
-- @tparam string url The websocket url to connect to. This should have the
-- `ws://` or `wss://` protocol.
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of the initial websocket connection.
--
-- @treturn Websocket The websocket connection.
-- @treturn[2] false If the websocket connection failed.
-- @treturn string An error message describing why the connection failed.
function websocket(url, headers) end
--- Asynchronously open a websocket.
--
-- This returns immediately, a [`websocket_success`](#websocket-success-event)
-- or [`websocket_failure`](#websocket-failure-event) will be queued once the
-- request has completed.
--
-- @tparam string url The websocket url to connect to. This should have the
-- `ws://` or `wss://` protocol.
-- @tparam[opt] { [string] = string } headers Additional headers to send as part
-- of the initial websocket connection.
function websocketAsync(url, headers) end
--- A websocket, which can be used to send an receive messages with a web
-- server.
--
-- @type Websocket
-- @see http.websocket On how to open a websocket.
local Websocket = {}
--- Send a websocket message to the connected server.
--
-- @tparam string message The message to send.
-- @tparam[opt] boolean binary Whether this message should be treated as a
-- binary string, rather than encoded text.
-- @throws If the websocket has been closed.
function Websocket.send(message, binary) end
--- Wait for a message from the server.
--
-- @tparam[opt] number timeout The number of seconds to wait if no message is
-- received.
-- @treturn[1] string The received message.
-- @treturn boolean If this was a binary message.
-- @treturn[2] nil If the websocket was closed while waiting, or if we timed out.
-- @throws If the websocket has been closed.
function Websocket.receive(timeout) end
--- Close this websocket. This will terminate the connection, meaning messages
-- can no longer be sent or received along it.
function Websocket.close() end

24
doc/stub/os.lua Normal file
View File

@@ -0,0 +1,24 @@
function queueEvent(event, ...) end
function startTimer(delay) end
function setAlarm(time) end
function shutdown() end
function reboot() end
function getComputerID() end
computerID = getComputerID
function setComputerLabel(label) end
function getComputerLabel() end
computerLabel = getComputerLabel
function clock() end
function time(timezone) end
function day(timezone) end
function cancelTimer(id) end
function cancelAlarm(id) end
function epoch(timezone) end
function date(format, time) end
-- Defined in bios.lua
function loadAPI(path) end
function pullEvent(filter) end
function pullEventRaw(filter) end
function version() end
function run(env, path, ...) end

28
doc/stub/pocket.lua Normal file
View File

@@ -0,0 +1,28 @@
--[[-
Control the current pocket computer, adding or removing upgrades.
This API is only available on pocket computers. As such, you may use its
presence to determine what kind of computer you are using:
```lua
if pocket then
print("On a pocket computer")
else
print("On something else")
end
```
]]
--- Search the player's inventory for another upgrade, replacing the existing
-- one with that item if found.
--
-- This inventory search starts from the player's currently selected slot,
-- allowing you to prioritise upgrades.
--
-- @throws If an upgrade cannot be found.
function equipBack() end
--- Remove the pocket computer's current upgrade.
--
-- @throws If this pocket computer does not currently have an upgrade.
function unequipBack() end

120
doc/stub/redstone.lua Normal file
View File

@@ -0,0 +1,120 @@
--[[- Interact with redstone attached to this computer.
The @{redstone} library exposes three "types" of redstone control:
- Binary input/output (@{setOutput}/@{getInput}): These simply check if a
redstone wire has any input or output. A signal strength of 1 and 15 are
treated the same.
- Analogue input/output (@{setAnalogueOutput}/@{getAnalogueInput}): These
work with the actual signal strength of the redstone wired, from 0 to 15.
- Bundled cables (@{setBundledOutput}/@{getBundledInput}): These interact with
"bundled" cables, such as those from Project:Red. These allow you to send
16 separate on/off signals. Each channel corresponds to a colour, with the
first being @{colors.white} and the last @{colors.black}.
Whenever a redstone input changes, a `redstone` event will be fired. This may
be used in or
This module may also be referred to as `rs`. For example, one may call
`rs.getSides()` instead of @{redstone.getSides}.
@module redstone
@usage Toggle the redstone signal above the computer every 0.5 seconds.
while true do
redstone.setOutput("top", not redstone.getOutput("top"))
sleep(0.5)
end
@usage Mimic a redstone comparator in [subtraction mode][comparator].
while true do
local rear = rs.getAnalogueInput("back")
local sides = math.max(rs.getAnalogueInput("left"), rs.getAnalogueInput("right"))
rs.setAnalogueOutput("front", math.max(rear - sides, 0))
os.pullEvent("redstone") -- Wait for a change to inputs.
end
[comparator]: https://minecraft.gamepedia.com/Redstone_Comparator#Subtract_signal_strength "Redstone Comparator on the Minecraft wiki."
]]
--- Returns a table containing the six sides of the computer. Namely, "top",
-- "bottom", "left", "right", "front" and "back".
--
-- @treturn { string... } A table of valid sides.
function getSides() end
--- Turn the redstone signal of a specific side on or off.
--
-- @tparam string side The side to set.
-- @tparam boolean on Whether the redstone signal should be on or off. When on,
-- a signal strength of 15 is emitted.
function setOutput(side, on) end
--- Get the current redstone output of a specific side.
--
-- @tparam string side The side to get.
-- @treturn boolean Whether the redstone output is on or off.
-- @see setOutput
function getOutput(side) end
--- Get the current redstone input of a specific side.
--
-- @tparam string side The side to get.
-- @treturn boolean Whether the redstone input is on or off.
function getInput(side) end
--- Set the redstone signal strength for a specific side.
--
-- @tparam string side The side to set.
-- @tparam number value The signal strength, between 0 and 15.
-- @throws If `value` is not between 0 and 15.
function setAnalogOutput(side, value) end
setAnalogueOutput = setAnalogOutput
--- Get the redstone output signal strength for a specific side.
--
-- @tparam string side The side to get.
-- @treturn number The output signal strength, between 0 and 15.
-- @see setAnalogueOutput
function getAnalogOutput(sid) end
getAnalogueOutput = getAnalogOutput
--- Get the redstone input signal strength for a specific side.
--
-- @tparam string side The side to get.
-- @treturn number The input signal strength, between 0 and 15.
function getAnalogInput(side) end
getAnalogueInput = getAnalogInput
--- Set the bundled cable output for a specific side.
--
-- @tparam string side The side to set.
-- @tparam number The colour bitmask to set.
-- @see colors.subtract For removing a colour from the bitmask.
-- @see colors.combine For adding a colour to the bitmask.
function setBundledOutput(side, output) end
--- Get the bundled cable output for a specific side.
--
-- @tparam string side The side to get.
-- @treturn number The bundled cable's output.
function getBundledOutput(side) end
--- Get the bundled cable input for a specific side.
--
-- @tparam string side The side to get.
-- @treturn number The bundled cable's input.
-- @see testBundledInput To determine if a specific colour is set.
function getBundledInput(side) end
--- Determine if a specific combination of colours are on for the given side.
--
-- @tparam string side The side to test.
-- @tparam number mask The mask to test.
-- @see getBundledInput
-- @see colors.combine For adding a colour to the bitmask.
-- @usage Check if @{colors.white} and @{colors.black} are on for above the
-- computer.
--
-- print(redstone.testBundledInput("top", colors.combine(colors.white, colors.black)))
function testBundledInput(side, mask) end

52
doc/stub/term.lua Normal file
View File

@@ -0,0 +1,52 @@
function write(text) end
function scroll(lines) end
function setCursorPos(x, y) end
function setCursorBlink(blink) end
function getCursorPos() end
function getSize() end
function clear() end
function clearLine() end
function setTextColour(colour) end
setTextColor = setTextColour
function setBackgroundColour(colour) end
setBackgroundColor = setBackgroundColour
function isColour() end
isColor = isColour
function getTextColour() end
getTextColor = getTextColor
function getBackgroundColour() end
getBackgroundColor = getBackgroundColour
function blit(text, text_colours, background_colours) end
function setPaletteColour(colour, ...) end
setPaletteColor = setPaletteColour
function getPaletteColour(colour, ...) end
getPaletteColor = getPaletteColour
function nativePaletteColour(colour) end
nativePaletteColor = nativePaletteColour
--- @type Redirect
local Redirect = {}
Redirect.write = write
Redirect.scroll = scroll
Redirect.setCursorPos = setCursorPos
Redirect.setCursorBlink = setCursorBlink
Redirect.getCursorPos = getCursorPos
Redirect.getSize = getSize
Redirect.clear = clear
Redirect.clearLine = clearLine
Redirect.setTextColour = setTextColour
Redirect.setTextColor = setTextColor
Redirect.setBackgroundColour = setBackgroundColour
Redirect.setBackgroundColor = setBackgroundColor
Redirect.isColour = isColour
Redirect.isColor = isColor
Redirect.getTextColour = getTextColour
Redirect.getTextColor = getTextColor
Redirect.getBackgroundColour = getBackgroundColour
Redirect.getBackgroundColor = getBackgroundColor
Redirect.blit = blit
Redirect.setPaletteColour = setPaletteColour
Redirect.setPaletteColor = setPaletteColor
Redirect.getPaletteColour = getPaletteColour
Redirect.getPaletteColor = getPaletteColor

230
doc/stub/turtle.lua Normal file
View File

@@ -0,0 +1,230 @@
--- Move the turtle forward one block.
-- @treturn boolean Whether the turtle could successfully move.
-- @treturn string|nil The reason the turtle could not move.
function forward() end
--- Move the turtle backwards one block.
-- @treturn boolean Whether the turtle could successfully move.
-- @treturn string|nil The reason the turtle could not move.
function back() end
--- Move the turtle up one block.
-- @treturn boolean Whether the turtle could successfully move.
-- @treturn string|nil The reason the turtle could not move.
function up() end
--- Move the turtle down one block.
-- @treturn boolean Whether the turtle could successfully move.
-- @treturn string|nil The reason the turtle could not move.
function down() end
--- Rotate the turtle 90 degress to the left.
function turnLeft() end
--- Rotate the turtle 90 degress to the right.
function turnRight() end
--- Attempt to break the block in front of the turtle.
--
-- This requires a turtle tool capable of breaking the block. Diamond pickaxes
-- (mining turtles) can break any vanilla block, but other tools (such as axes)
-- are more limited.
--
-- @tparam[opt] "left"|"right" side The specific tool to use.
-- @treturn boolean Whether a block was broken.
-- @treturn string|nil The reason no block was broken.
function dig(side) end
--- Attempt to break the block above the turtle. See @{dig} for full details.
--
-- @tparam[opt] "left"|"right" side The specific tool to use.
-- @treturn boolean Whether a block was broken.
-- @treturn string|nil The reason no block was broken.
function digUp(side) end
--- Attempt to break the block below the turtle. See @{dig} for full details.
--
-- @tparam[opt] "left"|"right" side The specific tool to use.
-- @treturn boolean Whether a block was broken.
-- @treturn string|nil The reason no block was broken.
function digDown(side) end
--- Attack the entity in front of the turtle.
--
-- @tparam[opt] "left"|"right" side The specific tool to use.
-- @treturn boolean Whether an entity was attacked.
-- @treturn string|nil The reason nothing was attacked.
function attack(side) end
--- Attack the entity above the turtle.
--
-- @tparam[opt] "left"|"right" side The specific tool to use.
-- @treturn boolean Whether an entity was attacked.
-- @treturn string|nil The reason nothing was attacked.
function attackUp(side) end
--- Attack the entity below the turtle.
--
-- @tparam[opt] "left"|"right" side The specific tool to use.
-- @treturn boolean Whether an entity was attacked.
-- @treturn string|nil The reason nothing was attacked.
function attackDown(side) end
--- Place a block or item into the world in front of the turtle.
--
-- @treturn boolean Whether the block could be placed.
-- @treturn string|nil The reason the block was not placed.
function place() end
--- Place a block or item into the world above the turtle.
--
-- @treturn boolean Whether the block could be placed.
-- @treturn string|nil The reason the block was not placed.
function placeUp() end
--- Place a block or item into the world below the turtle.
--
-- @treturn boolean Whether the block could be placed.
-- @treturn string|nil The reason the block was not placed.
function placeDown() end
--- Drop the currently selected stack into the inventory in front of the turtle,
-- or as an item into the world if there is no inventory.
--
-- @tparam[opt] number count The number of items to drop. If not given, the
-- entire stack will be dropped.
-- @treturn boolean Whether items were dropped.
-- @treturn string|nil The reason the no items were dropped.
-- @see select
function drop(count) end
--- Drop the currently selected stack into the inventory above the turtle, or as
-- an item into the world if there is no inventory.
--
-- @tparam[opt] number count The number of items to drop. If not given, the
-- entire stack will be dropped.
-- @treturn boolean Whether items were dropped.
-- @treturn string|nil The reason the no items were dropped.
-- @see select
function dropUp(count) end
--- Drop the currently selected stack into the inventory below the turtle, or as
-- an item into the world if there is no inventory.
--
-- @tparam[opt] number count The number of items to drop. If not given, the
-- entire stack will be dropped.
-- @treturn boolean Whether items were dropped.
-- @treturn string|nil The reason the no items were dropped.
-- @see select
function dropDown(count) end
--- Suck an item from the inventory in front of the turtle, or from an item
-- floating in the world.
--
-- This will pull items into the first acceptable slot, starting at the
-- @{select|currently selected} one.
--
-- @tparam[opt] number count The number of items to suck. If not given, up to a
-- stack of items will be picked up.
-- @treturn boolean Whether items were picked up.
-- @treturn string|nil The reason the no items were picked up.
function suck(count) end
--- Suck an item from the inventory above the turtle, or from an item floating
-- in the world.
--
-- @tparam[opt] number count The number of items to suck. If not given, up to a
-- stack of items will be picked up.
-- @treturn boolean Whether items were picked up.
-- @treturn string|nil The reason the no items were picked up.
function suckUp(count) end
--- Suck an item from the inventory below the turtle, or from an item floating
-- in the world.
--
-- @tparam[opt] number count The number of items to suck. If not given, up to a
-- stack of items will be picked up.
-- @treturn boolean Whether items were picked up.
-- @treturn string|nil The reason the no items were picked up.
function suckDown(count) end
--- Check if there is a solid block in front of the turtle. In this case, solid
-- refers to any non-air or liquid block.
--
-- @treturn boolean If there is a solid block in front.
function detect() end
--- Check if there is a solid block above the turtle.
--
-- @treturn boolean If there is a solid block above.
function detectUp() end
--- Check if there is a solid block below the turtle.
--
-- @treturn boolean If there is a solid block below.
function detectDown() end
function compare() end
function compareUp() end
function compareDown() end
function inspect() end
function inspectUp() end
function inspectDown() end
--- Change the currently selected slot.
--
-- The selected slot is determines what slot actions like @{drop} or
-- @{getItemCount} act on.
--
-- @tparam number slot The slot to select.
-- @see getSelectedSlot
function select(slot) end
--- Get the currently selected slot.
--
-- @treturn number The current slot.
-- @see select
function getSelectedSlot() end
--- Get the number of items in the given slot.
--
-- @tparam[opt] number slot The slot we wish to check. Defaults to the @{turtle.select|selected slot}.
-- @treturn number The number of items in this slot.
function getItemCount(slot) end
--- Get the remaining number of items which may be stored in this stack.
--
-- For instance, if a slot contains 13 blocks of dirt, it has room for another 51.
--
-- @tparam[opt] number slot The slot we wish to check. Defaults to the @{turtle.select|selected slot}.
-- @treturn number The space left in this slot.
function getItemSpace(slot) end
--- Get detailed information about the items in the given slot.
--
-- @tparam[opt] number slot The slot to get information about. Defaults to the @{turtle.select|selected slot}.
-- @treturn nil|table Information about the given slot, or @{nil} if it is empty.
-- @usage Print the current slot, assuming it contains 13 dirt.
--
-- print(textutils.serialize(turtle.getItemDetail()))
-- -- => {
-- -- name = "minecraft:dirt",
-- -- damage = 0,
-- -- count = 13,
-- -- }
function getItemDetail(slot) end
function getFuelLevel() end
function refuel(count) end
function compareTo(slot) end
function transferTo(slot, count) end
function getFuelLimit() end
function equipLeft() end
function equipRight() end
function craft(limit) end

186
doc/styles.css Normal file
View File

@@ -0,0 +1,186 @@
/* Basic reset on elements */
h1, h2, h3, h4, p, table, div, body {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* Make the page a little more airy */
body {
margin: 20px auto;
max-width: 1200px;
padding: 0 10px;
line-height: 1.6;
color: #222;
background: #fff;
}
/* Try to use system default fonts. */
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans",
"Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
code, pre, .parameter, .type, .definition-name, .reference-code {
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
/* Some definitions of basic tags */
code {
color: #c7254e;
background-color: #f9f2f4;
}
p {
margin: 0.9em 0;
}
h1 {
font-size: 1.5em;
font-weight: lighter;
border-bottom: solid 1px #aaa;
}
h2, h3, h4 { margin: 1.4em 0 0.3em;}
h2 { font-size: 1.25em; }
h3 { font-size: 1.15em; font-weight: bold; }
h4 { font-size: 1.06em; }
a, a:visited, a:active { font-weight: bold; color: #004080; text-decoration: none; }
a:hover { text-decoration: underline; }
blockquote { margin-left: 3em; }
/* Stop sublists from having initial vertical space */
ul ul { margin-top: 0px; }
ol ul { margin-top: 0px; }
ol ol { margin-top: 0px; }
ul ol { margin-top: 0px; }
/* Make the target distinct; helps when we're navigating to a function */
a:target + * { background-color: #FFFF99; }
/* Allow linking to any subsection */
a[name]::before { content: "#"; }
/* Layout */
#main {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
min-height: calc(100vh - 100px);
}
#main > nav {
flex-basis: 30%;
min-width: 150px;
max-width: 250px;
background-color: #f0f0f0;
}
nav h1, nav ul { padding: 0em 10px; }
nav h2 {
background-color:#e7e7e7;
font-size: 1.1em;
color:#000000;
padding: 5px 10px;
}
nav ul {
list-style-type: none;
margin: 0;
}
#content {
flex-shrink: 1;
flex-basis: 80%;
padding: 0px 10px;
}
footer {
text-align: right;
font-size: 0.8em;
}
/* The definition lists at the top of each page */
table.definition-list {
border-collapse: collapse;
width: 100%;
}
table.definition-list td, table.definition-list th {
border: 1px solid #cccccc;
padding: 5px;
}
table.definition-list th {
background-color: #f0f0f0;
min-width: 200px;
white-space: nowrap;
text-align: right;
}
table.definition-list td { width: 100%; }
dl.definition dt {
border-top: 1px solid #ccc;
padding-top: 1em;
display: flex;
}
dl.definition dt .definition-name {
padding: 0 0.1em;
margin: 0 0.1em;
flex-grow: 1;
}
dl.definition dd {
padding-bottom: 1em;
margin: 10px 0 0 20px;
}
dl.definition h3 {
font-size: .95em;
}
/* Links to source-code */
.source-link { font-size: 0.8em; }
.source-link::before { content: '[' }
.source-link::after { content: ']' }
a.source-link, a.source-link:visited, a.source-link:active { color: #505050; }
/* Method definitions */
span.parameter:after { content:":"; padding-left: 0.3em; }
.optional { text-decoration: underline dotted; }
/** Fancy colour display. */
.colour-ref {
display: inline-block;
width: 0.8em;
height: 0.8em;
margin: 0.1em 0.1em 0.3em 0.1em; /* Terrrible hack to force vertical alignment. */
border: solid 1px black;
box-sizing: border-box;
vertical-align: middle;
}
/* styles for prettification of source */
.highlight .comment { color: #558817; }
.highlight .constant { color: #a8660d; }
.highlight .escape { color: #844631; }
.highlight .keyword { color: #aa5050; font-weight: bold; }
.highlight .library { color: #0e7c6b; }
.highlight .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
.highlight .string { color: #8080ff; }
.highlight .literal-kw { color: #8080ff; }
.highlight .number { color: #f8660d; }
.highlight .operator { color: #2239a8; font-weight: bold; }
.highlight .preprocessor, pre .prepro { color: #a33243; }
.highlight .global { color: #800080; }
.highlight .user-keyword { color: #800080; }
.highlight .prompt { color: #558817; }
.highlight .url { color: #272fc2; text-decoration: underline; }

View File

@@ -1,7 +1,7 @@
# Mod properties
mod_version=1.83.1
mod_version=1.89.0
# Minecraft properties
mc_version=1.13.2
forge_version=25.0.219
mappings_version=20190530-1.13.2
# Minecraft properties (update mods.toml when changing)
mc_version=1.14.4
forge_version=28.1.71
mappings_version=20191123-1.14.3

95
illuaminate.sexp Normal file
View File

@@ -0,0 +1,95 @@
; -*- mode: Lisp;-*-
(sources
/doc/stub/
/src/main/resources/*/computercraft/lua/bios.lua
/src/main/resources/*/computercraft/lua/rom/
/src/test/resources/test-rom)
(doc
(title "CC: Tweaked")
(index doc/index.md)
(source-link https://github.com/SquidDev-CC/CC-Tweaked/blob/${commit}/${path}#L${line})
(library-path
/doc/stub/
/src/main/resources/*/computercraft/lua/rom/apis
/src/main/resources/*/computercraft/lua/rom/apis/command
/src/main/resources/*/computercraft/lua/rom/apis/turtle
/src/main/resources/*/computercraft/lua/rom/modules/main
/src/main/resources/*/computercraft/lua/rom/modules/command
/src/main/resources/*/computercraft/lua/rom/modules/turtle))
(at /
(linters
syntax:string-index
;; It'd be nice to avoid this, but right now there's a lot of instances of
;; it.
-var:set-loop
;; It's useful to name arguments for documentation, so we allow this. It'd
;; be good to find a compromise in the future, but this works for now.
-var:unused-arg)
(lint
(bracket-spaces
(call no-space)
(function-args no-space)
(parens no-space)
(table space)
(index no-space))
;; colours imports from colors, and we don't handle that right now.
;; keys is entirely dynamic, so we skip it.
(dynamic-modules colours keys)
(globals
:max
_CC_DEFAULT_SETTINGS
_CC_DISABLE_LUA51_FEATURES
;; Ideally we'd pick these up from bios.lua, but illuaminate currently
;; isn't smart enough.
sleep write printError read rs)))
;; We disable the unused global linter in bios.lua and the APIs. In the future
;; hopefully we'll get illuaminate to handle this.
(at
(/src/main/resources/*/computercraft/lua/bios.lua
/src/main/resources/*/computercraft/lua/rom/apis/)
(linters -var:unused-global)
(lint (allow-toplevel-global true)))
;; Silence some variable warnings in documentation stubs.
(at /doc/stub
(linters -var:unused-global)
(lint (allow-toplevel-global true)))
;; Suppress warnings for currently undocumented modules.
(at
(/doc/stub/fs.lua
/doc/stub/http.lua
/doc/stub/os.lua
/doc/stub/term.lua
/doc/stub/turtle.lua
/src/main/resources/*/computercraft/lua/rom/apis/io.lua
/src/main/resources/*/computercraft/lua/rom/apis/window.lua)
(linters -doc:undocumented -doc:undocumented-arg))
;; These currently rely on unknown references.
(at
(/src/main/resources/*/computercraft/lua/rom/apis/textutils.lua
/src/main/resources/*/computercraft/lua/rom/modules/main/cc/completion.lua
/src/main/resources/*/computercraft/lua/rom/modules/main/cc/shell/completion.lua
/src/main/resources/*/computercraft/lua/rom/programs/shell.lua)
(linters -doc:unresolved-reference))
(at /src/test/resources/test-rom
(lint
(globals
:max sleep write
cct_test describe expect howlci fail it pending stub)))

View File

@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:cable"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_modem": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:cable"
}
}
},
"requirements": [
[
"has_computer",
"has_modem",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:computer_advanced"
]
},
"criteria": {
"has_components": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:redstone"
},
{
"item": "minecraft:gold_ingot"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:computer_advanced"
}
}
},
"requirements": [
[
"has_components",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:computer_command"
]
},
"criteria": {
"has_components": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:command_block"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:computer_command"
}
}
},
"requirements": [
[
"has_components",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:computer_normal"
]
},
"criteria": {
"has_redstone": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:dusts/redstone"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:computer_normal"
}
}
},
"requirements": [
[
"has_redstone",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_1"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_1"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_10"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_10"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_11"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_11"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_12"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_12"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_13"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_13"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_14"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_14"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_15"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_15"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_16"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_16"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_2"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_2"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_3"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_3"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_4"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_4"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_5"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_5"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_6"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_6"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_7"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_7"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_8"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_8"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_9"
]
},
"criteria": {
"has_drive": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:disk_drive"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_9"
}
}
},
"requirements": [
[
"has_drive",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_drive"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_drive"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:monitor_advanced"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:monitor_advanced"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:monitor_normal"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:monitor_normal"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/computercraft/speaker"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "computercraft:speaker"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/computercraft/speaker"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/computercraft/wireless_modem_advanced"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "computercraft:wireless_modem_advanced"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/computercraft/wireless_modem_advanced"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/computercraft/wireless_modem_normal"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "computercraft:wireless_modem_normal"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/computercraft/wireless_modem_normal"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/minecraft/crafting_table"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "minecraft:crafting_table"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/minecraft/crafting_table"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/minecraft/diamond_axe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "minecraft:diamond_axe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/minecraft/diamond_axe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/minecraft/diamond_hoe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "minecraft:diamond_hoe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/minecraft/diamond_hoe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/minecraft/diamond_pickaxe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "minecraft:diamond_pickaxe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/minecraft/diamond_pickaxe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/minecraft/diamond_shovel"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "minecraft:diamond_shovel"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/minecraft/diamond_shovel"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_advanced/minecraft/diamond_sword"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_advanced"
},
{
"item": "minecraft:diamond_sword"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_advanced/minecraft/diamond_sword"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_computer_advanced"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_apple": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:golden_apple"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_computer_advanced"
}
}
},
"requirements": [
[
"has_computer",
"has_apple",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_computer_normal"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_apple": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:golden_apple"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_computer_normal"
}
}
},
"requirements": [
[
"has_computer",
"has_apple",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/computercraft/speaker"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "computercraft:speaker"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/computercraft/speaker"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/computercraft/wireless_modem_advanced"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "computercraft:wireless_modem_advanced"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/computercraft/wireless_modem_advanced"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/computercraft/wireless_modem_normal"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "computercraft:wireless_modem_normal"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/computercraft/wireless_modem_normal"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/minecraft/crafting_table"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "minecraft:crafting_table"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/minecraft/crafting_table"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/minecraft/diamond_axe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "minecraft:diamond_axe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/minecraft/diamond_axe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/minecraft/diamond_hoe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "minecraft:diamond_hoe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/minecraft/diamond_hoe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/minecraft/diamond_pickaxe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "minecraft:diamond_pickaxe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/minecraft/diamond_pickaxe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/minecraft/diamond_shovel"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "minecraft:diamond_shovel"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/minecraft/diamond_shovel"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_normal/minecraft/diamond_sword"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:pocket_computer_normal"
},
{
"item": "minecraft:diamond_sword"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_normal/minecraft/diamond_sword"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:printer"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:printer"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:speaker"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:speaker"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/computercraft/speaker"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "computercraft:speaker"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/computercraft/speaker"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/computercraft/wireless_modem_advanced"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "computercraft:wireless_modem_advanced"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/computercraft/wireless_modem_advanced"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/computercraft/wireless_modem_normal"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "computercraft:wireless_modem_normal"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/computercraft/wireless_modem_normal"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/minecraft/crafting_table"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "minecraft:crafting_table"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/minecraft/crafting_table"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/minecraft/diamond_axe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "minecraft:diamond_axe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/minecraft/diamond_axe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/minecraft/diamond_hoe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "minecraft:diamond_hoe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/minecraft/diamond_hoe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/minecraft/diamond_pickaxe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "minecraft:diamond_pickaxe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/minecraft/diamond_pickaxe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/minecraft/diamond_shovel"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "minecraft:diamond_shovel"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/minecraft/diamond_shovel"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_advanced/minecraft/diamond_sword"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_advanced"
},
{
"item": "minecraft:diamond_sword"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_advanced/minecraft/diamond_sword"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/computercraft/speaker"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "computercraft:speaker"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/computercraft/speaker"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/computercraft/wireless_modem_advanced"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "computercraft:wireless_modem_advanced"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/computercraft/wireless_modem_advanced"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/computercraft/wireless_modem_normal"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "computercraft:wireless_modem_normal"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/computercraft/wireless_modem_normal"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/minecraft/crafting_table"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "minecraft:crafting_table"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/minecraft/crafting_table"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/minecraft/diamond_axe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "minecraft:diamond_axe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/minecraft/diamond_axe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/minecraft/diamond_hoe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "minecraft:diamond_hoe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/minecraft/diamond_hoe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/minecraft/diamond_pickaxe"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "minecraft:diamond_pickaxe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/minecraft/diamond_pickaxe"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/minecraft/diamond_shovel"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "minecraft:diamond_shovel"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/minecraft/diamond_shovel"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:turtle_normal/minecraft/diamond_sword"
]
},
"criteria": {
"has_items": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:turtle_normal"
},
{
"item": "minecraft:diamond_sword"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:turtle_normal/minecraft/diamond_sword"
}
}
},
"requirements": [
[
"has_items",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wired_modem"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_cable": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:cable"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wired_modem"
}
}
},
"requirements": [
[
"has_computer",
"has_cable",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wired_modem_full_from"
]
},
"criteria": {
"has_modem": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:wired_modem"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wired_modem_full_from"
}
}
},
"requirements": [
[
"has_modem",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wired_modem_full_to"
]
},
"criteria": {
"has_modem": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:wired_modem"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wired_modem_full_to"
}
}
},
"requirements": [
[
"has_modem",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wireless_modem_advanced"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_wireless": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:wireless_modem_normal"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wireless_modem_advanced"
}
}
},
"requirements": [
[
"has_computer",
"has_wireless",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wireless_modem_normal"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wireless_modem_normal"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,34 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:dynamic",
"name": "computercraft:computer"
}
],
"conditions": [
{
"condition": "minecraft:alternative",
"terms": [
{
"condition": "computercraft:block_named"
},
{
"condition": "computercraft:has_id"
},
{
"condition": "minecraft:inverted",
"term": {
"condition": "computercraft:player_creative"
}
}
]
}
]
}
]
}

View File

@@ -0,0 +1,34 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:dynamic",
"name": "computercraft:computer"
}
],
"conditions": [
{
"condition": "minecraft:alternative",
"terms": [
{
"condition": "computercraft:block_named"
},
{
"condition": "computercraft:has_id"
},
{
"condition": "minecraft:inverted",
"term": {
"condition": "computercraft:player_creative"
}
}
]
}
]
}
]
}

Some files were not shown because too many files have changed in this diff Show More