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

81 Commits

Author SHA1 Message Date
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
SquidDev
b6715bd812 Fix a couple of build failures 2019-06-02 18:36:34 +01:00
SquidDev
7467b7f88a Fix several deprecated warnings 2019-06-02 17:23:33 +01:00
SquidDev
c82d8a7c2a Merge branch 'master' into mc-1.13.x 2019-06-02 16:46:45 +01:00
SquidDev
a48f1e310f
Add a custom renderer for monitor block highlights (#220)
This only renders the bounding box on non-screen edges of the monitor,
meaning you have an uninterrupted view of the screen when hovering
hover.

Closes #219
2019-05-30 07:51:35 +01:00
SquidDev
114f913bf8
Rework rendering of in-hand pocket computers (#215)
Rendering an item worked in principle, but had several caveats:
 - The terminal did not fit well within the item's texture, so we had a
   rather large border.
 - The "correctness" of this was very tied to Minecraft's item rendering
   code. This changed a little in 1.13, causing problems like #208.

Instead we effectively reuse the computer GUI rendering code, though
also handling coloured pocket computers and rendering the modem light.

This fixes #208, and hopefully fixes #212.
2019-05-26 15:24:37 +01:00
SquidDev
362dbd97ac Correctly handle capability creation & invalidation
Also make cable part detection more consistent.
2019-04-09 17:29:23 +01:00
SquidDev
23ddd4feb5 Fix several deprecation warnings 2019-04-09 16:30:44 +01:00
SquidDev
f9e13ca67a Update CC: Tweaked to 1.13
Look, I originally had this split into several commits, but lots of
other cleanups got mixed in. I then backported some of the cleanups to
1.12, did other tidy ups there, and eventually the web of merges was
unreadable.

Yes, this is a horrible mess, but it's still nicer than it was. Anyway,
changes:

 - Flatten everything. For instance, there are now three instances of
   BlockComputer, two BlockTurtle, ItemPocketComputer. There's also no
   more BlockPeripheral (thank heavens) - there's separate block classes
   for each peripheral type.

 - Remove pretty much all legacy code. As we're breaking world
   compatibility anyway, we can remove all the code to load worlds from
   1.4 days.
 - The command system is largely rewriten to take advantage of 1.13's
   new system. It's very fancy!

 - WidgetTerminal now uses Minecraft's "GUI listener" system.

 - BREAKING CHANGE: All the codes in keys.lua are different, due to the
   move to LWJGL 3. Hopefully this won't have too much of an impact.

   I don't want to map to the old key codes on the Java side, as there
   always ends up being small but slight inconsistencies. IMO it's
   better to make a clean break - people should be using keys rather
   than hard coding the constants anyway.

 - commands.list now allows fetching sub-commands. The ROM has already
   been updated to allow fancy usage such as commands.time.set("noon").

 - Turtles, modems and cables can be waterlogged.
2019-04-02 20:59:48 +01:00
SquidDev
2965fb666f Some further cleanup and 1.13 cherry-picks
Are most of these changes small and petty? Yes. However, IMO they do
make the code more readable. Anyway, a summary of some of the more
interesting changes:

 - Expose Abstract*Upgrade classes in the API
 - Fix the spelling of Jonathan in the API docs (*shakes fist*)
 - Fix bug with printout not working in the offhand.
 - Rename any argments/variables accidentally named "m_*", and add an
   inspection to prevent it happening again.
 - Remove most of the Block*.Properties classes - just inline them in
   the parent class.
 - Return super.writeToNBT instead of reassigning at the top.
2019-04-02 12:08:03 +01:00
SquidDev
173ea72001 Turn inspections up to 11
OK, so let's get this out of the way, there's some actual changes mixed
in here too. I'm really sorry:
 - Turtles can now not be renamed with unnamed item tags (previously it
   would clear the name, this seemed a little unideal).
 - commands.getBlock(s)Data will also include NBT.

Now, onto the horror story which is these inspection changes:
 - Make a lot of methods static
 - Typo fixes
 - Make utility classes final + private constructor
 - Lots of reformatting (ifs -> ternary, invert control flow, etc...)
 - ???
 - Profit!

I'm so going to regret this - can pretty much guarantee this is going to
break something.
2019-03-29 21:26:21 +00:00
SquidDev
c4b371b124 Cherry pick several improvements from 1.13
- Move container opening (and gui handling) into a separate class
 - Move turtle/computer placement code onto the block
 - GUIs now use gui{Left,Top} instead of calculating it manually.
 - IPeripheralTile is now exposed in the API.
2019-03-27 19:20:59 +00:00
SquidDev
e5f988e3fe Fix missing advanced turtle model when rendering
I'm not even sure how I missed this when testing.
2019-02-11 16:38:33 +00:00
SquidDev
d5edbe700b Load turtle item models using a model loader
This is far more elegant than our weird method of baking things and
manually inserting them into the model map. Also means we no longer need
the whole turtle_dynamic thing.
2019-02-10 09:45:15 +00:00
SquidDev
5d97b9c8f3 Utilise @Mod.EventBusSubscriber a little more
This offers several advantages

 - Less registration code: the subscribers are reigstered automatically,
   and we don't need to worry about sided-proxies.
 - We no longer have so many .instance() calls.
2019-01-12 16:27:40 +00:00
SquidDev
1c9110b927 Happy new year! 2019-01-01 01:10:18 +00:00
SquidDev
ee3347afbd A whole bunch of refomatting
- Remove redundant constructors and super calls
 - Standardise naming of texture fields
 - Always use postfix notations for loops
 - Cleanup several peripheral classes
2018-12-30 16:42:41 +00:00
SquidDev
929f23fd2d Share some map-like-item rendering code
Just refactors the hand rendering methods into a shared superclass
2018-12-29 16:42:02 +00:00
SquidDev
42d3901ee3 Move from FMLEventChannel to SimpleNetworkWrapper
- Split each network packet into it's own individual IMessage class.
 - Move the TextTable into separate classes for server and client based
   rendering.
2018-12-29 12:44:18 +00:00
SquidDev
26ba61097b Move several methods out of the proxy
Some methods act the same on both sides, and so can be in utility
classes. Others are only needed on one side, and so do not really need
to be part of the proxy.

 - Remove TurtleVisionCamera. It would be possible to add this back in
   the future, but for now it is unused and so should be removed.
 - Move frame info (cursor blink, current render frame) into a
   FrameInfo class.
 - Move record methods (name, playing a record) into a RecordUtil class.
2018-12-27 11:58:08 +00:00
SquidDev
2c87e66db8 Move several methods from TileGeneric to blocks
- getPickBlock is now implemented directly on computers and turtles,
   rather than on the tile.
 - Bounding boxes are handled on the block rather than tile. This ends
   up being a little ugly in the case of BlockPeripheral, but it's not
   the end of the world.
 - Explosion resistance is only implemented for turtles now.
2018-12-27 11:32:29 +00:00
SquidDev
364d31465e Move modem code into separate packages
Things were shared between common and modem, which just ended up making
things very complicated.
2018-12-27 10:14:22 +00:00
SquidDev
a1c4a9fb58 Replace DirectionUtil methods with builtin equivalents 2018-12-26 09:31:15 +00:00
SquidDev
4ead319092 Remove direct support for beginner's turtles
As CCEdu has not been updated, and is unlikely to be updated as Dan does
not have the rights to open source it, we're removing explicit support
for now.

If an alternative arises in the future, it would be good to support, but
in a way which requires less workarounds in CC's core.
2018-12-26 09:13:15 +00:00
SquidDev
2032e7a83a Reformat everything
It's been a long time comin'
But tonight is the end of the war, my friend
Tomorrow only one style will remain.
2018-12-23 17:46:58 +00:00
SquidDev
4bd7381827 Add support for Forge's ISelectiveResourceReloadListener
This means we don't reload turtles every time someone just reloads
shaders or the language pack.
2018-11-17 10:54:42 +00:00
SquidDev
d2a9e7e458 Reset a few more flags when rendering printouts
Closes #63
2018-08-13 22:25:58 +01:00
SquidDev
b8957cab5c Update to the latest mappings
This is a preliminary for updating to 1.13, as many of the name changes
apply to both. This will make it harder to remain consistent with
actual CC, though that will be less of a consideration when 1.13 hits.
2018-07-24 09:27:05 +01:00
SquidDev
0ce6f34a09 Rewrite printout rendering
- The current page is always centred when rendering in a GUI, with
   the turned pages moving from the sides.
 - Pages are no longer evenly distributed from the centre - they follow
   an exponential decay curve, so ones further out are closer together
   (a bit like an open book).
 - Render pages and books in item frames/in-hand (rather than just
   single pages).

This currently does some very dirty things with z values in order to
prevent z-fighting. It would be nice to avoid that, though turning off
writing to the z buffer causes issues with the bounding box.
2018-07-07 19:59:20 +01:00
SquidDev
fd10ed6f62 Merge pull request #553 from SquidDev-CC/ComputerCraft/feature/fancy-printout
Fancy rendering of printouts
2018-06-19 19:44:51 +01:00
SquidDev
c0bdd4ff1d Add basic support for fancy rendering of printouts
- When held in first-person, single pages are displayed like a map.
 - When placed in an item frame, the page is drawn instead of the actual
   item.
2018-06-18 22:09:24 +01:00
SquidDev
c8db671409 Override monitors' lightmap coordinates
Shaders appear to ignore all the other subtle (and not-so-subtle) hints
we drop that monitors shouldn't be rendered with shadows. This solution
isn't optimal, as monitors may still be tinted due to sunlight, but
there is nothing we can do about that.

Many thanks to ferreusveritas for their help in diagnosing, fixing and
testing this issue.
2018-03-30 12:57:27 +01:00
SquidDev
52641b7bea Allow rendering a monitor tile multiple times in a tick
Shader mods may perform multiple passes when rendering a tile, so
monitors will be drawn transparently on later passes. In order to
prevent this we allow drawing the a single tile multiple times in a
tick.
2018-03-29 12:31:20 +01:00
SquidDev
d758895578 Bump to Forge 1.12.2
Nobody is still using 1.12, so we might as well update to the latest -
it makes it easier to test mod compatibility at least.
2018-03-24 12:20:51 +00:00
SquidDev
7bb8efed1d Dispose of monitor display lists when unloading worlds
This means all display lists are correctly deleted when changing
dimensions/exiting to main menu.
2018-02-24 20:37:14 +00:00
Lignum
e0c9dc24e7
Generate individual display lists instead of relying on their names being contiguous 2018-02-24 17:21:12 +01:00
SquidDev
5c7828dd79 Convert TileCable to use the wired network API
There are several important things to note here:

 - The network element is associated with the cable, whilst the
   peripheral (and so packet sender/receiver) is associated with the
   modem. This allows us to have the main element be in the centre of
   the cable block, whilst the modem is in the centre of the adjacent
   computer.

 - Cables will connect to any adjacent network element, not just
   other cables.

 - Rednet messages are now sent on the computer thread, rather than the
   cable tick.
2018-02-21 15:35:38 +00:00
SquidDev
15a3882016 Fix monitor clear state being cleared without a redraw 2018-02-21 14:32:53 +00:00
SquidDev
662fb96beb Overhaul monitor's terminal code
This restructures monitor in order to make it thread-safe: namely
removing any world interaction from the computer thread.

Instead of each monitor having their own terminal, resize flag, etc...
we use a monitor "multiblock" object. This is constructed on the origin
monitor and propagated to other monitors when required.

We attempt to construct the multiblock object (and so the corresponding
terminal) as lazily as posible. Consequently, we only create the
terminal when fetching the peripheral (not when attaching, as that is
done on the computer thread).

If a monitor is resized (say due to placing/breaking a monitor) then we
will invalidate all references to the multiblock object, construct a new
one if required, and propagate it to all component monitors.

This commit also fixes several instances of glLists not being deleted
after use. It is not a comprehensive fix, but that is outside the scope
of this commit.
2018-02-14 21:30:07 +00:00
SquidDev
c69ba205f8 Merge pull request #502 from SquidDev-CC/ComputerCraft/hotfix/missing-overlay
Fix turtle overlay not being rendered in items
2017-12-24 21:49:01 +00:00
SquidDev
019f4dbea9 Fix turtle overlay not being rendered in items 2017-12-24 21:44:55 +00:00
SquidDev
341e3e2f89 Merge pull request #497 from SquidDev-CC/ComputerCraft/feature/pocket-map
Add map-like rendering for pocket computers
2017-12-01 19:41:07 +00:00
SquidDev
3f70ca5192 Merge pull request #492 from SquidDev-CC/ComputerCraft/feature/fun-turtle-rendering
Improve vertex transformation system
2017-12-01 19:39:33 +00:00
SquidDev
dd51c89278 Add map-like rendering for pocket computers 2017-12-01 11:28:15 +00:00
SquidDev
35da60543e Improve turtles by 200%
Every other mod has some fun feature, so should we. And yes, this was
worth the 400 lines it took to implement.
2017-11-21 00:34:35 +00:00
SquidDev
ce7923d248 Improve vertex transformation system
This migrates TurtleMultiModel's current vertex transformation system
into something more powerful and "correct". Namely, it has the following
improvements:

 - Handles all position formats (float, byte, etc...)
 - Correctly translates normals of quads
 - Reorders faces if the winding order is reversed
2017-11-21 00:18:03 +00:00
SquidDev
5253ab3e58 Merge pull request #463 from josephcsible/ComputerCraft/notnull
Remove some unnecessary null checks
2017-11-14 22:58:36 +00:00
SquidDev
11d8253d9c Merge pull request #464 from josephcsible/ComputerCraft/unnecessary
Remove unnecessary code
2017-11-14 22:57:36 +00:00
SquidDev
6b364052c7 Only render breaking animation on the part being hit 2017-10-04 21:49:40 +01:00