cc-tweaked / CC-Tweaked

Just another ComputerCraft fork
https://tweaked.cc
924 stars 212 forks source link

A grand-ol' cleanup #91

Closed SquidDev closed 4 years ago

SquidDev commented 5 years ago

As some people may have noticed, I've committed some relatively large commits recently (such as reformatting the codebase, removing LuaJ). None have really impacted functionality, but have instead made some progress towards making the code (in my opinion at least), cleaner and more easy to maintain in the future.

Over the next few weeks, I'd like to continue these improvements (albeit on a less major scale), in an attempt to simplify the codebase as much as possible. As I've talked about elsewhere, CC is a pretty old mod, and there's many features which can be implemented in a better way - either due to improvements in Forge or Minecraft's base engine.

I've implemented some of these changes in the 1.13 and 1.14 PRs, and while not everything can be integrated into master, there's several useful improvements which can be.

A summary of the desired changes

Most changes fall into a couple of categories:

One thing to be aware of is that we must not break backwards compatibility with other mods. This has been a bit of an issue recently (#87, #76), so we must be sure to test the changes work with Computronics and Plethora.

If people do encounter issues with their add-on, do file a report, and I'll add it to the "to test" list.

List of (desired) changes

Archive

Mostly so I can feel happy about the "progress" made, without filling up the issue.

- [x] Remove CCEdu integration (4ead319092fc35608d48a337246af1034038f961) - [x] Refactor upgrades to share more code (dd6bab541383c652394eb9f937808cbc61a20530) - [x] Replace `DirectionUtil` with `EnumFacing` methods (a1c4a9fb588df17f4672c1088316de24f192a006) - [x] Replace `WorldUtil` with builtin alternatives (4d5c52bc635a084d75aada9f263b71d0ce881870). - [x] Replace current `ComputerCraftPacket` with multiple, more-specific `IMessage`s. We'll have to be careful here that this doesn't increase the packet size when sending terminals (which is by far-and-large the biggest packet). (42d3901ee37892e259de26ebb57cf59ce284416e) - [x] Make the registration model closer to that of Forge's? Namely, move the packet ID into the registration, rather than the class. (ce0685c31f7315d15d3250c6c8605171b33aa99f) - [x] Replace pocket computer model overrides with a custom property and JSON. (37e25136ed90e40495db6c9f8100e10ef0887efb) - [x] Move several methods from `TileGeneric` onto more specific tile entities or blocks. Off the top of my head: explosion resistance, bounding box, maybe pick block? (2c87e66db86f79a60b80da69155ad52a8659dd9b) - [x] Move modems, and associated code into separate `wired`/`wireless` packages. (364d31465e784d4c0f5cffd843cd92edb8e329cf) - [x] Move as much API code out of `ComputerCraft` as possible. We'll have to be careful to preserve the peripheral list, as Plethora and Computronics reflect into that. (41a320e9a405ac4d2c66a8c338257d7a669c6925) - [x] Try to reduce the surface-area that the proxies cover. (26ba61097bf99aa050e5ad20849c75e59d8703f8, f8b328a048a975a768778886f6cd7b633140567d, 41a320e9a405ac4d2c66a8c338257d7a669c6925). - [x] Move some inventory code into a parent interface. (57fb77d7fe90a61afc7fbee007c8328e4432a13e) - [x] Replace BlockCable's cable state with JSON, as we have on the Fabric branch. (f61f7df2d8c909efbdb3d1a3e6810a414df1745f) - [x] Define recipes in JSON rather than in code. (618c534d81d933753304531724f61707a990609a) - [x] Clean up of what items printers can accept? (46fa798797ecc5b5470a1094866e31420a49bcde) - [x] Replace `EntityItem` spawning with the version in `WorldUtil`. (77666d73995614322a1894f9a794e852b11c177c) - [x] Make speakers (and modems) use `Vec3d` instead of their current wacky positioning. (77666d73995614322a1894f9a794e852b11c177c) - [x] Can we move some tiles away from `TilePeripheralBase`? Namely ones which don't depend on `BlockPeripheralBase` - [x] Use `@Mod.EventBusSubscriber` a little more. We'd have to make some classes static instead of singletons, but that's fine. (5d97b9c8f39db881c1cac9bd85a2a100e3e7b0e6) - [x] ^ On a related note, move block/item registration into something separate from the proxies. (63691707fc06ca33a21a3490448b25cc156e7d8f) - [x] Rethink block drops. We have to manually specify all block's drops, and it gets awfully confusing. - [x] Make `load`/`loadstring` do the prefix appending on the Lua side. - [x] Register an implementation of JEI's `IRecipeRegistryPlugin` for various dynamic recipes, instead of generating a load of them. We should perhaps think about how this works with the recipe book (if that matters). (41429bdc0b73027ededef9f75e9b0c484a255d39) - [x] Use the native "can use command block" checks, rather than our own. (cbfd5aeeeea43291381acaf203b41e5439157e7e)
SquidDev commented 4 years ago

At this point the big things have been done, and the remaining things haven't ended up being that important.