Skip to content

Commit

Permalink
Port to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
covers1624 committed Jan 2, 2025
1 parent b30626f commit 2ab1743
Show file tree
Hide file tree
Showing 128 changed files with 813 additions and 1,105 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ plugins {
id 'maven-publish'
id 'signing'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'net.neoforged.gradle.userdev' version '7.0.97'
id 'net.neoforged.gradle.userdev' version '7.0.165'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
withJavadocJar()
Expand Down Expand Up @@ -41,15 +41,15 @@ runs {
}
data {
workingDirectory file('run')
programArguments.addAll '--mod', 'codechickenlib', '--all', '--output', file("src/main/generated").absolutePath, '--existing', file("src/main/resources").absolutePath
arguments.addAll '--mod', 'codechickenlib', '--all', '--output', file("src/main/generated").absolutePath, '--existing', file("src/main/resources").absolutePath
}
}

processResources {
inputs.property 'mod_version', mod_version
inputs.property 'mc_version', mc_version

filesMatching('META-INF/mods.toml') {
filesMatching('META-INF/neoforge.mods.toml') {
expand 'file': ['jarVersion': mod_version],
'mc_version': mc_version,
'forge_version': forge_version,
Expand Down Expand Up @@ -123,6 +123,7 @@ shadowJar {
configurations = [project.configurations.shadow]
from file("LICENSE")
}
assemble.dependsOn shadowJar

tasks.register("signShadowJar") {
dependsOn("shadowJar")
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
org.gradle.daemon=false

mc_version=1.20.4
forge_version=20.4.237
mod_version=4.5.0
jei_version=17.3.0.56
mc_version=1.21.1
forge_version=21.1.72
mod_version=4.6.0
jei_version=19.21.0.246
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.20.1 2024-02-13T15:00:40.20834201 codechickenlib Languages: en_us
// 1.21.1 2024-12-06T17:16:20.755131366 codechickenlib Languages: en_us
d535acbe9649e564744ed63aef209ce1508ec451 assets/codechickenlib/lang/en_us.json
d535acbe9649e564744ed63aef209ce1508ec451 data/codechickenlib/lang/en_us.json
36 changes: 18 additions & 18 deletions src/main/generated/.cache/95d738e2c774c5a4b0452cf55df2775d732b2634
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// 1.20.1 2023-09-08T20:30:19.590475077 CodeChickenLib Block tags.
48ffc90719924738f43a8ea0c526941cbbb83318 data/forge/tags/blocks/wool.json
dc26d59698d238e0c60c400dbffea2ba82af4365 data/forge/tags/blocks/wool/black.json
4b007eca91284e115e6a0c208c8dddbbf0aed7bc data/forge/tags/blocks/wool/blue.json
9f867580ce1e743583fab6a17e3d03248865eafc data/forge/tags/blocks/wool/brown.json
b4b458788e919f93343c36ef996f828bcf610abc data/forge/tags/blocks/wool/cyan.json
62e9def05a24ce6a0f8b7fdb1490d7e856991d47 data/forge/tags/blocks/wool/gray.json
1bdd1be741fcfa89c90c2bf0af6706b6c63139ca data/forge/tags/blocks/wool/green.json
e054a5fe2248aa8c0a7f66d210cb54a639c661f6 data/forge/tags/blocks/wool/light_blue.json
bf7627f1264b6899bedb6f55e19898dad5d03d8c data/forge/tags/blocks/wool/light_gray.json
aceb5be462f62f63438e67877d38c89951e8919e data/forge/tags/blocks/wool/lime.json
cfd0d2c16adae65fbf8640439a1814ab244082cb data/forge/tags/blocks/wool/magenta.json
842c228466435a5cc9221a17f70a778db8617590 data/forge/tags/blocks/wool/orange.json
3ff0870e67b5b9c122d8e59400180e4bd93780a3 data/forge/tags/blocks/wool/pink.json
fec60767247bdbebf6cd451bb3692c9a8ffef908 data/forge/tags/blocks/wool/purple.json
85f94b89b0d20e38f4e9f464fb443064c29f2bf1 data/forge/tags/blocks/wool/red.json
8e71446b54f055edb3ba7a025d4335cb78da1b45 data/forge/tags/blocks/wool/white.json
0de700cdfc12e281290ea7bc709d3241620ec9fb data/forge/tags/blocks/wool/yellow.json
// 1.21.1 2024-12-06T17:16:20.746404632 CodeChickenLib Block tags.
9b9a1318b746e42366ee1747896a1c61d71bc0ae data/c/tags/block/wools.json
dc26d59698d238e0c60c400dbffea2ba82af4365 data/c/tags/block/wools/black.json
4b007eca91284e115e6a0c208c8dddbbf0aed7bc data/c/tags/block/wools/blue.json
9f867580ce1e743583fab6a17e3d03248865eafc data/c/tags/block/wools/brown.json
b4b458788e919f93343c36ef996f828bcf610abc data/c/tags/block/wools/cyan.json
62e9def05a24ce6a0f8b7fdb1490d7e856991d47 data/c/tags/block/wools/gray.json
1bdd1be741fcfa89c90c2bf0af6706b6c63139ca data/c/tags/block/wools/green.json
e054a5fe2248aa8c0a7f66d210cb54a639c661f6 data/c/tags/block/wools/light_blue.json
bf7627f1264b6899bedb6f55e19898dad5d03d8c data/c/tags/block/wools/light_gray.json
aceb5be462f62f63438e67877d38c89951e8919e data/c/tags/block/wools/lime.json
cfd0d2c16adae65fbf8640439a1814ab244082cb data/c/tags/block/wools/magenta.json
842c228466435a5cc9221a17f70a778db8617590 data/c/tags/block/wools/orange.json
3ff0870e67b5b9c122d8e59400180e4bd93780a3 data/c/tags/block/wools/pink.json
fec60767247bdbebf6cd451bb3692c9a8ffef908 data/c/tags/block/wools/purple.json
85f94b89b0d20e38f4e9f464fb443064c29f2bf1 data/c/tags/block/wools/red.json
8e71446b54f055edb3ba7a025d4335cb78da1b45 data/c/tags/block/wools/white.json
0de700cdfc12e281290ea7bc709d3241620ec9fb data/c/tags/block/wools/yellow.json
36 changes: 18 additions & 18 deletions src/main/generated/.cache/f0722e2ccb61f3087e21fc378db7b4f9b32dbea1
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// 1.20.1 2023-09-08T20:30:19.593585402 CodeChickenLib Item tags.
48ffc90719924738f43a8ea0c526941cbbb83318 data/forge/tags/items/wool.json
dc26d59698d238e0c60c400dbffea2ba82af4365 data/forge/tags/items/wool/black.json
4b007eca91284e115e6a0c208c8dddbbf0aed7bc data/forge/tags/items/wool/blue.json
9f867580ce1e743583fab6a17e3d03248865eafc data/forge/tags/items/wool/brown.json
b4b458788e919f93343c36ef996f828bcf610abc data/forge/tags/items/wool/cyan.json
62e9def05a24ce6a0f8b7fdb1490d7e856991d47 data/forge/tags/items/wool/gray.json
1bdd1be741fcfa89c90c2bf0af6706b6c63139ca data/forge/tags/items/wool/green.json
e054a5fe2248aa8c0a7f66d210cb54a639c661f6 data/forge/tags/items/wool/light_blue.json
bf7627f1264b6899bedb6f55e19898dad5d03d8c data/forge/tags/items/wool/light_gray.json
aceb5be462f62f63438e67877d38c89951e8919e data/forge/tags/items/wool/lime.json
cfd0d2c16adae65fbf8640439a1814ab244082cb data/forge/tags/items/wool/magenta.json
842c228466435a5cc9221a17f70a778db8617590 data/forge/tags/items/wool/orange.json
3ff0870e67b5b9c122d8e59400180e4bd93780a3 data/forge/tags/items/wool/pink.json
fec60767247bdbebf6cd451bb3692c9a8ffef908 data/forge/tags/items/wool/purple.json
85f94b89b0d20e38f4e9f464fb443064c29f2bf1 data/forge/tags/items/wool/red.json
8e71446b54f055edb3ba7a025d4335cb78da1b45 data/forge/tags/items/wool/white.json
0de700cdfc12e281290ea7bc709d3241620ec9fb data/forge/tags/items/wool/yellow.json
// 1.21.1 2024-12-06T17:16:20.755323336 CodeChickenLib Item tags.
9b9a1318b746e42366ee1747896a1c61d71bc0ae data/c/tags/item/wools.json
dc26d59698d238e0c60c400dbffea2ba82af4365 data/c/tags/item/wools/black.json
4b007eca91284e115e6a0c208c8dddbbf0aed7bc data/c/tags/item/wools/blue.json
9f867580ce1e743583fab6a17e3d03248865eafc data/c/tags/item/wools/brown.json
b4b458788e919f93343c36ef996f828bcf610abc data/c/tags/item/wools/cyan.json
62e9def05a24ce6a0f8b7fdb1490d7e856991d47 data/c/tags/item/wools/gray.json
1bdd1be741fcfa89c90c2bf0af6706b6c63139ca data/c/tags/item/wools/green.json
e054a5fe2248aa8c0a7f66d210cb54a639c661f6 data/c/tags/item/wools/light_blue.json
bf7627f1264b6899bedb6f55e19898dad5d03d8c data/c/tags/item/wools/light_gray.json
aceb5be462f62f63438e67877d38c89951e8919e data/c/tags/item/wools/lime.json
cfd0d2c16adae65fbf8640439a1814ab244082cb data/c/tags/item/wools/magenta.json
842c228466435a5cc9221a17f70a778db8617590 data/c/tags/item/wools/orange.json
3ff0870e67b5b9c122d8e59400180e4bd93780a3 data/c/tags/item/wools/pink.json
fec60767247bdbebf6cd451bb3692c9a8ffef908 data/c/tags/item/wools/purple.json
85f94b89b0d20e38f4e9f464fb443064c29f2bf1 data/c/tags/item/wools/red.json
8e71446b54f055edb3ba7a025d4335cb78da1b45 data/c/tags/item/wools/white.json
0de700cdfc12e281290ea7bc709d3241620ec9fb data/c/tags/item/wools/yellow.json
20 changes: 20 additions & 0 deletions src/main/generated/data/c/tags/block/wools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"values": [
"#c:wools/white",
"#c:wools/orange",
"#c:wools/magenta",
"#c:wools/light_blue",
"#c:wools/yellow",
"#c:wools/lime",
"#c:wools/pink",
"#c:wools/gray",
"#c:wools/light_gray",
"#c:wools/cyan",
"#c:wools/purple",
"#c:wools/blue",
"#c:wools/brown",
"#c:wools/green",
"#c:wools/red",
"#c:wools/black"
]
}
20 changes: 20 additions & 0 deletions src/main/generated/data/c/tags/item/wools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"values": [
"#c:wools/white",
"#c:wools/orange",
"#c:wools/magenta",
"#c:wools/light_blue",
"#c:wools/yellow",
"#c:wools/lime",
"#c:wools/pink",
"#c:wools/gray",
"#c:wools/light_gray",
"#c:wools/cyan",
"#c:wools/purple",
"#c:wools/blue",
"#c:wools/brown",
"#c:wools/green",
"#c:wools/red",
"#c:wools/black"
]
}
20 changes: 0 additions & 20 deletions src/main/generated/data/forge/tags/blocks/wool.json

This file was deleted.

20 changes: 0 additions & 20 deletions src/main/generated/data/forge/tags/items/wool.json

This file was deleted.

17 changes: 9 additions & 8 deletions src/main/java/codechicken/lib/block/ModularBlockEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import codechicken.lib.block.ModularTileBlock.TileComponent;
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
Expand Down Expand Up @@ -43,24 +44,24 @@ public final <T extends DataComponent> T getData(TileComponent<T> component) {

@Override
@MustBeInvokedByOverriders
protected void saveAdditional(CompoundTag tag) {
super.saveAdditional(tag);
protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) {
super.saveAdditional(tag, registries);

for (DataComponent component : components) {
CompoundTag componentTag = new CompoundTag();
component.save(componentTag);
component.save(componentTag, registries);
tag.put(component.tileComponent.name, componentTag);
}
}

@Override
@MustBeInvokedByOverriders
public void load(CompoundTag tag) {
super.load(tag);
public void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
super.loadAdditional(tag, registries);

for (DataComponent component : components) {
if (tag.contains(component.tileComponent.name)) {
component.load(tag.getCompound(component.tileComponent.name));
component.load(tag.getCompound(component.tileComponent.name), registries);
}
}
}
Expand All @@ -75,10 +76,10 @@ protected DataComponent(ModularBlockEntity tile, TileComponent<?> tileComponent)
this.tileComponent = tileComponent;
}

protected void save(CompoundTag tag) {
protected void save(CompoundTag tag, HolderLookup.Provider registries) {
}

protected void load(CompoundTag tag) {
protected void load(CompoundTag tag, HolderLookup.Provider registries) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import codechicken.lib.block.ModularBlock;
import codechicken.lib.datagen.NoValidationBLockLootSubProvider;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.DataProvider;
import net.minecraft.data.loot.BlockLootSubProvider;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.LootTable;
Expand All @@ -16,7 +14,6 @@
import org.jetbrains.annotations.ApiStatus;

import java.util.ArrayList;
import java.util.Set;
import java.util.function.Consumer;

/**
Expand All @@ -42,7 +39,7 @@ protected void addToProvider(DataProvider p) {
}
provider.subProviders.add(
new LootTableProvider.SubProviderEntry(
() -> new NoValidationBLockLootSubProvider() {
registries -> new NoValidationBLockLootSubProvider(registries) {
@Override
protected void generate() {
add(getBlock(), table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import codechicken.lib.block.ModularTileBlock;
import codechicken.lib.inventory.InventoryUtils;
import codechicken.lib.util.ArrayUtils;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.Container;
Expand Down Expand Up @@ -121,13 +122,13 @@ public int getMaxStackSize() {
}

@Override
protected void save(CompoundTag tag) {
tag.put("Items", InventoryUtils.writeItemStacksToTag(items));
protected void save(CompoundTag tag, HolderLookup.Provider registries) {
tag.put("Items", InventoryUtils.writeItemStacksToTag(registries, items));
}

@Override
protected void load(CompoundTag tag) {
InventoryUtils.readItemStacksFromTag(items, tag.getList("Items", Tag.TAG_COMPOUND));
protected void load(CompoundTag tag, HolderLookup.Provider registries) {
InventoryUtils.readItemStacksFromTag(registries, items, tag.getList("Items", Tag.TAG_COMPOUND));
}
}
}
Loading

0 comments on commit 2ab1743

Please sign in to comment.