Skip to content

Commit 1c15086

Browse files
committed
Update to 24w07a.
- Update to 24w07a * Rewrite datagen yet again * Update Loom and Gradle * Update Biolith and Terraform API * Update GitHub workflows * Switch to AbstractBlock.Settings.copy * Move more registration to CinderscapesRegistry * Remove duplicate spawn restriction on Ziglins
1 parent f3fc321 commit 1c15086

24 files changed

+431
-316
lines changed

.github/workflows/check_build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ jobs:
1818
runs-on: ${{ matrix.os }}
1919
steps:
2020
- name: Checkout repository
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2222
with:
2323
fetch-depth: 0
2424
- name: Validate Gradle wrapper
25-
uses: gradle/wrapper-validation-action@v1
25+
uses: gradle/wrapper-validation-action@v2
2626
- name: Setup JDK ${{ matrix.java }}
27-
uses: actions/setup-java@v1
27+
uses: actions/setup-java@v4
2828
with:
29+
distribution: 'zulu'
2930
java-version: ${{ matrix.java }}
3031
- name: Make Gradle wrapper executable
3132
if: ${{ runner.os != 'Windows' }}
@@ -36,7 +37,7 @@ jobs:
3637
run: ./gradlew build --stacktrace -x runDatagen
3738
- name: Capture build artifacts
3839
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from LTS java on one OS
39-
uses: actions/upload-artifact@v2
40+
uses: actions/upload-artifact@v4
4041
with:
4142
name: Artifacts
4243
path: build/libs/

.github/workflows/release.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ jobs:
1919
runs-on: ${{ matrix.os }}
2020
steps:
2121
- name: Checkout repository
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525
- name: Create version tag
26-
uses: actions/github-script@v3
26+
uses: actions/github-script@v7
2727
with:
2828
github-token: ${{ github.token }}
2929
script: |
30-
github.git.createRef({
30+
github.rest.git.createRef({
3131
owner: context.repo.owner,
3232
repo: context.repo.repo,
3333
ref: "refs/tags/v${{ github.event.inputs.version }}",
@@ -36,10 +36,11 @@ jobs:
3636
- name: Fetch tags
3737
run: git fetch --tags
3838
- name: Validate Gradle wrapper
39-
uses: gradle/wrapper-validation-action@v1
39+
uses: gradle/wrapper-validation-action@v2
4040
- name: Setup JDK ${{ matrix.java }}
41-
uses: actions/setup-java@v1
41+
uses: actions/setup-java@v4
4242
with:
43+
distribution: 'zulu'
4344
java-version: ${{ matrix.java }}
4445
- name: Make Gradle wrapper executable
4546
if: ${{ runner.os != 'Windows' }}
@@ -58,7 +59,7 @@ jobs:
5859
DISCORD_ANNOUNCEMENT_WEBHOOK: ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}
5960
- name: Capture build artifacts
6061
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from LTS java on one OS
61-
uses: actions/upload-artifact@v2
62+
uses: actions/upload-artifact@v4
6263
with:
6364
name: Artifacts
6465
path: build/libs/

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'maven-publish'
44
id 'idea'
55
id 'eclipse'
6-
id 'fabric-loom' version '1.4.+'
6+
id 'fabric-loom' version '1.5.+'
77
}
88

99
apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.6/ferry.gradle'

common/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ loom {
55

66
runs {
77
datagen {
8-
server()
8+
inherit server
99

1010
name = "Data Generation"
1111
runDir = "build/datagen"
1212

13-
vmArg("-Dfabric-api.datagen")
14-
vmArg("-Dfabric-api.datagen.output-dir=${file("src/main/generated")}")
13+
vmArg "-Dfabric-api.datagen"
14+
vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}"
1515
}
1616
}
1717
}

common/src/main/java/com/terraformersmc/cinderscapes/Cinderscapes.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55
import com.terraformersmc.cinderscapes.item.CinderscapesItemGroups;
66
import net.fabricmc.api.ModInitializer;
77
import net.fabricmc.loader.api.FabricLoader;
8-
import net.minecraft.entity.EntityType;
9-
import net.minecraft.entity.SpawnRestriction;
10-
import net.minecraft.entity.mob.ZoglinEntity;
11-
import net.minecraft.entity.mob.ZombifiedPiglinEntity;
128
import net.minecraft.util.Identifier;
13-
import net.minecraft.world.Heightmap;
149
import org.apache.commons.lang3.StringUtils;
1510
import org.apache.logging.log4j.LogManager;
1611
import org.apache.logging.log4j.Logger;
@@ -26,21 +21,14 @@ public class Cinderscapes implements ModInitializer {
2621

2722
@Override
2823
public void onInitialize() {
29-
try {
30-
SpawnRestriction.register(EntityType.ZOGLIN, SpawnRestriction.Location.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, ZoglinEntity::canMobSpawn);
31-
SpawnRestriction.register(EntityType.ZOMBIFIED_PIGLIN, SpawnRestriction.Location.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, ZombifiedPiglinEntity::canMobSpawn);
32-
} catch (IllegalStateException ignored) { }
33-
3424
CinderscapesConfig.init();
3525

26+
CinderscapesSpawnRestrictions.init();
3627
CinderscapesBlocks.init();
3728
CinderscapesItems.init();
3829
CinderscapesPlacementModifierTypes.init();
3930
CinderscapesFeatures.init();
40-
CinderscapesConfiguredFeatures.init();
41-
CinderscapesPlacedFeatures.init();
4231
CinderscapesSoundEvents.init();
43-
CinderscapesBiomes.init();
4432
CinderscapesTrades.init();
4533
CinderscapesItemGroups.init();
4634

common/src/main/java/com/terraformersmc/cinderscapes/biome/AshyShoalsBiome.java

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
import com.terraformersmc.cinderscapes.init.CinderscapesPlacedFeatures;
44
import com.terraformersmc.cinderscapes.init.CinderscapesSoundEvents;
55
import com.terraformersmc.cinderscapes.mixin.OverworldBiomeCreatorAccessor;
6-
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider;
76
import net.minecraft.client.sound.MusicType;
87
import net.minecraft.entity.EntityType;
98
import net.minecraft.entity.SpawnGroup;
109
import net.minecraft.particle.ParticleTypes;
10+
import net.minecraft.registry.Registerable;
1111
import net.minecraft.registry.Registries;
12+
import net.minecraft.registry.RegistryEntryLookup;
13+
import net.minecraft.registry.RegistryKeys;
1214
import net.minecraft.sound.BiomeAdditionsSound;
1315
import net.minecraft.sound.BiomeMoodSound;
1416
import net.minecraft.sound.SoundEvents;
@@ -19,17 +21,19 @@
1921
import net.minecraft.world.biome.SpawnSettings;
2022
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
2123
import net.minecraft.world.gen.GenerationStep;
24+
import net.minecraft.world.gen.carver.ConfiguredCarver;
2225
import net.minecraft.world.gen.carver.ConfiguredCarvers;
2326
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
2427
import net.minecraft.world.gen.feature.NetherPlacedFeatures;
2528
import net.minecraft.world.gen.feature.OrePlacedFeatures;
29+
import net.minecraft.world.gen.feature.PlacedFeature;
2630

2731
public class AshyShoalsBiome {
2832
public static final MultiNoiseUtil.NoiseHypercube NOISE_POINT = MultiNoiseUtil.createNoiseHypercube(-0.35F, -0.3F, 0.0F, 0.0F, 0.0F, 0.0F, 0.2F);
2933

30-
public static Biome create(FabricDynamicRegistryProvider.Entries entries) {
34+
public static Biome create(Registerable<Biome> registerable) {
3135
return new Biome.Builder()
32-
.generationSettings(createGenerationSettings(entries))
36+
.generationSettings(createGenerationSettings(registerable))
3337
.spawnSettings(createSpawnSettings())
3438
.precipitation(false)
3539
.temperature(2.0F)
@@ -48,8 +52,11 @@ public static Biome create(FabricDynamicRegistryProvider.Entries entries) {
4852
.build();
4953
}
5054

51-
private static GenerationSettings createGenerationSettings(FabricDynamicRegistryProvider.Entries entries) {
52-
GenerationSettings.LookupBackedBuilder builder = new GenerationSettings.LookupBackedBuilder(entries.placedFeatures(), entries.configuredCarvers());
55+
private static GenerationSettings createGenerationSettings(Registerable<Biome> registerable) {
56+
RegistryEntryLookup<ConfiguredCarver<?>> configuredCarvers = registerable.getRegistryLookup(RegistryKeys.CONFIGURED_CARVER);
57+
RegistryEntryLookup<PlacedFeature> placedFeatures = registerable.getRegistryLookup(RegistryKeys.PLACED_FEATURE);
58+
59+
GenerationSettings.LookupBackedBuilder builder = new GenerationSettings.LookupBackedBuilder(placedFeatures, configuredCarvers);
5360

5461
// DEFAULT MINECRAFT FEATURES
5562
builder.carver(GenerationStep.Carver.AIR, ConfiguredCarvers.NETHER_CAVE);
@@ -59,28 +66,28 @@ private static GenerationSettings createGenerationSettings(FabricDynamicRegistry
5966
DefaultBiomeFeatures.addNetherMineables(builder);
6067

6168
// ANCIENT DEBRIS
62-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.DEBRIS_ORE_LARGE));
63-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.DEBRIS_ORE_SMALL));
69+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.DEBRIS_ORE_LARGE));
70+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.DEBRIS_ORE_SMALL));
6471

6572
// REPLACE NETHERRACK
66-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.ASHY_SOUL_SAND));
67-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.ASHY_SOUL_SOIL));
68-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.ASHY_GRAVEL));
73+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.ASHY_SOUL_SAND));
74+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.ASHY_SOUL_SOIL));
75+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.ASHY_GRAVEL));
6976

7077
// ASH PILES
71-
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, entries.ref(CinderscapesPlacedFeatures.ASH_PILES));
78+
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.ASH_PILES));
7279

7380
// FEATURES
74-
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, entries.ref(CinderscapesPlacedFeatures.DEAD_TREES));
81+
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.DEAD_TREES));
7582

7683
// VEGETATION
77-
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, entries.ref(CinderscapesPlacedFeatures.ASHY_VEGETATION));
84+
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.ASHY_VEGETATION));
7885

7986
// BRAMBLE BERRY BUSHES
80-
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, entries.ref(CinderscapesPlacedFeatures.BRAMBLE_BERRY_BUSHES));
87+
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.BRAMBLE_BERRY_BUSHES));
8188

8289
// TOP LAYER MODIFICATION
83-
builder.feature(GenerationStep.Feature.TOP_LAYER_MODIFICATION, entries.ref(CinderscapesPlacedFeatures.ASH_TOP_LAYER));
90+
builder.feature(GenerationStep.Feature.TOP_LAYER_MODIFICATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.ASH_TOP_LAYER));
8491

8592
return builder.build();
8693
}

common/src/main/java/com/terraformersmc/cinderscapes/biome/BlackstoneShalesBiome.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
import com.terraformersmc.cinderscapes.init.CinderscapesPlacedFeatures;
44
import com.terraformersmc.cinderscapes.init.CinderscapesSoundEvents;
55
import com.terraformersmc.cinderscapes.mixin.OverworldBiomeCreatorAccessor;
6-
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider;
76
import net.minecraft.client.sound.MusicType;
87
import net.minecraft.entity.EntityType;
98
import net.minecraft.entity.SpawnGroup;
109
import net.minecraft.particle.ParticleTypes;
10+
import net.minecraft.registry.Registerable;
1111
import net.minecraft.registry.Registries;
12+
import net.minecraft.registry.RegistryEntryLookup;
13+
import net.minecraft.registry.RegistryKeys;
1214
import net.minecraft.sound.BiomeAdditionsSound;
1315
import net.minecraft.sound.BiomeMoodSound;
1416
import net.minecraft.sound.SoundEvents;
@@ -19,18 +21,16 @@
1921
import net.minecraft.world.biome.SpawnSettings;
2022
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
2123
import net.minecraft.world.gen.GenerationStep;
24+
import net.minecraft.world.gen.carver.ConfiguredCarver;
2225
import net.minecraft.world.gen.carver.ConfiguredCarvers;
23-
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
24-
import net.minecraft.world.gen.feature.NetherPlacedFeatures;
25-
import net.minecraft.world.gen.feature.OrePlacedFeatures;
26-
import net.minecraft.world.gen.feature.VegetationPlacedFeatures;
26+
import net.minecraft.world.gen.feature.*;
2727

2828
public class BlackstoneShalesBiome {
2929
public static final MultiNoiseUtil.NoiseHypercube NOISE_POINT = MultiNoiseUtil.createNoiseHypercube(0.10F, -0.05F, 0.0F, 0.0F, 0.0F, 0.00F, 0.0F);
3030

31-
public static Biome create(FabricDynamicRegistryProvider.Entries entries) {
31+
public static Biome create(Registerable<Biome> registerable) {
3232
return new Biome.Builder()
33-
.generationSettings(createGenerationSettings(entries))
33+
.generationSettings(createGenerationSettings(registerable))
3434
.spawnSettings(createSpawnSettings())
3535
.precipitation(false)
3636
.temperature(2.0F)
@@ -49,8 +49,11 @@ public static Biome create(FabricDynamicRegistryProvider.Entries entries) {
4949
.build();
5050
}
5151

52-
private static GenerationSettings createGenerationSettings(FabricDynamicRegistryProvider.Entries entries) {
53-
GenerationSettings.LookupBackedBuilder builder = new GenerationSettings.LookupBackedBuilder(entries.placedFeatures(), entries.configuredCarvers());
52+
private static GenerationSettings createGenerationSettings(Registerable<Biome> registerable) {
53+
RegistryEntryLookup<ConfiguredCarver<?>> configuredCarvers = registerable.getRegistryLookup(RegistryKeys.CONFIGURED_CARVER);
54+
RegistryEntryLookup<PlacedFeature> placedFeatures = registerable.getRegistryLookup(RegistryKeys.PLACED_FEATURE);
55+
56+
GenerationSettings.LookupBackedBuilder builder = new GenerationSettings.LookupBackedBuilder(placedFeatures, configuredCarvers);
5457

5558
// DEFAULT MINECRAFT FEATURES
5659
builder.carver(GenerationStep.Carver.AIR, ConfiguredCarvers.NETHER_CAVE);
@@ -68,15 +71,15 @@ private static GenerationSettings createGenerationSettings(FabricDynamicRegistry
6871
DefaultBiomeFeatures.addAncientDebris(builder);
6972

7073
// VEGETATION
71-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.WEEPING_VINES));
72-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.PATCH_CRIMSON_ROOTS));
74+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.WEEPING_VINES));
75+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.PATCH_CRIMSON_ROOTS));
7376

7477
// NETHERRACK REPLACERS
75-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.SHALES_SOUL_SAND));
76-
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, entries.ref(CinderscapesPlacedFeatures.SHALES_SOUL_SOIL));
78+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.SHALES_SOUL_SAND));
79+
builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.SHALES_SOUL_SOIL));
7780

7881
// SHALES
79-
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, entries.ref(CinderscapesPlacedFeatures.SHALES));
82+
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, placedFeatures.getOrThrow(CinderscapesPlacedFeatures.SHALES));
8083

8184
return builder.build();
8285
}

0 commit comments

Comments
 (0)