Skip to content

Commit

Permalink
tree placed features
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Aug 12, 2024
1 parent d97f9cc commit 11cb875
Show file tree
Hide file tree
Showing 20 changed files with 553 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import net.id.paradiselost.world.feature.configured_features.ParadiseLostMiscConfiguredFeatures;
import net.id.paradiselost.world.feature.placement_modifiers.ChancePlacementModifier;
import net.minecraft.registry.RegistryKey;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.minecraft.world.Heightmap;
import net.minecraft.world.gen.YOffset;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.feature.PlacedFeatures;
import net.minecraft.world.gen.placementmodifier.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import net.id.paradiselost.world.feature.configured_features.ParadiseLostTreeConfiguredFeatures;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluids;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3i;
Expand Down Expand Up @@ -34,8 +36,8 @@ public class ParadiseLostPlacedFeatures {
// for ease of familiarity with how 1.17 did it.
static final PlacementModifier SPREAD_32_ABOVE = HeightRangePlacementModifier.uniform(YOffset.aboveBottom(32), YOffset.getTop());

static RegistryEntry<PlacedFeature> register(String id, RegistryEntry<? extends ConfiguredFeature<?, ?>> feature, PlacementModifier... modifiers) {
return BuiltinRegistries.add(BuiltinRegistries.PLACED_FEATURE, locate(id), new PlacedFeature(RegistryEntry.upcast(feature), List.of(modifiers)));
public static RegistryKey<PlacedFeature> of(String id) {
return RegistryKey.of(RegistryKeys.PLACED_FEATURE, locate(id));
}

public static void init() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,75 +1,34 @@
package net.id.paradiselost.world.feature.placed_features;

import net.id.paradiselost.world.feature.configured_features.ParadiseLostTreeConfiguredFeatures;
import net.id.paradiselost.world.feature.placement_modifiers.ChancePlacementModifier;
import net.minecraft.block.Block;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.minecraft.world.Heightmap;
import net.minecraft.world.gen.blockpredicate.BlockPredicate;
import net.minecraft.registry.RegistryKey;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.placementmodifier.BlockFilterPlacementModifier;
import net.minecraft.world.gen.placementmodifier.CountMultilayerPlacementModifier;
import net.minecraft.world.gen.placementmodifier.CountPlacementModifier;
import net.minecraft.world.gen.placementmodifier.HeightmapPlacementModifier;
import net.minecraft.world.gen.placementmodifier.PlacementModifier;

import java.util.List;

import static net.id.paradiselost.blocks.ParadiseLostBlocks.*;

public class ParadiseLostTreePlacedFeatures extends ParadiseLostPlacedFeatures {
public static final List<Block> PARADISE_LOST_GROUND = List.of(
HIGHLANDS_GRASS, FLOESTONE, MOSSY_FLOESTONE, DIRT, COARSE_DIRT, PERMAFROST
);

/*
Highlands
*/
// Default
public static final RegistryEntry<PlacedFeature> AUREL_TREE = register("aurel_tree", ParadiseLostTreeConfiguredFeatures.AUREL_TREE, placed(AUREL_WOODSTUFF.sapling()));
public static final RegistryEntry<PlacedFeature> MOTHER_AUREL_TREE = register("mother_aurel_tree", ParadiseLostTreeConfiguredFeatures.MOTHER_AUREL_TREE, placed(MOTHER_AUREL_WOODSTUFF.sapling()));
public static final RegistryEntry<PlacedFeature> ORANGE_TREE = register("orange_tree", ParadiseLostTreeConfiguredFeatures.ORANGE_TREE, placed(ORANGE_WOODSTUFF.sapling()));
// Wisteria
public static final RegistryEntry<PlacedFeature> ROSE_WISTERIA_TREE = register("rose_wisteria_tree", ParadiseLostTreeConfiguredFeatures.ROSE_WISTERIA_TREE, placed(ROSE_WISTERIA_SAPLING));
public static final RegistryEntry<PlacedFeature> LAVENDER_WISTERIA_TREE = register("lavender_wisteria_tree", ParadiseLostTreeConfiguredFeatures.LAVENDER_WISTERIA_TREE, placed(LAVENDER_WISTERIA_SAPLING));
public static final RegistryEntry<PlacedFeature> FROST_WISTERIA_TREE = register("frost_wisteria_tree", ParadiseLostTreeConfiguredFeatures.FROST_WISTERIA_TREE, placed(FROST_WISTERIA_SAPLING));
// Fancy
public static final RegistryEntry<PlacedFeature> FANCY_ROSE_WISTERIA_TREE = register("fancy_rose_wisteria_tree", ParadiseLostTreeConfiguredFeatures.FANCY_ROSE_WISTERIA_TREE, placed(ROSE_WISTERIA_SAPLING));
public static final RegistryEntry<PlacedFeature> FANCY_LAVENDER_WISTERIA_TREE = register("fancy_lavender_wisteria_tree", ParadiseLostTreeConfiguredFeatures.FANCY_LAVENDER_WISTERIA_TREE, placed(LAVENDER_WISTERIA_SAPLING));
public static final RegistryEntry<PlacedFeature> FANCY_FROST_WISTERIA_TREE = register("fancy_frost_wisteria_tree", ParadiseLostTreeConfiguredFeatures.FANCY_FROST_WISTERIA_TREE, placed(FROST_WISTERIA_SAPLING));
public static final RegistryEntry<PlacedFeature> FANCY_AUREL_TREE = register("fancy_aurel_tree", ParadiseLostTreeConfiguredFeatures.FANCY_AUREL_TREE, placed(AUREL_WOODSTUFF.sapling()));
// Tree Assortments
public static final RegistryEntry<PlacedFeature> SCATTERED_TREES = register("scattered_trees", ParadiseLostTreeConfiguredFeatures.SCATTERED_TREES, CountMultilayerPlacementModifier.of(6), CountPlacementModifier.of(UniformIntProvider.create(0, 6)));
public static final RegistryEntry<PlacedFeature> SHIELD_TREES = register("shield_trees", ParadiseLostTreeConfiguredFeatures.SHIELD_TREES, CountMultilayerPlacementModifier.of(5), CountPlacementModifier.of(UniformIntProvider.create(0, 6)));
public static final RegistryEntry<PlacedFeature> DENSE_SHIELD_TREES = register("dense_shield_trees", ParadiseLostTreeConfiguredFeatures.DENSE_SHIELD_TREES, CountMultilayerPlacementModifier.of(12), ChancePlacementModifier.of(18));
public static final RegistryEntry<PlacedFeature> PLATEAU_TREES = register("plateau_trees", ParadiseLostTreeConfiguredFeatures.PLATEAU_TREES, ChancePlacementModifier.of(3), CountMultilayerPlacementModifier.of(1), CountPlacementModifier.of(UniformIntProvider.create(0, 1)));
public static final RegistryEntry<PlacedFeature> MIXED_TREES = register("mixed_trees", ParadiseLostTreeConfiguredFeatures.MIXED_TREES, CountMultilayerPlacementModifier.of(1), ChancePlacementModifier.of(30));
public static final RegistryEntry<PlacedFeature> SPARSE_TREES = register("sparse_trees", ParadiseLostTreeConfiguredFeatures.SPARSE_TREES, CountMultilayerPlacementModifier.of(7), ChancePlacementModifier.of(100), CountPlacementModifier.of(UniformIntProvider.create(0, 2)));
public static final RegistryEntry<PlacedFeature> THICKET_TREES = register("thicket_trees", ParadiseLostTreeConfiguredFeatures.THICKET_TREES, CountMultilayerPlacementModifier.of(6), CountPlacementModifier.of(UniformIntProvider.create(0, 3)));
public static final RegistryEntry<PlacedFeature> THICKET_MOTHER_AUREL_TREES = register("thicket_mother_aurel_trees", ParadiseLostTreeConfiguredFeatures.THICKET_MOTHER_AUREL_TREES, CountMultilayerPlacementModifier.of(2), ChancePlacementModifier.of(30));
public static final RegistryEntry<PlacedFeature> RAINBOW_FOREST_TREES = register("wisteria_woods_trees", ParadiseLostTreeConfiguredFeatures.RAINBOW_FOREST_TREES, CountMultilayerPlacementModifier.of(17), CountPlacementModifier.of(UniformIntProvider.create(0, 4)));
public static final RegistryKey<PlacedFeature> SCATTERED_TREES = of("trees_scattered");
public static final RegistryKey<PlacedFeature> SHIELD_TREES = of("trees_shield");
public static final RegistryKey<PlacedFeature> DENSE_SHIELD_TREES = of("trees_dense_shield");
public static final RegistryKey<PlacedFeature> PLATEAU_TREES = of("trees_plateau");
public static final RegistryKey<PlacedFeature> MIXED_TREES = of("trees_mixed");
public static final RegistryKey<PlacedFeature> SPARSE_TREES = of("trees_sparse");
public static final RegistryKey<PlacedFeature> THICKET_TREES = of("trees_thicket");
public static final RegistryKey<PlacedFeature> THICKET_MOTHER_AUREL_TREES = of("trees_thicket_mother_aurel");
public static final RegistryKey<PlacedFeature> RAINBOW_FOREST_TREES = of("trees_rainbow_forest");

// Fallen leaves
public static final RegistryEntry<PlacedFeature> FALLEN_LEAVES = register("fallen_leaves", ParadiseLostTreeConfiguredFeatures.FALLEN_LEAVES, SPREAD_32_ABOVE, PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, CountPlacementModifier.of(3), ChancePlacementModifier.of(5), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));
public static final RegistryEntry<PlacedFeature> ALT_FALLEN_LEAVES = register("alt_fallen_leaves", ParadiseLostTreeConfiguredFeatures.FALLEN_LEAVES, SPREAD_32_ABOVE, PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, CountPlacementModifier.of(3), ChancePlacementModifier.of(5), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));
public static final RegistryKey<PlacedFeature> FALLEN_LEAVES = of("fallen_leaves");
public static final RegistryKey<PlacedFeature> FALLEN_ROSE_LEAVES = of("fallen_rose_leaves");
public static final RegistryKey<PlacedFeature> FALLEN_LAVENDER_LEAVES = of("fallen_lavender_leaves");

public static final RegistryEntry<PlacedFeature> FALLEN_ROSE_LEAVES = register("fallen_rose_leaves", ParadiseLostTreeConfiguredFeatures.FALLEN_ROSE_LEAVES, PlacedFeatures.BOTTOM_TO_TOP_RANGE, ChancePlacementModifier.of(2), CountMultilayerPlacementModifier.of(1), CountPlacementModifier.of(UniformIntProvider.create(0, 3)), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));
public static final RegistryEntry<PlacedFeature> FALLEN_LAVENDER_LEAVES = register("fallen_lavender_leaves", ParadiseLostTreeConfiguredFeatures.FALLEN_LAVENDER_LEAVES, PlacedFeatures.BOTTOM_TO_TOP_RANGE, ChancePlacementModifier.of(2), CountMultilayerPlacementModifier.of(1), CountPlacementModifier.of(UniformIntProvider.create(0, 3)), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));
// Logs & Stumps
public static final RegistryEntry<PlacedFeature> THICKET_FALLEN_LOG = register("thicket_fallen_log", ParadiseLostTreeConfiguredFeatures.THICKET_FALLEN_LOG, ChancePlacementModifier.of(3), CountMultilayerPlacementModifier.of(2), CountPlacementModifier.of(UniformIntProvider.create(0, 2)), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));

public static final RegistryEntry<PlacedFeature> MOTTLED_FALLEN_LOG = register("mottled_fallen_log", ParadiseLostTreeConfiguredFeatures.MOTTLED_FALLEN_LOG, ChancePlacementModifier.of(3), CountMultilayerPlacementModifier.of(1), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));
public static final RegistryEntry<PlacedFeature> MOTTLED_HOLLOW_FALLEN_LOG = register("mottled_hollow_fallen_log", ParadiseLostTreeConfiguredFeatures.MOTTLED_HOLLOW_FALLEN_LOG, ChancePlacementModifier.of(3), CountMultilayerPlacementModifier.of(1), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));

public static final RegistryEntry<PlacedFeature> SHIELD_STUMPS = register("shield_stumps", ParadiseLostTreeConfiguredFeatures.SHIELD_STUMPS, CountMultilayerPlacementModifier.of(1), CountPlacementModifier.of(UniformIntProvider.create(0, 1)), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));
public static final RegistryEntry<PlacedFeature> SHIELD_HOLLOW_STUMPS = register("shield_hollow_stumps", ParadiseLostTreeConfiguredFeatures.SHIELD_HOLLOW_STUMPS, CountMultilayerPlacementModifier.of(1), HeightmapPlacementModifier.of(Heightmap.Type.WORLD_SURFACE));
public static final RegistryKey<PlacedFeature> THICKET_FALLEN_LOG = of("thicket_fallen_log");
public static final RegistryKey<PlacedFeature> MOTTLED_FALLEN_LOG = of("mottled_fallen_log");
public static final RegistryKey<PlacedFeature> MOTTLED_HOLLOW_FALLEN_LOG = of("mottled_hollow_fallen_log");

public static final RegistryEntry<PlacedFeature> SHIELD_FALLEN_LEAVES = register("shield_fallen_leaves", ParadiseLostTreeConfiguredFeatures.SHIELD_FALLEN_LEAVES, PlacedFeatures.BOTTOM_TO_TOP_RANGE, CountMultilayerPlacementModifier.of(2), ChancePlacementModifier.of(4), CountPlacementModifier.of(UniformIntProvider.create(0, 3)), BlockFilterPlacementModifier.of(BlockPredicate.matchingBlocks(PARADISE_LOST_GROUND)));
public static final RegistryKey<PlacedFeature> SHIELD_STUMPS = of("shield_stumps");
public static final RegistryKey<PlacedFeature> SHIELD_HOLLOW_STUMPS = of("shield_hollow_stumps");

private static PlacementModifier placed(Block sapling) {
return PlacedFeatures.wouldSurvive(sapling);
}
public static void init() {}

public static void init() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"feature": "paradise_lost:fallen_lavender_leaves",
"placement": [
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 0
},
"min_inclusive": {
"above_bottom": 32
}
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE"
},
{
"type": "minecraft:count",
"count": 2
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"feature": "paradise_lost:fallen_leaves",
"placement": [
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 0
},
"min_inclusive": {
"above_bottom": 32
}
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE"
},
{
"type": "minecraft:count",
"count": 3
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"feature": "paradise_lost:fallen_rose_leaves",
"placement": [
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 0
},
"min_inclusive": {
"above_bottom": 32
}
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE"
},
{
"type": "minecraft:count",
"count": 2
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"feature": "paradise_lost:mottled_fallen_log",
"placement": [
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 0
},
"min_inclusive": {
"above_bottom": 32
}
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE"
},
{
"type": "minecraft:count",
"count": 2
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"feature": "paradise_lost:mottled_hollow_fallen_log",
"placement": [
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 0
},
"min_inclusive": {
"above_bottom": 32
}
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE"
},
{
"type": "minecraft:count",
"count": 2
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"feature": "paradise_lost:shield_hollow_stumps",
"placement": [
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 0
},
"min_inclusive": {
"above_bottom": 32
}
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE"
},
{
"type": "minecraft:count",
"count": 1
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"feature": "paradise_lost:shield_stumps",
"placement": [
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 0
},
"min_inclusive": {
"above_bottom": 32
}
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE"
},
{
"type": "minecraft:count",
"count": 1
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"feature": "paradise_lost:thicket_fallen_log",
"placement": [
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 0
},
"min_inclusive": {
"above_bottom": 32
}
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE"
},
{
"type": "minecraft:count",
"count": 2
}
]
}
Loading

0 comments on commit 11cb875

Please sign in to comment.