Commit Graph

17 Commits

Author SHA1 Message Date
Jonathan Coates 2fab1a3054
Minor code style fixups
- Add missing @Override annotations. I can't find a way to enforce this
   with checkstyle - maybe I need spotbugs too D:.
 - Remove superflous "this"es.
2021-06-12 22:18:35 +01:00
Jonathan Coates b90611b4b4 Preserve registration order of upgrades
Makes them display in a more reasonable order within JEI. Closes #647
(note, the title is an entirley separate issue)!
2021-01-15 15:32:11 +00:00
Jonathan Coates e4b0a5b3ce 2020 -> 2021
Oh, the most useless part of my build process.
2021-01-06 17:13:40 +00:00
Jonathan Coates 2f0cae0bc1 Make upgrade recipe requirements a little more lax
- Move some common upgrade code to IUpgradeBase. 99% sure this this
   preserves binary compatibility (on the JVM at least).

 - Instead of requiring the share tag to match, allow upgrades to
   specify their own predicate. IMO this is a little ugly, but required
   to fix #614 as other mods chuck their own NBT on items.
2020-12-23 15:52:33 +00:00
SquidDev 41a1b99f7d Merge branch 'master' into mc-1.14.x 2020-01-13 15:05:50 +00:00
SquidDev 93a9ebc4f6 Happy new year 2020-01-01 00:09:18 +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
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
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 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 41429bdc0b Improve our JEI integration a little bit
- Turtle and pocket computers provide a "creator mod id" based on their
   upgrade(s).
   We track which mod was active when the upgrade was registered, and
   use that to determine the owner. Technically we could use the
   RegistryLocation ID, but this is not always correct (such as
   Plethora's vanilla modules).
 - We show all upgraded turtles/pocket computers in JEI now, rather than
   just CC ones.
 - We provide a custom IRecipeRegistryPlugin for upgrades, which
   provides custom usage/recipes for any upgrade or upgraded item. We
   also hide our generated turtle/pocket computer recipes in order to
   prevent duplicates.
2019-03-16 01:51:12 +00:00
SquidDev 0ce67afcc1 Be less strict in comparing upgrade crafting items
We currently generate the crafting item once when the upgrade is first
created, and cache it for the duration of the game. As the item never
changes throughout the game, and constructing a stack is a little
expensive (we need to fire an event, etc...), the caching is worth
having.

However, some mods may register capabilities after we've constructed our
ItemStack. This means the capability will be present on other items but
not ours, meaning they are not considered equivalent, and thus the item
cannot be equipped.

In order to avoid this, we use compare items using their share-tag, like
Forge's IngredientNBT. This means the items must still be "mostly" the
same (same enchantements, etc...), but allow differing capabilities.

See NillerMedDild/Enigmatica2Expert#655 for the original bug report -
in this case, Astral Sourcery was registering the capability in init,
but we construct upgrades just before then.
2019-01-19 21:57:21 +00:00
SquidDev 63691707fc Move registration methods into a separate class
- All "named" entries (blocks, items, recipes, TEs and pocket/turtle
   upgrades) are registeredin one place.
 - Most client side models/textures are registered in ClientRegistry -
   we can't do item colours or TEs for now, as these aren't event based.
 - A little cleanup to how we handle ItemPocketComputer models.
2019-01-12 17:51:26 +00:00
SquidDev 1c9110b927 Happy new year! 2019-01-01 01:10:18 +00:00
SquidDev 41a320e9a4 Move API registration into separate classes
There's several reasons for this change:
 - Try to make ComputerCraft.java less monolithic by moving
   functionality into separate module-specific classes.
 - Hopefully make the core class less Minecraft dependent, meaning
   emulators are a little less dependent on anything outside of /core.

Note we still need /some/ methods in the main ComputerCraft class in
order to maintain backwards compatibility with Plethora and
Computronics.
2018-12-28 12:40:33 +00:00