Skip to content

Commit

Permalink
Update to 1.19.3 (#50)
Browse files Browse the repository at this point in the history
* Initial port to 1.19.3 (Forge: 44.0.0)

Removed old CreativeMode Tab methods as CreativeMode Tabs now need to be registered via a ModBus event

Updated generated data/asset files
Updated mod metadata files to target latest versions [Forge & pack formats]

And finally a lot of whitespace changes cause IntelliJ decided it wanted to remove them

* Run the Protected Method & Source code data generators

* Delete old deprecated LazySpawnEggItem, Use ForgeSpawnEggItem instead now

* Update to RegistrateAdvancementProvider constructor to match similar pattern of other DataProvider constructors

* Update to RegistrateDataProvider constructor to use the `this` keyword

* Update RegistrateRecipeProvider to longer case recipe serializers to `SimpleCookingSerializer`

* Implement the ItemLike onto ItemProviderEntry

* Reimplement old legacy methods used to assign CreativeModeTabs to Items

* Update README.md to make use of Forge Jar-in-Jar
  • Loading branch information
ApexModder authored Dec 10, 2022
1 parent 9e66065 commit 92a2c47
Show file tree
Hide file tree
Showing 32 changed files with 776 additions and 838 deletions.
77 changes: 39 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,46 +65,29 @@ To get an overview of the different APIs and methods, check out the [Javadocs](h

## Project Setup

Registrate can be installed in the mods folder as a typical dependency, but since it does not have a mod, it can also be shaded. Shading is the recommended way to include Registrate (at least until Forge jar-in-jar is working again).
Registrate can be installed in the mods folder as a typical dependency, but since it does not have a mod, it can also be pre-packaged into your mod. You can do this by making use of Forges Jar-in-Jar system.

This is easiest with the [Gradle Shadow plugin](https://imperceptiblethoughts.com/shadow/). Add the plugin to your buildscript like so:
[See here for more info on Forges Jar-in-Jar system](https://forge.gemwire.uk/wiki/Jar-in-jar).

```gradle
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0'
}
```

**Note: Shadow 5.1+ requires Gradle 5.x. I recommend 5.6 as I know this version works with both Shadow and FG3.**

Once you have the plugin, it needs to be configured. First add a shade configuration,

```gradle
configurations {
shade
}
```

configure the shadowJar task use it, and repackage Registrate classes.
To get started you **MUST** enable the Jar-in-Jar system, you can do this by adding the following code anywhere in your build script:

```gradle
shadowJar {
configurations = [project.configurations.shade]
relocate 'com.tterrag.registrate', 'com.mymod.repack.registrate'
}
jarJar.enable()
```

Then, make sure the shadow jar artifact is reobfuscated.
Then, make sure the jarJar artifact is reobfuscated.

```gradle
```groovy
reobf {
shadowJar {}
jarJar { }
}

tasks.jarJar.finalizedBy('reobfJarJar')
```

Finally, the dependency itself must be added. First add my maven repository,

```gradle
```groovy
repositories {
maven { // Registrate
url "http://maven.tterrag.com/"
Expand All @@ -113,21 +96,39 @@ repositories {
}
```

and then the Registrate dependency to the implementation and shade configurations.
and then the Registrate dependency to the implementation and jarJar configurations.

```gradle
```groovy
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" // This should already be here
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" // This should alread

def registrate = "com.tterrag.registrate:Registrate:MC${minecraft_version}-${registrate_version}"
implementation fg.deobf(registrate)
shade registrate
// MC<minecraft_version>-<registrate_version>
implementation fg.deobf("com.tterrag.registrate:Registrate:MC1.19.3-1.1.6")
// [MC<minecraft_version>,MC<next_minecraft_version>)
jarJar(group: 'com.tterrag.registrate', name: 'Registrate', version: "[MC1.19.3,MC1.20)")
}
```
<details>

To build the jar containing shaded dependencies, use the `shadowJar` task, or configure the task to run automatically when using `build`.

```gradle
build.dependsOn shadowJar
build.dependsOn reobfShadowJar
<summary>Additional JarJar Note</summary>

By default the jar containing your mod & registrate will have a `-all` suffix and the normal jar file will not contain registrate.
You would want to share around this `-all` jar, as that contains registrate and any other libs you have pre-packaged.

You can change this though with the following code, this changes the `-all` jar to no longer have a suffix, and the default main jar to be given a `-slim` suffix.
Essentially swapping the 2 jars [_you now would want to share the jar with no suffix appended_].

```groovy
tasks.jarJar.configure {
// remove '-all' from jarJar jar file
classifier ''
}

jar {
// this now conflicts with jarJar as filenames are the same
// append a `-slim` to this jar, as this jar contains no pre-packaged libs
classifier 'slim'
}
```

</details>
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=1.1.x
minecraft_version=1.19
forge_version=41.0.94
minecraft_version=1.19.3
forge_version=44.0.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19 2022-07-10T13:04:59.963492 Registrate Provider for testmod [Recipes, Advancements, Loot tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
// 1.19.3 2022-12-10T05:50:38.7651973 Registrate Provider for testmod [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
353e0134b90278ff49840165bed05cb48e7fff1b assets/testmod/blockstates/magic_item_model.json
bc6ecd9ef8452b21567c005ab9c626c54a1beeaa assets/testmod/blockstates/testblock.json
069fa0cc9495cbad97a129b3e39bd0bdf0599b28 assets/testmod/blockstates/testfluid.json
Expand All @@ -16,16 +16,16 @@ fb63fdeef603a7edf02010fc963c89e2d41931b6 assets/testmod/models/item/testitem.jso
6cde7304ac9429b0ea7e01078b4846b1cac6a0c8 data/minecraft/tags/blocks/wither_immune.json
ed4dc1c2e1c580f129c041ffd8fcfae1424366a2 data/minecraft/tags/entity_types/raiders.json
e9cec2088093803c7eb2f88bd11693cd261a8e41 data/minecraft/tags/items/beds.json
6f59e226b42f2355554c495192d9c8a6d1908233 data/testmod/advancements/recipes/building_blocks/diamond_block_from_testblock_campfire.json
94e422b2e38eb9270652db4d73f1daeb6e80db0b data/testmod/advancements/recipes/building_blocks/diamond_block_from_testblock_smelting.json
78e08d17bbdd813c55a67144fbab0f2cdf3c4d4c data/testmod/advancements/recipes/building_blocks/diamond_block_from_testblock_smoking.json
02cc1ee3832cda84820fc684e968c72e057aaf6f data/testmod/advancements/recipes/testmod/testblock.json
6f59e226b42f2355554c495192d9c8a6d1908233 data/testmod/advancements/recipes/misc/diamond_block_from_testblock_campfire.json
94e422b2e38eb9270652db4d73f1daeb6e80db0b data/testmod/advancements/recipes/misc/diamond_block_from_testblock_smelting.json
78e08d17bbdd813c55a67144fbab0f2cdf3c4d4c data/testmod/advancements/recipes/misc/diamond_block_from_testblock_smoking.json
02cc1ee3832cda84820fc684e968c72e057aaf6f data/testmod/advancements/recipes/misc/testblock.json
5a4c32cef097232c64807d2ef542cfb4d26f8ae8 data/testmod/advancements/root.json
6505b0a7d20f914197bbdd40f1e503a612fa56d6 data/testmod/loot_tables/blocks/magic_item_model.json
d5e580e33cb3676aa1894ed5e8d61f648e8b3707 data/testmod/loot_tables/blocks/testblock.json
2cb4efd4880fca468777b27fca79a616d46406ec data/testmod/loot_tables/entities/testentity.json
ef017fe8afbc1e704a7cfb4818ece7ba018f9c91 data/testmod/loot_tables/entities/testitem.json
d55bc3c85e8b5abd4d7a30a73091b5bf88ba1a7b data/testmod/recipes/diamond_block_from_testblock_campfire.json
664e66ce409d405ef204a1272584626b0f91287a data/testmod/recipes/diamond_block_from_testblock_smelting.json
f356a7b966dc956be64864d7b6634d1972af19bc data/testmod/recipes/diamond_block_from_testblock_smoking.json
d02dc90621eab47d863886f0719b5fdd7e43d7cb data/testmod/recipes/testblock.json
c91d14245f5fd5864ec4059ed227ea4536ab2920 data/testmod/recipes/diamond_block_from_testblock_campfire.json
412a25e0577438ea314c4d4a4ce4f9f5d2801e6f data/testmod/recipes/diamond_block_from_testblock_smelting.json
c22d4a34962b7dfe162e9ab2ad431b235b57905c data/testmod/recipes/diamond_block_from_testblock_smoking.json
2c27e23727ef2d3dadce3c71cdab5fa75c6cd146 data/testmod/recipes/testblock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "minecraft:campfire_cooking",
"category": "food",
"cookingtime": 600,
"experience": 1.0,
"ingredient": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "minecraft:smelting",
"category": "blocks",
"cookingtime": 200,
"experience": 1.0,
"ingredient": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "minecraft:smoking",
"category": "food",
"cookingtime": 100,
"experience": 1.0,
"ingredient": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"D": {
"item": "minecraft:diamond"
Expand Down
Loading

0 comments on commit 92a2c47

Please sign in to comment.