This Rocks 1.7.0 - 1.19.4, Bamboo, Mangrove & Cherry Sticks

- Update to 1.19.4
- Add bamboo, mangrove and cherry sticks that generate in their respective biomes
- Overhaul config
- Generation is now JSON-based
- Fix #34 (Geysers pushing with blocks in-between)
This commit is contained in:
Motschen
2023-04-13 21:03:55 +02:00
parent ae97a76d0b
commit 8db267300a
55 changed files with 952 additions and 147 deletions

View File

@@ -1,5 +1,6 @@
package eu.midnightdust.motschen.rocks;
import com.google.common.collect.Lists;
import eu.midnightdust.motschen.rocks.block.*;
import eu.midnightdust.motschen.rocks.block.blockentity.BlockEntityInit;
import eu.midnightdust.motschen.rocks.blockstates.RockVariation;
@@ -12,10 +13,12 @@ import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.block.Block;
import net.minecraft.item.*;
import net.minecraft.resource.featuretoggle.FeatureFlags;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.Identifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static eu.midnightdust.motschen.rocks.RocksRegistryUtils.registerBlockWithItem;
@@ -46,6 +49,9 @@ public class RocksMain implements ModInitializer {
public static Block AcaciaStick = new Stick();
public static Block JungleStick = new Stick();
public static Block DarkOakStick = new Stick();
public static Block MangroveStick = new Stick();
public static Block CherryStick = new Stick();
public static Block BambooStick = new Stick();
public static Block CrimsonStick = new Stick();
public static Block WarpedStick = new Stick();
@@ -65,6 +71,7 @@ public class RocksMain implements ModInitializer {
public static Item NetherrackSplitter = new Item(new Item.Settings());
public static Item SoulSoilSplitter = new Item(new Item.Settings());
public static List<ItemStack> groupItems = new ArrayList<>();
public static ItemStack cherryStack;
public static ItemGroup RocksGroup;
@Override
@@ -88,6 +95,9 @@ public class RocksMain implements ModInitializer {
registerBlockWithItem(new Identifier(MOD_ID,"acacia_stick"), AcaciaStick);
registerBlockWithItem(new Identifier(MOD_ID,"jungle_stick"), JungleStick);
registerBlockWithItem(new Identifier(MOD_ID,"dark_oak_stick"), DarkOakStick);
registerBlockWithItem(new Identifier(MOD_ID,"mangrove_stick"), MangroveStick);
registerBlockWithItem(new Identifier(MOD_ID,"cherry_stick"), CherryStick);
registerBlockWithItem(new Identifier(MOD_ID,"bamboo_stick"), BambooStick);
registerBlockWithItem(new Identifier(MOD_ID,"crimson_stick"), CrimsonStick);
registerBlockWithItem(new Identifier(MOD_ID,"warped_stick"), WarpedStick);
@@ -109,7 +119,9 @@ public class RocksMain implements ModInitializer {
registerItem(new Identifier(MOD_ID,"soul_soil_splitter"), SoulSoilSplitter);
RocksGroup = FabricItemGroup.builder(new Identifier(MOD_ID, "rocks")).icon(() -> new ItemStack(RocksMain.Rock)).entries(((displayContext, entries) -> {
entries.addAll(groupItems);
List<ItemStack> visibleGroupItems = new ArrayList<>(groupItems);
if (!displayContext.enabledFeatures().contains(FeatureFlags.UPDATE_1_20)) visibleGroupItems.remove(cherryStack);
entries.addAll(visibleGroupItems);
})).build();
new FeatureRegistry<>();
FeatureInjector.init();

View File

@@ -17,7 +17,11 @@ public class RocksRegistryUtils {
public static void registerItem(Identifier id, Item item) {
Registry.register(Registries.ITEM, id, item);
if (id.equals(new Identifier(RocksMain.MOD_ID, "starfish"))) putStarfishItems(item);
else RocksMain.groupItems.add(new ItemStack(item));
else {
ItemStack itemStack = new ItemStack(item);
RocksMain.groupItems.add(itemStack);
if (id.equals(new Identifier(RocksMain.MOD_ID, "cherry_stick"))) RocksMain.cherryStack = itemStack;
}
}
private static void putStarfishItems(Item starfish) {
ItemStack redStarfish = new ItemStack(starfish);

View File

@@ -80,7 +80,7 @@ public class Starfish extends Block implements Waterloggable {
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(STARFISH_VARIATION,WATERLOGGED);
builder.add(STARFISH_VARIATION, WATERLOGGED);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {

View File

@@ -8,7 +8,9 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
@@ -26,16 +28,17 @@ public class Stick extends Block {
private static final VoxelShape SHAPE;
private static final EnumProperty<StickVariation> STICK_VARIATION = RocksMain.STICK_VARIATION;
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public Stick() {
super(FabricBlockSettings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(STICK_VARIATION, StickVariation.SMALL));
this.setDefaultState(this.stateManager.getDefaultState().with(STICK_VARIATION, StickVariation.SMALL).with(WATERLOGGED, false));
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(STICK_VARIATION, StickVariation.SMALL);
.with(STICK_VARIATION, StickVariation.SMALL).with(WATERLOGGED, false);
}
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (player.isCreative()) {
@@ -55,7 +58,7 @@ public class Stick extends Block {
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(STICK_VARIATION);
builder.add(STICK_VARIATION, WATERLOGGED);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {

View File

@@ -2,6 +2,7 @@ package eu.midnightdust.motschen.rocks.block.blockentity;
import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.block.NetherGeyser;
import eu.midnightdust.motschen.rocks.config.RocksConfig;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -26,9 +27,11 @@ public class NetherGeyserBlockEntity extends BlockEntity {
if (player != null) {
world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, true));
player.damage(world.getDamageSources().onFire(), 1);
if (player2 != null) {
player2.damage(world.getDamageSources().onFire(), 4);
if (RocksConfig.netherGeyserDamage) {
player.damage(world.getDamageSources().onFire(), 1);
if (player2 != null) {
player2.damage(world.getDamageSources().onFire(), 4);
}
}
blockEntity.countdown = 1000;
} else {

View File

@@ -2,13 +2,17 @@ package eu.midnightdust.motschen.rocks.block.blockentity;
import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.block.OverworldGeyser;
import eu.midnightdust.motschen.rocks.config.RocksConfig;
import net.minecraft.block.BlockState;
import net.minecraft.block.GrassBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockStateRaycastContext;
import net.minecraft.world.World;
public class OverworldGeyserBlockEntity extends BlockEntity {
@@ -24,12 +28,13 @@ public class OverworldGeyserBlockEntity extends BlockEntity {
PlayerEntity player = world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3, true);
PlayerEntity player2 = world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 8, true);
if (player2 != null && player2.getY() >= pos.getY() && player2.getY() <= pos.getY() + 5 && (pos.getX() <= player2.getX() && pos.getX() + 1 >= player2.getX()) && (pos.getZ() <= player2.getZ() && pos.getZ() + 1 >= player2.getZ())) {
if (RocksConfig.geyserLevitation && player2 != null && (player2.getBlockPos().equals(pos) || world.raycast(new BlockStateRaycastContext(pos.toCenterPos(), player2.getPos(), blockState -> !blockState.isAir() && !blockState.isOf(RocksMain.Geyser))).getType() == HitResult.Type.MISS) && player2.getY() >= pos.getY() && player2.getY() <= pos.getY() + 5 && (pos.getX() <= player2.getX() && pos.getX() + 1 >= player2.getX()) && (pos.getZ() <= player2.getZ() && pos.getZ() + 1 >= player2.getZ())) {
player2.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 2, 10, true, false, false));
}
if (player != null) {
world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, true));
if (world.getBlockState(pos.down()).getBlock() instanceof GrassBlock) world.setBlockState(pos.down(), world.getBlockState(pos.down()).with(GrassBlock.SNOWY, true));
blockEntity.countdown = 1000;
} else {
if (blockEntity.countdown > 0) {

View File

@@ -5,36 +5,43 @@ import eu.midnightdust.lib.config.MidnightConfig;
public class RocksConfig extends MidnightConfig {
public final static String rocks = "rocks";
@Comment(category = rocks) public static Comment needs_restart;
@Comment(category = rocks, centered = true) public static Comment needs_restart;
@Entry(category = rocks, name = "block.rocks.rock") public static boolean rock = true;
@Entry(category = rocks, name = "block.rocks.granite_rock") public static boolean granite_rock = true;
@Entry(category = rocks, name = "block.rocks.diorite_rock") public static boolean diorite_rock = true;
@Entry(category = rocks, name = "block.rocks.andesite_rock") public static boolean andesite_rock = true;
@Entry(category = rocks, name = "block.rocks.sand_rock") public static boolean sand_rock = true;
@Entry(category = rocks, name = "block.rocks.red_sand_rock") public static boolean red_sand_rock = true;
@Entry(category = rocks, name = "block.rocks.gravel_rock") public static boolean gravel_rock = true;
@Entry(category = rocks, name = "block.rocks.end_stone_rock") public static boolean end_stone_rock = true;
@Entry(category = rocks, name = "block.rocks.netherrack_rock") public static boolean netherrack_rock = true;
@Entry(category = rocks, name = "block.rocks.soul_soil_rock") public static boolean soul_soil_rock = true;
@Entry(category = rocks, name = "block.rocks.granite_rock") public static boolean graniteRock = true;
@Entry(category = rocks, name = "block.rocks.diorite_rock") public static boolean dioriteRock = true;
@Entry(category = rocks, name = "block.rocks.andesite_rock") public static boolean andesiteRock = true;
@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.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;
public final static String sticks = "sticks";
@Comment(category = sticks) public static Comment needs_restart1;
@Entry(category = sticks, name = "block.rocks.oak_stick") public static boolean oak_stick = true;
@Entry(category = sticks, name = "block.rocks.spruce_stick") public static boolean spruce_stick = true;
@Entry(category = sticks, name = "block.rocks.birch_stick") public static boolean birch_stick = true;
@Entry(category = sticks, name = "block.rocks.acacia_stick") public static boolean acacia_stick = true;
@Entry(category = sticks, name = "block.rocks.jungle_stick") public static boolean jungle_stick = true;
@Entry(category = sticks, name = "block.rocks.dark_oak_stick") public static boolean dark_oak_stick = true;
@Entry(category = sticks, name = "block.rocks.crimson_stick") public static boolean crimson_stick = true;
@Entry(category = sticks, name = "block.rocks.warped_stick") public static boolean warped_stick = true;
@Comment(category = sticks, centered = true) public static Comment needs_restart1;
@Entry(category = sticks, name = "block.rocks.oak_stick") public static boolean oakStick = true;
@Entry(category = sticks, name = "block.rocks.spruce_stick") public static boolean spruceStick = true;
@Entry(category = sticks, name = "block.rocks.birch_stick") public static boolean birchStick = true;
@Entry(category = sticks, name = "block.rocks.acacia_stick") public static boolean acaciaStick = true;
@Entry(category = sticks, name = "block.rocks.jungle_stick") public static boolean jungleStick = true;
@Entry(category = sticks, name = "block.rocks.dark_oak_stick") public static boolean darkOakStick = true;
@Entry(category = sticks, name = "block.rocks.mangrove_stick") public static boolean mangroveStick = true;
@Entry(category = sticks, name = "block.rocks.cherry_stick") public static boolean cherryStick = true;
@Entry(category = sticks, name = "block.rocks.bamboo_stick") public static boolean bambooStick = true;
@Entry(category = sticks, name = "block.rocks.crimson_stick") public static boolean crimsonStick = true;
@Entry(category = sticks, name = "block.rocks.warped_stick") public static boolean warpedStick = true;
public final static String misc = "misc";
@Comment(category = misc) public static Comment needs_restart2;
@Comment(category = misc, centered = true) public static Comment needs_restart2;
@Entry(category = misc, name = "block.rocks.pinecone") public static boolean pinecone = true;
@Entry(category = misc, name = "block.rocks.geyser") public static boolean geyser = true;
@Entry(category = misc, name = "block.rocks.nether_geyser") public static boolean nether_geyser = true;
@Entry(category = misc, name = "block.rocks.nether_geyser") public static boolean netherGeyser = true;
@Entry(category = misc, name = "block.rocks.seashell") public static boolean seashell = true;
@Entry(category = misc, name = "block.rocks.starfish") public static boolean starfish = true;
@Entry(category = misc) public static boolean underwater_seashell = true;
@Entry(category = misc) public static boolean underwater_starfish = true;
@Entry(category = misc) public static boolean underwaterSeashell = true;
@Entry(category = misc) public static boolean underwaterStarfish = true;
public final static String effects = "effects";
@Entry(category = effects) public static boolean geyserLevitation = true;
@Entry(category = effects) public static boolean netherGeyserDamage = true;
}

View File

@@ -21,18 +21,18 @@ public class FeatureInjector {
!ctx.hasTag(BiomeTags.IS_NETHER) && !ctx.hasTag(BiomeTags.END_CITY_HAS_STRUCTURE) && !ctx.hasTag(BiomeTags.IS_BEACH) && !ctx.hasTag(BiomeTags.DESERT_PYRAMID_HAS_STRUCTURE)
&& !ctx.hasTag(BiomeTags.IS_BADLANDS) && !ctx.hasTag(BiomeTags.IGLOO_HAS_STRUCTURE) && !ctx.hasTag(BiomeTags.IS_OCEAN));
if (RocksConfig.rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("rock"));
if (RocksConfig.granite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("granite_rock"));
if (RocksConfig.diorite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("diorite_rock"));
if (RocksConfig.andesite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("andesite_rock"));
if (RocksConfig.graniteRock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("granite_rock"));
if (RocksConfig.dioriteRock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("diorite_rock"));
if (RocksConfig.andesiteRock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("andesite_rock"));
Predicate<BiomeSelectionContext> sand_rocks = (ctx -> ctx.hasTag(BiomeTags.IS_BEACH) || ctx.hasTag(BiomeTags.DESERT_PYRAMID_HAS_STRUCTURE) || ctx.hasTag(BiomeTags.IS_BADLANDS) || ctx.getBiomeKey().getValue().toString().contains("terrestria:lush_desert"));
if (RocksConfig.sand_rock) BiomeModifications.addFeature(sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("sand_rock"));
if (RocksConfig.sandRock) BiomeModifications.addFeature(sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("sand_rock"));
Predicate<BiomeSelectionContext> red_sand_rocks = (ctx -> ctx.hasTag(BiomeTags.IS_BADLANDS) || ctx.hasTag(BiomeTags.DESERT_PYRAMID_HAS_STRUCTURE) || ctx.getBiomeKey().getValue().toString().contains("terrestria:lush_desert"));
if (RocksConfig.red_sand_rock) BiomeModifications.addFeature(red_sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("red_sand_rock"));
if (RocksConfig.redSandRock) BiomeModifications.addFeature(red_sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("red_sand_rock"));
if (RocksConfig.end_stone_rock) BiomeModifications.addFeature(ctx -> ctx.getBiomeKey().getValue().toString().contains("the_end"), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("end_stone_rock"));
if (RocksConfig.endStoneRock) BiomeModifications.addFeature(ctx -> ctx.getBiomeKey().getValue().toString().contains("the_end"), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("end_stone_rock"));
// Sticks
Predicate<BiomeSelectionContext> oak_sticks = (ctx -> {
@@ -41,27 +41,36 @@ public class FeatureInjector {
name.contains("minecraft:wooded_mountains") || name.contains("minecraft:plains") ||
name.contains("minecraft:flower_forest") || name.contains("minecraft:wooded_badlands_plateau") ||
name.contains("minecraft:modified_wooded_badlands_plateau") || ctx.hasTag(BiomeTags.SWAMP_HUT_HAS_STRUCTURE);});
if (RocksConfig.oak_stick) BiomeModifications.addFeature(oak_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("oak_stick"));
if (RocksConfig.oakStick) BiomeModifications.addFeature(oak_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("oak_stick"));
Predicate<BiomeSelectionContext> birch_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
return name.contains("minecraft:forest") || name.contains("birch") || name.contains("minecraft:flower_forest");});
if (RocksConfig.birch_stick) BiomeModifications.addFeature(birch_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("birch_stick"));
if (RocksConfig.birchStick) BiomeModifications.addFeature(birch_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("birch_stick"));
Predicate<BiomeSelectionContext> spruce_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
return name.contains("minecraft:wooded_mountains") || ctx.hasTag(BiomeTags.IS_TAIGA);});
if (RocksConfig.spruce_stick) BiomeModifications.addFeature(spruce_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("spruce_stick"));
if (RocksConfig.spruceStick) BiomeModifications.addFeature(spruce_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("spruce_stick"));
if (RocksConfig.acacia_stick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.VILLAGE_SAVANNA_HAS_STRUCTURE), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("acacia_stick"));
if (RocksConfig.acaciaStick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.VILLAGE_SAVANNA_HAS_STRUCTURE), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("acacia_stick"));
if (RocksConfig.jungle_stick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_JUNGLE), GenerationStep.Feature.UNDERGROUND_DECORATION, getKey("jungle_stick"));
if (RocksConfig.jungleStick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_JUNGLE), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("jungle_stick"));
if (RocksConfig.bambooStick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_JUNGLE), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("bamboo_stick"));
Predicate<BiomeSelectionContext> dark_oak_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
return name.contains("minecraft:dark_forest") || name.contains("minecraft:dark_forest_hills") ||
name.contains("minecraft:dark_forest_mountains");});
if (RocksConfig.dark_oak_stick) BiomeModifications.addFeature(dark_oak_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("dark_oak_stick"));
if (RocksConfig.darkOakStick) BiomeModifications.addFeature(dark_oak_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("dark_oak_stick"));
Predicate<BiomeSelectionContext> mangrove_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
return name.contains("minecraft:mangrove_swamp");});
if (RocksConfig.mangroveStick) BiomeModifications.addFeature(mangrove_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("mangrove_stick"));
Predicate<BiomeSelectionContext> cherry_sticks = (ctx -> {
String name = ctx.getBiomeKey().getValue().toString();
return name.contains("minecraft:cherry_grove");});
if (RocksConfig.cherryStick) BiomeModifications.addFeature(cherry_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("cherry_stick"));
// Misc
Predicate<BiomeSelectionContext> beach = (ctx -> {
@@ -70,17 +79,17 @@ 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.underwater_starfish) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_OCEAN), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("underwater_starfish"));
if (RocksConfig.underwater_seashell) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_OCEAN), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("underwater_seashell"));
if (RocksConfig.underwaterStarfish) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_OCEAN), 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.netherrack_rock) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("netherrack_rock"));
if (RocksConfig.soul_soil_rock) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("soul_soil_rock"));
if (RocksConfig.gravel_rock) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("nether_gravel_rock"));
if (RocksConfig.nether_geyser) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("nether_geyser"));
if (RocksConfig.warped_stick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("warped_stick"));
if (RocksConfig.crimson_stick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("crimson_stick"));
if (RocksConfig.netherrackRock) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("netherrack_rock"));
if (RocksConfig.soulSoilRock) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("soul_soil_rock"));
if (RocksConfig.gravelRock) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("nether_gravel_rock"));
if (RocksConfig.netherGeyser) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("nether_geyser"));
if (RocksConfig.warpedStick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("warped_stick"));
if (RocksConfig.crimsonStick) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("crimson_stick"));
if (RocksConfig.gravel_rock) BiomeModifications.addFeature(ctx -> !ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("gravel_rock"));
if (RocksConfig.gravelRock) BiomeModifications.addFeature(ctx -> !ctx.hasTag(BiomeTags.IS_NETHER), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("gravel_rock"));
if (RocksConfig.geyser) BiomeModifications.addFeature(ctx -> ctx.hasTag(BiomeTags.IGLOO_HAS_STRUCTURE) || ctx.getBiomeKey().toString().contains("snowy"), GenerationStep.Feature.TOP_LAYER_MODIFICATION, getKey("snowy_geyser"));
}

View File

@@ -82,7 +82,7 @@ public class RockFeatures {
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))))));
public static PlacedFeature SAND_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(SAND_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.SAND, Blocks.SANDSTONE))))));
public static PlacedFeature RED_SAND_ROCK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(RED_SAND_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.RED_SAND, Blocks.RED_SANDSTONE))))));
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))))));

View File

@@ -3,13 +3,14 @@ package eu.midnightdust.motschen.rocks.world.configured_feature;
import com.google.common.collect.ImmutableList;
import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.blockstates.StickVariation;
import eu.midnightdust.motschen.rocks.config.RocksConfig;
import eu.midnightdust.motschen.rocks.world.FeatureRegistry;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.registry.Registerable;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.collection.DataPool;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.gen.ProbabilityConfig;
import net.minecraft.world.gen.blockpredicate.BlockPredicate;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.placementmodifier.*;
@@ -57,13 +58,35 @@ public class StickFeatures {
.add(RocksMain.DarkOakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.add(RocksMain.DarkOakStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()))
);
public static ConfiguredFeature<?, ?> MANGROVE_STICK_FEATURE = new ConfiguredFeature<>(Feature.SIMPLE_BLOCK, new SimpleBlockFeatureConfig(
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.add(RocksMain.MangroveStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.add(RocksMain.MangroveStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.add(RocksMain.MangroveStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()))
);
public static ConfiguredFeature<?, ?> CHERRY_STICK_FEATURE = new ConfiguredFeature<>(Feature.SIMPLE_BLOCK, new SimpleBlockFeatureConfig(
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.add(RocksMain.CherryStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.add(RocksMain.CherryStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.add(RocksMain.CherryStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()))
);
public static ConfiguredFeature<?, ?> BAMBOO_STICK_FEATURE = new ConfiguredFeature<>(Feature.SIMPLE_BLOCK, new SimpleBlockFeatureConfig(
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.add(RocksMain.BambooStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.SMALL), 7)
.add(RocksMain.BambooStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
.add(RocksMain.BambooStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()))
);
public static PlacedFeature OAK_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(OAK_STICK_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.GRASS_BLOCK))))));
public static PlacedFeature SPRUCE_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(SPRUCE_STICK_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.GRASS_BLOCK))))));
public static PlacedFeature BIRCH_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(BIRCH_STICK_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.GRASS_BLOCK))))));
public static PlacedFeature ACACIA_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(ACACIA_STICK_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.GRASS_BLOCK))))));
public static PlacedFeature JUNGLE_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(JUNGLE_STICK_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.GRASS_BLOCK))))));
public static PlacedFeature DARK_OAK_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(DARK_OAK_STICK_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.GRASS_BLOCK))))));
public static final List<PlacementModifier> modifiers = 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.GRASS_BLOCK, Blocks.MUD, Blocks.PODZOL)))));
public static PlacedFeature OAK_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(OAK_STICK_FEATURE), modifiers);
public static PlacedFeature SPRUCE_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(SPRUCE_STICK_FEATURE), modifiers);
public static PlacedFeature BIRCH_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(BIRCH_STICK_FEATURE), modifiers);
public static PlacedFeature ACACIA_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(ACACIA_STICK_FEATURE), modifiers);
public static PlacedFeature JUNGLE_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(JUNGLE_STICK_FEATURE), modifiers);
public static PlacedFeature DARK_OAK_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(DARK_OAK_STICK_FEATURE), modifiers);
public static PlacedFeature CHERRY_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(CHERRY_STICK_FEATURE), modifiers);
public static PlacedFeature MANGROVE_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(MANGROVE_STICK_FEATURE), modifiers);
public static PlacedFeature BAMBOO_STICK_PLACED_FEATURE = new PlacedFeature(RegistryEntry.of(BAMBOO_STICK_FEATURE), modifiers);
public static void initConfigured(Registerable<ConfiguredFeature<?, ?>> context) {
register(context, "oak_stick", OAK_STICK_FEATURE);
@@ -72,6 +95,9 @@ public class StickFeatures {
register(context, "acacia_stick", ACACIA_STICK_FEATURE);
register(context, "jungle_stick", JUNGLE_STICK_FEATURE);
register(context, "dark_oak_stick", DARK_OAK_STICK_FEATURE);
register(context, "cherry_stick", CHERRY_STICK_FEATURE);
register(context, "mangrove_stick", MANGROVE_STICK_FEATURE);
register(context, "bamboo_stick", BAMBOO_STICK_FEATURE);
}
public static void initPlaced(Registerable<PlacedFeature> context) {
register(context, "oak_stick", OAK_STICK_PLACED_FEATURE);
@@ -80,5 +106,8 @@ public class StickFeatures {
register(context, "acacia_stick", ACACIA_STICK_PLACED_FEATURE);
register(context, "jungle_stick", JUNGLE_STICK_PLACED_FEATURE);
register(context, "dark_oak_stick", DARK_OAK_STICK_PLACED_FEATURE);
register(context, "cherry_stick", CHERRY_STICK_PLACED_FEATURE);
register(context, "mangrove_stick", MANGROVE_STICK_PLACED_FEATURE);
register(context, "bamboo_stick", BAMBOO_STICK_PLACED_FEATURE);
}
}