Fix the key creation for Configured/Placed features

This commit is contained in:
Mrbysco 2024-08-11 20:32:45 +02:00
parent 902b27914d
commit c5e264f685
2 changed files with 14 additions and 2 deletions

View file

@ -1,9 +1,12 @@
package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
@ -14,7 +17,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
import java.util.List;
public class ActuallyConfiguredFeatures {
public static final ResourceKey<ConfiguredFeature<?, ?>> ORE_BLACK_QUARTZ = FeatureUtils.createKey("actuallyadditions:ore_black_quartz");
public static final ResourceKey<ConfiguredFeature<?, ?>> ORE_BLACK_QUARTZ = createKey("ore_black_quartz");
public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context) {
RuleTest stoneRuleTest = new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES);
@ -25,4 +28,8 @@ public class ActuallyConfiguredFeatures {
);
FeatureUtils.register(context, ORE_BLACK_QUARTZ, Feature.ORE, new OreConfiguration(list, 6));
}
private static ResourceKey<ConfiguredFeature<?, ?>> createKey(String name) {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, ActuallyAdditions.modLoc(name));
}
}

View file

@ -1,5 +1,6 @@
package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
@ -17,7 +18,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementModifier;
import java.util.List;
public class ActuallyPlacedFeatures {
public static final ResourceKey<PlacedFeature> PLACED_ORE_BLACK_QUARTZ = PlacementUtils.createKey("actuallyadditions:ore_black_quartz");
public static final ResourceKey<PlacedFeature> PLACED_ORE_BLACK_QUARTZ = createKey("ore_black_quartz");
public static void bootstrap(BootstrapContext<PlacedFeature> context) {
HolderGetter<ConfiguredFeature<?, ?>> holdergetter = context.lookup(Registries.CONFIGURED_FEATURE);
@ -33,4 +34,8 @@ public class ActuallyPlacedFeatures {
private static List<PlacementModifier> commonOrePlacement(int count, PlacementModifier modifier) {
return orePlacement(CountPlacement.of(count), modifier);
}
private static ResourceKey<PlacedFeature> createKey(String name) {
return ResourceKey.create(Registries.PLACED_FEATURE, ActuallyAdditions.modLoc(name));
}
}