diff --git a/.gitignore b/.gitignore index 94183b67..f2cb75bf 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,4 @@ ideas *.iml classes/ out/ -jars/ \ No newline at end of file +jars/ diff --git a/src/main/java/com/minelittlepony/unicopia/server/world/Tree.java b/src/main/java/com/minelittlepony/unicopia/server/world/Tree.java index 7128f919..089b1fd0 100644 --- a/src/main/java/com/minelittlepony/unicopia/server/world/Tree.java +++ b/src/main/java/com/minelittlepony/unicopia/server/world/Tree.java @@ -32,7 +32,8 @@ public record Tree ( TreeFeatureConfig.Builder config, RegistryKey> configuredFeatureId, Set placements, - Optional sapling + Optional sapling, + Optional pot ) { public static final List REGISTRY = new ArrayList<>(); @@ -133,6 +134,12 @@ public record Tree ( public Tree build() { RegistryKey> configuredFeatureId = RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, id); + Optional sapling = saplingId.map(id -> UBlocks.register(id, saplingConstructor.apply(new SaplingGenerator() { + @Override + protected RegistryKey> 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> 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(); diff --git a/src/main/resources/assets/unicopia/blockstates/potted_golden_oak_sapling.json b/src/main/resources/assets/unicopia/blockstates/potted_golden_oak_sapling.json new file mode 100644 index 00000000..0ceb8e14 --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/potted_golden_oak_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/potted_golden_oak_sapling" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/blockstates/potted_green_apple_sapling.json b/src/main/resources/assets/unicopia/blockstates/potted_green_apple_sapling.json new file mode 100644 index 00000000..69b2a3ca --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/potted_green_apple_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/potted_green_apple_sapling" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/blockstates/potted_mango_sapling.json b/src/main/resources/assets/unicopia/blockstates/potted_mango_sapling.json new file mode 100644 index 00000000..427a7b7c --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/potted_mango_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/potted_mango_sapling" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/blockstates/potted_palm_sapling.json b/src/main/resources/assets/unicopia/blockstates/potted_palm_sapling.json new file mode 100644 index 00000000..b73dcef1 --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/potted_palm_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/potted_palm_sapling" + } + } +} diff --git a/src/main/resources/assets/unicopia/blockstates/potted_sour_apple_sapling.json b/src/main/resources/assets/unicopia/blockstates/potted_sour_apple_sapling.json new file mode 100644 index 00000000..00aa2145 --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/potted_sour_apple_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/potted_sour_apple_sapling" + } + } +} diff --git a/src/main/resources/assets/unicopia/blockstates/potted_sweet_apple_sapling.json b/src/main/resources/assets/unicopia/blockstates/potted_sweet_apple_sapling.json new file mode 100644 index 00000000..b8106136 --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/potted_sweet_apple_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/potted_sweet_apple_sapling" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/blockstates/potted_zapling.json b/src/main/resources/assets/unicopia/blockstates/potted_zapling.json new file mode 100644 index 00000000..8e6fa653 --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/potted_zapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/potted_zapling" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index b0c81599..525c448b 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -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", diff --git a/src/main/resources/assets/unicopia/models/block/potted_golden_oak_sapling.json b/src/main/resources/assets/unicopia/models/block/potted_golden_oak_sapling.json new file mode 100644 index 00000000..96ab1741 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/potted_golden_oak_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/flower_pot_cross", + "textures": { + "plant": "unicopia:block/golden_oak_sapling" + } +} diff --git a/src/main/resources/assets/unicopia/models/block/potted_green_apple_sapling.json b/src/main/resources/assets/unicopia/models/block/potted_green_apple_sapling.json new file mode 100644 index 00000000..e9d2b784 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/potted_green_apple_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/flower_pot_cross", + "textures": { + "plant": "unicopia:block/green_apple_sapling" + } +} diff --git a/src/main/resources/assets/unicopia/models/block/potted_mango_sapling.json b/src/main/resources/assets/unicopia/models/block/potted_mango_sapling.json new file mode 100644 index 00000000..40bb156d --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/potted_mango_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/flower_pot_cross", + "textures": { + "plant": "unicopia:block/mango_sapling" + } +} diff --git a/src/main/resources/assets/unicopia/models/block/potted_palm_sapling.json b/src/main/resources/assets/unicopia/models/block/potted_palm_sapling.json new file mode 100644 index 00000000..72cf54e1 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/potted_palm_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/flower_pot_cross", + "textures": { + "plant": "unicopia:block/palm_sapling" + } +} diff --git a/src/main/resources/assets/unicopia/models/block/potted_sour_apple_sapling.json b/src/main/resources/assets/unicopia/models/block/potted_sour_apple_sapling.json new file mode 100644 index 00000000..5a51feda --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/potted_sour_apple_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/flower_pot_cross", + "textures": { + "plant": "unicopia:block/sour_apple_sapling" + } +} diff --git a/src/main/resources/assets/unicopia/models/block/potted_sweet_apple_sapling.json b/src/main/resources/assets/unicopia/models/block/potted_sweet_apple_sapling.json new file mode 100644 index 00000000..3eadea75 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/potted_sweet_apple_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/flower_pot_cross", + "textures": { + "plant": "unicopia:block/sweet_apple_sapling" + } +} diff --git a/src/main/resources/assets/unicopia/models/block/potted_zapling.json b/src/main/resources/assets/unicopia/models/block/potted_zapling.json new file mode 100644 index 00000000..d410f118 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/potted_zapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/flower_pot_cross", + "textures": { + "plant": "unicopia:block/zapling" + } +} diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/potted_golden_oak_sapling.json b/src/main/resources/data/unicopia/loot_tables/blocks/potted_golden_oak_sapling.json new file mode 100644 index 00000000..514f8e3a --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/potted_golden_oak_sapling.json @@ -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" +} diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/potted_green_apple_sapling.json b/src/main/resources/data/unicopia/loot_tables/blocks/potted_green_apple_sapling.json new file mode 100644 index 00000000..a648cbaf --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/potted_green_apple_sapling.json @@ -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" +} diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/potted_mango_sapling.json b/src/main/resources/data/unicopia/loot_tables/blocks/potted_mango_sapling.json new file mode 100644 index 00000000..72ffe675 --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/potted_mango_sapling.json @@ -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" +} diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/potted_palm_sapling.json b/src/main/resources/data/unicopia/loot_tables/blocks/potted_palm_sapling.json new file mode 100644 index 00000000..8428fcdc --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/potted_palm_sapling.json @@ -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" +} diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/potted_sour_apple_sapling.json b/src/main/resources/data/unicopia/loot_tables/blocks/potted_sour_apple_sapling.json new file mode 100644 index 00000000..6e5b7e92 --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/potted_sour_apple_sapling.json @@ -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" +} diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/potted_sweet_apple_sapling.json b/src/main/resources/data/unicopia/loot_tables/blocks/potted_sweet_apple_sapling.json new file mode 100644 index 00000000..bc6aff30 --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/potted_sweet_apple_sapling.json @@ -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" +} diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/potted_zapling.json b/src/main/resources/data/unicopia/loot_tables/blocks/potted_zapling.json new file mode 100644 index 00000000..a93849c6 --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/potted_zapling.json @@ -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" +}