| 1 | package net.minecraft.data.worldgen.features;
|
| 2 |
|
| 3 | import net.minecraft.core.Holder;
|
| 4 | import net.minecraft.data.worldgen.BootstrapContext;
|
| 5 | import net.minecraft.resources.ResourceKey;
|
| 6 | import net.minecraft.util.random.WeightedList;
|
| 7 | import net.minecraft.world.level.block.Blocks;
|
| 8 | import net.minecraft.world.level.block.state.BlockState;
|
| 9 | import net.minecraft.world.level.levelgen.feature.BlockPileFeature;
|
| 10 | import net.minecraft.world.level.levelgen.feature.Feature;
|
| 11 | import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
| 12 | import net.minecraft.world.level.levelgen.feature.stateproviders.RotatedBlockProvider;
|
| 13 | import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider;
|
| 14 |
|
| 15 | public class PileFeatures {
|
| 16 | public static final ResourceKey<Feature> PILE_HAY = FeatureUtils.createKey("pile_hay");
|
| 17 | public static final ResourceKey<Feature> PILE_MELON = FeatureUtils.createKey("pile_melon");
|
| 18 | public static final ResourceKey<Feature> PILE_SNOW = FeatureUtils.createKey("pile_snow");
|
| 19 | public static final ResourceKey<Feature> PILE_ICE = FeatureUtils.createKey("pile_ice");
|
| 20 | public static final ResourceKey<Feature> PILE_PUMPKIN = FeatureUtils.createKey("pile_pumpkin");
|
| 21 |
|
| 22 | public static void bootstrap(final BootstrapContext<Feature> context) {
|
| 23 | context.register(PILE_HAY, new BlockPileFeature(Holder.direct(new RotatedBlockProvider(BlockStateProvider.of(Blocks.HAY_BLOCK)))));
|
| 24 | context.register(PILE_MELON, new BlockPileFeature(BlockStateProvider.holderOf(Blocks.MELON)));
|
| 25 | context.register(PILE_SNOW, new BlockPileFeature(BlockStateProvider.holderOf(Blocks.SNOW)));
|
| 26 | context.register(
|
| 27 | PILE_ICE,
|
| 28 | new BlockPileFeature(
|
| 29 | Holder.direct(
|
| 30 | new WeightedStateProvider(WeightedList.<BlockState>builder().add(Blocks.BLUE_ICE.defaultBlockState(), 1).add(Blocks.PACKED_ICE.defaultBlockState(), 5))
|
| 31 | )
|
| 32 | )
|
| 33 | );
|
| 34 | context.register(
|
| 35 | PILE_PUMPKIN,
|
| 36 | new BlockPileFeature(
|
| 37 | Holder.direct(
|
| 38 | new WeightedStateProvider(WeightedList.<BlockState>builder().add(Blocks.PUMPKIN.defaultBlockState(), 19).add(Blocks.JACK_O_LANTERN.defaultBlockState(), 1))
|
| 39 | )
|
| 40 | )
|
| 41 | );
|
| 42 | }
|
| 43 | }
|
| 44 |
|