Allow for placing our saplings in flower pots

This commit is contained in:
Sollace 2024-03-01 23:28:01 +00:00
parent d408f82785
commit df0cc6d225
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
24 changed files with 361 additions and 8 deletions

View file

@ -32,7 +32,8 @@ public record Tree (
TreeFeatureConfig.Builder config,
RegistryKey<ConfiguredFeature<?, ?>> configuredFeatureId,
Set<Placement> placements,
Optional<Block> sapling
Optional<Block> sapling,
Optional<Block> pot
) {
public static final List<Tree> REGISTRY = new ArrayList<>();
@ -133,6 +134,12 @@ public record Tree (
public Tree build() {
RegistryKey<ConfiguredFeature<?, ?>> configuredFeatureId = RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, id);
Optional<Block> sapling = saplingId.map(id -> UBlocks.register(id, saplingConstructor.apply(new SaplingGenerator() {
@Override
protected RegistryKey<ConfiguredFeature<?, ?>> getTreeFeature(Random rng, boolean flowersNearby) {
return configuredFeatureId;
}
}, FabricBlockSettings.copy(Blocks.OAK_SAPLING)), ItemGroups.NATURAL));
Tree tree = new Tree(id, configParameters.apply(new TreeFeatureConfig.Builder(
BlockStateProvider.of(logType),
trunkPlacer,
@ -141,12 +148,8 @@ public record Tree (
size.get()
)), configuredFeatureId, placements.values().stream()
.collect(Collectors.toUnmodifiableSet()),
saplingId.map(id -> UBlocks.register(id, saplingConstructor.apply(new SaplingGenerator() {
@Override
protected RegistryKey<ConfiguredFeature<?, ?>> getTreeFeature(Random rng, boolean flowersNearby) {
return configuredFeatureId;
}
}, FabricBlockSettings.copy(Blocks.OAK_SAPLING)), ItemGroups.NATURAL)));
sapling,
sapling.map(saplingBlock -> Registry.register(Registries.BLOCK, saplingId.get().withPrefixedPath("potted_"), Blocks.createFlowerPotBlock(saplingBlock))));
if (REGISTRY.isEmpty()) {
bootstrap();

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "unicopia:block/potted_golden_oak_sapling"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "unicopia:block/potted_green_apple_sapling"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "unicopia:block/potted_mango_sapling"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "unicopia:block/potted_palm_sapling"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "unicopia:block/potted_sour_apple_sapling"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "unicopia:block/potted_sweet_apple_sapling"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "unicopia:block/potted_zapling"
}
}
}

View file

@ -228,6 +228,7 @@
"block.unicopia.spectral_fire": "Spectral Fire",
"block.unicopia.bananas": "Bananas",
"block.unicopia.zapling": "Zapling",
"block.unicopia.potted_zapling": "Potted Zapling",
"block.unicopia.zap_log": "Zap Apple Log",
"block.unicopia.zap_wood": "Zap Apple Wood",
"block.unicopia.stripped_zap_log": "Stripped Zap Apple Log",
@ -251,6 +252,7 @@
"block.unicopia.zap_apple": "Zap Apple",
"block.unicopia.zap_bulb": "Unripened Zap Apple",
"block.unicopia.palm_sapling": "Palm Sapling",
"block.unicopia.potted_palm_sapling": "Potted Palm Sapling",
"block.unicopia.palm_log": "Palm Log",
"block.unicopia.palm_wood": "Palm Wood",
"block.unicopia.palm_planks": "Palm Planks",
@ -273,11 +275,13 @@
"block.unicopia.gold_root": "Gold Root",
"block.unicopia.golden_oak_sprout": "Golden Oak Sprout",
"block.unicopia.golden_oak_sapling": "Golden Oak Sapling",
"block.unicopia.potted_golden_oak_sapling": "Potted Golden Oak Sapling",
"block.unicopia.golden_oak_leaves": "Golden Oak Leaves",
"block.unicopia.golden_oak_log": "Golden Oak Log",
"block.unicopia.mango": "Mango",
"block.unicopia.mango_leaves": "Mango Leaves",
"block.unicopia.mango_sapling": "Mango Sapling",
"block.unicopia.potted_mango_sapling": "Potted Mango Sapling",
"block.unicopia.pineapple": "Pineapple Plant",
"block.unicopia.clam_shell": "Clam Shell",
@ -286,12 +290,15 @@
"block.unicopia.green_apple_leaves": "Granny Smith Leaves",
"block.unicopia.green_apple_sapling": "Granny Smith Sapling",
"block.unicopia.potted_green_apple_sapling": "Potted Granny Smith Sapling",
"block.unicopia.green_apple_sprout": "Granny Smith Sprout",
"block.unicopia.sweet_apple_leaves": "Sweet Apple Leaves",
"block.unicopia.sweet_apple_sapling": "Sweet Apple Sapling",
"block.unicopia.potted_sweet_apple_sapling": "Potted Sweet Apple Sapling",
"block.unicopia.sweet_apple_sprout": "Sweet Apple Sprout",
"block.unicopia.sour_apple_leaves": "Sour Apple Leaves",
"block.unicopia.sour_apple_sapling": "Sour Apple Sapling",
"block.unicopia.potted_sour_apple_sapling": "Potted Sour Apple Sapling",
"block.unicopia.sour_apple_sprout": "Sour Apple Sprout",
"block.unicopia.surface_chitin": "Surface Chitin",

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/flower_pot_cross",
"textures": {
"plant": "unicopia:block/golden_oak_sapling"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/flower_pot_cross",
"textures": {
"plant": "unicopia:block/green_apple_sapling"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/flower_pot_cross",
"textures": {
"plant": "unicopia:block/mango_sapling"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/flower_pot_cross",
"textures": {
"plant": "unicopia:block/palm_sapling"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/flower_pot_cross",
"textures": {
"plant": "unicopia:block/sour_apple_sapling"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/flower_pot_cross",
"textures": {
"plant": "unicopia:block/sweet_apple_sapling"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/flower_pot_cross",
"textures": {
"plant": "unicopia:block/zapling"
}
}

View file

@ -0,0 +1,36 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:flower_pot"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:golden_oak_sapling"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:blocks/potted_dead_bush"
}

View file

@ -0,0 +1,36 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:flower_pot"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:green_apple_sapling"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:blocks/potted_dead_bush"
}

View file

@ -0,0 +1,36 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:flower_pot"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:mango_sapling"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:blocks/potted_dead_bush"
}

View file

@ -0,0 +1,36 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:flower_pot"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:palm_sapling"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:blocks/potted_dead_bush"
}

View file

@ -0,0 +1,36 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:flower_pot"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:sour_apple_sapling"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:blocks/potted_dead_bush"
}

View file

@ -0,0 +1,36 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:flower_pot"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:sweet_apple_sapling"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:blocks/potted_dead_bush"
}

View file

@ -0,0 +1,36 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:flower_pot"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:zapling"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:blocks/potted_dead_bush"
}