Ice Rocks!

This commit is contained in:
Martin Prokoph
2024-09-17 00:34:28 +02:00
parent da7af06774
commit 34ae7e922b
20 changed files with 256 additions and 21 deletions

View File

@@ -13,6 +13,7 @@ public class RocksConfig extends MidnightConfig {
@Entry(category = rocks, name = "block.rocks.sand_rock") public static boolean sandRock = true;
@Entry(category = rocks, name = "block.rocks.red_sand_rock") public static boolean redSandRock = true;
@Entry(category = rocks, name = "block.rocks.gravel_rock") public static boolean gravelRock = true;
@Entry(category = rocks, name = "block.rocks.ice_rock") public static boolean iceRock = true;
@Entry(category = rocks, name = "block.rocks.end_stone_rock") public static boolean endStoneRock = true;
@Entry(category = rocks, name = "block.rocks.netherrack_rock") public static boolean netherrackRock = true;
@Entry(category = rocks, name = "block.rocks.soul_soil_rock") public static boolean soulSoilRock = true;

View File

@@ -8,8 +8,11 @@ import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BiomeTags;
import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.structure.OceanRuinStructure;
import java.util.function.Predicate;
@@ -32,6 +35,9 @@ public class FeatureInjector {
if (RocksConfig.redSandRock) BiomeModifications.addFeature(red_sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("red_sand_rock"));
Predicate<BiomeSelectionContext> ice_rocks = (ctx -> ctx.hasTag(BiomeTags.IGLOO_HAS_STRUCTURE) || ctx.getBiome().getTemperature() < 0.15F);
if (RocksConfig.iceRock) BiomeModifications.addFeature(ice_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("ice_rock"));
if (RocksConfig.endStoneRock) BiomeModifications.addFeature(ctx -> ctx.getBiomeKey().getValue().toString().contains("the_end"), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("end_stone_rock"));
// Sticks
@@ -79,7 +85,7 @@ public class FeatureInjector {
if (RocksConfig.seashell) BiomeModifications.addFeature(beach, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("seashell"));
if (RocksConfig.starfish) BiomeModifications.addFeature(beach, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("starfish"));
if (RocksConfig.underwaterStarfish) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_OCEAN), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("underwater_starfish"));
if (RocksConfig.underwaterStarfish) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_OCEAN) && !ctx.getBiomeKey().toString().contains("cold"), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("underwater_starfish"));
if (RocksConfig.underwaterSeashell) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_OCEAN), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("underwater_seashell"));
if (RocksConfig.netherrackRock) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("netherrack_rock"));

View File

@@ -77,8 +77,15 @@ public class RockFeatures {
.add(rocksByType.get(RockType.GRAVEL).getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.add(rocksByType.get(RockType.GRAVEL).getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()))
);
public static ConfiguredFeature<?, ?> ICE_ROCK_FEATURE = new ConfiguredFeature<>(Feature.SIMPLE_BLOCK, new SimpleBlockFeatureConfig(
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.add(rocksByType.get(RockType.ICE).getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.TINY), 10)
.add(rocksByType.get(RockType.ICE).getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.SMALL), 7)
.add(rocksByType.get(RockType.ICE).getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.MEDIUM), 5)
.add(rocksByType.get(RockType.ICE).getDefaultState().with(RocksMain.ROCK_VARIATION,RockVariation.LARGE), 1).build()))
);
public static PlacedFeature ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(ROCK_FEATURE), List.of(CountPlacementModifier.of(3), RarityFilterPlacementModifier.of(1), SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.not(BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.ICE,Blocks.SAND,Blocks.RED_SAND,Blocks.END_STONE)))))));
public static PlacedFeature ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(ROCK_FEATURE), List.of(CountPlacementModifier.of(3), RarityFilterPlacementModifier.of(1), SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.not(BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.ICE, Blocks.PACKED_ICE, Blocks.SAND, Blocks.RED_SAND, Blocks.END_STONE)))))));
public static PlacedFeature GRANITE_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(GRANITE_ROCK_FEATURE), List.of(CountPlacementModifier.of(3), RarityFilterPlacementModifier.of(1), SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.GRANITE))))));
public static PlacedFeature DIORITE_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(DIORITE_ROCK_FEATURE), List.of(CountPlacementModifier.of(3), RarityFilterPlacementModifier.of(1), SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.DIORITE))))));
public static PlacedFeature ANDESITE_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(ANDESITE_ROCK_FEATURE), List.of(CountPlacementModifier.of(3), RarityFilterPlacementModifier.of(1), SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.ANDESITE))))));
@@ -86,6 +93,7 @@ public class RockFeatures {
public static PlacedFeature RED_SAND_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(RED_SAND_ROCK_FEATURE), List.of(CountPlacementModifier.of(7), RarityFilterPlacementModifier.of(1), SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.RED_SAND, Blocks.RED_SANDSTONE))))));
public static PlacedFeature END_STONE_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(END_STONE_ROCK_FEATURE), List.of(CountPlacementModifier.of(3), RarityFilterPlacementModifier.of(1), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.END_STONE))))));
public static PlacedFeature GRAVEL_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(GRAVEL_ROCK_FEATURE), List.of(CountPlacementModifier.of(3), RarityFilterPlacementModifier.of(1), SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.GRAVEL))))));
public static PlacedFeature ICE_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(ICE_ROCK_FEATURE), List.of(CountPlacementModifier.of(3), RarityFilterPlacementModifier.of(5), SquarePlacementModifier.of(), PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, BiomePlacementModifier.of(), BlockFilterPlacementModifier.of(BlockPredicate.bothOf(BlockPredicate.IS_AIR, BlockPredicate.matchingBlocks(new Vec3i(0, -1, 0), ImmutableList.of(Blocks.ICE, Blocks.PACKED_ICE, Blocks.BLUE_ICE))))));
public static void initConfigured(Registerable<ConfiguredFeature<?, ?>> context) {
register(context, "rock", ROCK_FEATURE);
@@ -96,6 +104,7 @@ public class RockFeatures {
register(context, "red_sand_rock", RED_SAND_ROCK_FEATURE);
register(context, "end_stone_rock", END_STONE_ROCK_FEATURE);
register(context, "gravel_rock", GRAVEL_ROCK_FEATURE);
register(context, "ice_rock", ICE_ROCK_FEATURE);
}
public static void initPlaced(Registerable<PlacedFeature> context) {
register(context, "rock", ROCK_PLACED_FEATURE);
@@ -106,5 +115,6 @@ public class RockFeatures {
register(context, "red_sand_rock", RED_SAND_ROCK_PLACED_FEATURE);
register(context, "end_stone_rock", END_STONE_ROCK_PLACED_FEATURE);
register(context, "gravel_rock", GRAVEL_ROCK_PLACED_FEATURE);
register(context, "ice_rock", ICE_ROCK_PLACED_FEATURE);
}
}