diff --git a/src/main/java/com/minelittlepony/unicopia/block/Tree.java b/src/main/java/com/minelittlepony/unicopia/block/Tree.java index e0cca8d8..087d5785 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/Tree.java +++ b/src/main/java/com/minelittlepony/unicopia/block/Tree.java @@ -47,6 +47,7 @@ public record Tree ( private Optional> selector = Optional.empty(); private Optional countModifier = Optional.empty(); private Optional> configSupplier = Optional.empty(); + private Optional size = Optional.empty(); private Builder(Identifier id, TrunkPlacer trunkPlacer, FoliagePlacer foliagePlacer) { this.id = id; @@ -84,6 +85,11 @@ public record Tree ( return this; } + public Builder farmingCondition(int yLevel, int sizeBelowY, int sizeAboveY) { + this.size = Optional.of(new TwoLayersFeatureSize(yLevel, Math.max(0, sizeBelowY), Math.max(0, sizeAboveY))); + return this; + } + public Tree build() { RegistryEntry> configuredFeature = ConfiguredFeatures.register(id.toString(), Feature.TREE, configSupplier.map(Supplier::get) .orElseGet(() -> new TreeFeatureConfig.Builder( @@ -91,7 +97,7 @@ public record Tree ( trunkPlacer, BlockStateProvider.of(leavesType), foliagePlacer, - new TwoLayersFeatureSize(6, 0, 16) + size.get() ).forceDirt()).build()); Optional sapling = saplingId.map(id -> UBlocks.register(id, new SaplingBlock(new SaplingGenerator() { diff --git a/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java b/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java index b1d90a9d..b67faef5 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java +++ b/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java @@ -58,6 +58,14 @@ public interface UBlocks { Block SWEET_APPLE = register("sweet_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GREEN).sounds(BlockSoundGroup.WOOD), Direction.DOWN, SWEET_APPLE_LEAVES, FruitBlock.DEFAULT_SHAPE)); Block SWEET_APPLE_SPROUT = register("sweet_apple_sprout", new SproutBlock(0xE5FFCC88, () -> UItems.SWEET_APPLE_SEEDS, () -> UTreeGen.SWEET_APPLE_TREE.sapling().map(Block::getDefaultState).get())); + Block SOUR_APPLE_LEAVES = register("sour_apple_leaves", new FruitBearingBlock(FabricBlockSettings.copy(Blocks.OAK_LEAVES), + 0xE5FFCCCC, + () -> UBlocks.SOUR_APPLE, + () -> UItems.SOUR_APPLE.getDefaultStack() + ), ItemGroup.DECORATIONS); + Block SOUR_APPLE = register("sour_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GREEN).sounds(BlockSoundGroup.WOOD), Direction.DOWN, SOUR_APPLE_LEAVES, FruitBlock.DEFAULT_SHAPE)); + Block SOUR_APPLE_SPROUT = register("sour_apple_sprout", new SproutBlock(0xE5FFCC88, () -> UItems.SOUR_APPLE_SEEDS, () -> UTreeGen.SOUR_APPLE_TREE.sapling().map(Block::getDefaultState).get())); + static T register(String name, T item) { return register(Unicopia.id(name), item); } diff --git a/src/main/java/com/minelittlepony/unicopia/block/UTreeGen.java b/src/main/java/com/minelittlepony/unicopia/block/UTreeGen.java index 99cdba17..3c4067ea 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/UTreeGen.java +++ b/src/main/java/com/minelittlepony/unicopia/block/UTreeGen.java @@ -30,15 +30,18 @@ public interface UTreeGen { .sapling(Unicopia.id("zapling")) .biomes(Tree.Builder.IS_FOREST) .count(0, 0.01F, 1) + .farmingCondition(6, 0, 8) .build(); - Tree GREEN_APPLE_TREE = createAppleTree("green_apple", UBlocks.GREEN_APPLE_LEAVES); - Tree SWEET_APPLE_TREE = createAppleTree("sweet_apple", UBlocks.SWEET_APPLE_LEAVES); + Tree GREEN_APPLE_TREE = createAppleTree("green_apple", UBlocks.GREEN_APPLE_LEAVES, 2); + Tree SWEET_APPLE_TREE = createAppleTree("sweet_apple", UBlocks.SWEET_APPLE_LEAVES, 3); + Tree SOUR_APPLE_TREE = createAppleTree("sour_apple", UBlocks.SOUR_APPLE_LEAVES, 5); - static Tree createAppleTree(String name, Block leaves) { + static Tree createAppleTree(String name, Block leaves, int preferredDensity) { return Tree.Builder.create(Unicopia.id(name + "_tree"), new StraightTrunkPlacer(4, 6, 2), new BlobFoliagePlacer(ConstantIntProvider.create(3), ConstantIntProvider.create(0), 3) ) + .farmingCondition(1, preferredDensity - 2, preferredDensity) .log(Blocks.OAK_LOG) .leaves(leaves) .sapling(Unicopia.id(name + "_sapling")) diff --git a/src/main/java/com/minelittlepony/unicopia/item/UItems.java b/src/main/java/com/minelittlepony/unicopia/item/UItems.java index 12fcec61..d534ef23 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/UItems.java +++ b/src/main/java/com/minelittlepony/unicopia/item/UItems.java @@ -81,6 +81,7 @@ public interface UItems { Item GREEN_APPLE_SEEDS = register("green_apple_seeds", new AliasedBlockItem(UBlocks.GREEN_APPLE_SPROUT, new Item.Settings().group(ItemGroup.MATERIALS))); Item SWEET_APPLE_SEEDS = register("sweet_apple_seeds", new AliasedBlockItem(UBlocks.SWEET_APPLE_SPROUT, new Item.Settings().group(ItemGroup.MATERIALS))); + Item SOUR_APPLE_SEEDS = register("sour_apple_seeds", new AliasedBlockItem(UBlocks.SOUR_APPLE_SPROUT, new Item.Settings().group(ItemGroup.MATERIALS))); Item MUG = register("mug", new Item(new Settings().group(ItemGroup.MATERIALS).maxCount(16))); Item CIDER = register("cider", new DrinkableItem(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.CIDER).maxCount(1).recipeRemainder(MUG))); diff --git a/src/main/resources/assets/unicopia/blockstates/sour_apple.json b/src/main/resources/assets/unicopia/blockstates/sour_apple.json new file mode 100644 index 00000000..e3af10bf --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/sour_apple.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/sour_apple" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/blockstates/sour_apple_leaves.json b/src/main/resources/assets/unicopia/blockstates/sour_apple_leaves.json new file mode 100644 index 00000000..f9d40dd7 --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/sour_apple_leaves.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/sour_apple_leaves" + } + } +} diff --git a/src/main/resources/assets/unicopia/blockstates/sour_apple_sapling.json b/src/main/resources/assets/unicopia/blockstates/sour_apple_sapling.json new file mode 100644 index 00000000..c9ffeae9 --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/sour_apple_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "unicopia:block/sour_apple_sapling" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/blockstates/sour_apple_sprout.json b/src/main/resources/assets/unicopia/blockstates/sour_apple_sprout.json new file mode 100644 index 00000000..f88ff7ea --- /dev/null +++ b/src/main/resources/assets/unicopia/blockstates/sour_apple_sprout.json @@ -0,0 +1,28 @@ +{ + "variants": { + "age=0": { + "model": "unicopia:block/apple_sprout_stage0" + }, + "age=1": { + "model": "unicopia:block/apple_sprout_stage1" + }, + "age=2": { + "model": "unicopia:block/apple_sprout_stage2" + }, + "age=3": { + "model": "unicopia:block/apple_sprout_stage3" + }, + "age=4": { + "model": "unicopia:block/apple_sprout_stage4" + }, + "age=5": { + "model": "unicopia:block/apple_sprout_stage5" + }, + "age=6": { + "model": "unicopia:block/apple_sprout_stage6" + }, + "age=7": { + "model": "unicopia:block/apple_sprout_stage7" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/models/block/sour_apple.json b/src/main/resources/assets/unicopia/models/block/sour_apple.json new file mode 100644 index 00000000..2f532cb0 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/sour_apple.json @@ -0,0 +1,6 @@ +{ + "parent": "unicopia:block/fruit", + "textures": { + "cross": "unicopia:item/sour_apple" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/models/block/sour_apple_leaves.json b/src/main/resources/assets/unicopia/models/block/sour_apple_leaves.json new file mode 100644 index 00000000..5c5c2d5b --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/sour_apple_leaves.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/leaves", + "textures": { + "all": "unicopia:block/sour_apple_leaves" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/models/block/sour_apple_sapling.json b/src/main/resources/assets/unicopia/models/block/sour_apple_sapling.json new file mode 100644 index 00000000..89a46a2c --- /dev/null +++ b/src/main/resources/assets/unicopia/models/block/sour_apple_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "unicopia:item/sour_apple_sapling" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/models/item/sour_apple_leaves.json b/src/main/resources/assets/unicopia/models/item/sour_apple_leaves.json new file mode 100644 index 00000000..c1f5b4ad --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/sour_apple_leaves.json @@ -0,0 +1,3 @@ +{ + "parent": "unicopia:block/sour_apple_leaves" +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/models/item/sour_apple_sapling.json b/src/main/resources/assets/unicopia/models/item/sour_apple_sapling.json new file mode 100644 index 00000000..5011ea3a --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/sour_apple_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/sour_apple_sapling" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/sour_apple_seeds.json b/src/main/resources/assets/unicopia/models/item/sour_apple_seeds.json new file mode 100644 index 00000000..aaf85db0 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/sour_apple_seeds.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/sour_apple_seeds" + } +} diff --git a/src/main/resources/assets/unicopia/textures/block/sour_apple_leaves.png b/src/main/resources/assets/unicopia/textures/block/sour_apple_leaves.png new file mode 100644 index 00000000..5a8900de Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/block/sour_apple_leaves.png differ diff --git a/src/main/resources/assets/unicopia/textures/item/sour_apple_sapling.png b/src/main/resources/assets/unicopia/textures/item/sour_apple_sapling.png new file mode 100644 index 00000000..5d45f9d8 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/sour_apple_sapling.png differ diff --git a/src/main/resources/assets/unicopia/textures/item/sour_apple_seeds.png b/src/main/resources/assets/unicopia/textures/item/sour_apple_seeds.png new file mode 100644 index 00000000..a915d8d4 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/sour_apple_seeds.png differ diff --git a/src/main/resources/data/minecraft/tags/blocks/leaves.json b/src/main/resources/data/minecraft/tags/blocks/leaves.json index 1bc14183..9df08ebc 100644 --- a/src/main/resources/data/minecraft/tags/blocks/leaves.json +++ b/src/main/resources/data/minecraft/tags/blocks/leaves.json @@ -3,6 +3,7 @@ "values": [ "unicopia:zap_leaves", "unicopia:green_apple_leaves", - "unicopia:sweet_apple_leaves" + "unicopia:sweet_apple_leaves", + "unicopia:sour_apple_leaves" ] } diff --git a/src/main/resources/data/minecraft/tags/items/leaves.json b/src/main/resources/data/minecraft/tags/items/leaves.json index 1bc14183..9df08ebc 100644 --- a/src/main/resources/data/minecraft/tags/items/leaves.json +++ b/src/main/resources/data/minecraft/tags/items/leaves.json @@ -3,6 +3,7 @@ "values": [ "unicopia:zap_leaves", "unicopia:green_apple_leaves", - "unicopia:sweet_apple_leaves" + "unicopia:sweet_apple_leaves", + "unicopia:sour_apple_leaves" ] } diff --git a/src/main/resources/data/minecraft/traits/blocks/overworld/organic_plant_derived.json b/src/main/resources/data/minecraft/traits/blocks/overworld/organic_plant_derived.json index 3dd37865..fe8c9136 100644 --- a/src/main/resources/data/minecraft/traits/blocks/overworld/organic_plant_derived.json +++ b/src/main/resources/data/minecraft/traits/blocks/overworld/organic_plant_derived.json @@ -2,6 +2,7 @@ "replace": false, "traits": "earth:2 life:1", "items": [ + "minecraft:oak_leaves", "minecraft:oak_planks", "minecraft:oak_log", "minecraft:oak_wood", @@ -9,13 +10,15 @@ "minecraft:oak_fence", "minecraft:oak_stairs", + "minecraft:spruce_leaves", "minecraft:spruce_planks", "minecraft:spruce_log", "minecraft:spruce_wood", "minecraft:spruce_slab", "minecraft:spruce_fence", "minecraft:spruce_stairs", - + + "minecraft:birch_leaves", "minecraft:birch_planks", "minecraft:birch_log", "minecraft:birch_wood", @@ -23,6 +26,7 @@ "minecraft:birch_fence", "minecraft:birch_stairs", + "minecraft:jungle_leaves", "minecraft:jungle_planks", "minecraft:jungle_log", "minecraft:jungle_wood", @@ -30,6 +34,7 @@ "minecraft:jungle_fence", "minecraft:jungle_stairs", + "minecraft:acacia_leaves", "minecraft:acacia_planks", "minecraft:acacia_log", "minecraft:acacia_wood", diff --git a/src/main/resources/data/minecraft/traits/blocks/overworld/organic_plant_derived_dark.json b/src/main/resources/data/minecraft/traits/blocks/overworld/organic_plant_derived_dark.json index 56d1e4e0..f0020cac 100644 --- a/src/main/resources/data/minecraft/traits/blocks/overworld/organic_plant_derived_dark.json +++ b/src/main/resources/data/minecraft/traits/blocks/overworld/organic_plant_derived_dark.json @@ -2,6 +2,7 @@ "replace": false, "traits": "earth:2 life:1 darkness:1", "items": [ + "minecraft:dark_oak_leaves", "minecraft:dark_oak_planks", "minecraft:dark_oak_log", "minecraft:dark_oak_stairs", diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple.json b/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple.json new file mode 100644 index 00000000..72c4d970 --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "unicopia:sour_apple" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple_leaves.json b/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple_leaves.json new file mode 100644 index 00000000..08eab347 --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple_leaves.json @@ -0,0 +1,116 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:alternative", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:shears" + ] + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + ], + "name": "unicopia:sour_apple_leaves" + } + ] + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:shears" + ] + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple_sapling.json b/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple_sapling.json new file mode 100644 index 00000000..deece711 --- /dev/null +++ b/src/main/resources/data/unicopia/loot_tables/blocks/sour_apple_sapling.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "unicopia:sour_apple_sapling" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/recipes/sour_apple_to_seeds.json b/src/main/resources/data/unicopia/recipes/sour_apple_to_seeds.json new file mode 100644 index 00000000..7884a668 --- /dev/null +++ b/src/main/resources/data/unicopia/recipes/sour_apple_to_seeds.json @@ -0,0 +1,7 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { "item": "unicopia:sour_apple" } + ], + "result": { "item": "unicopia:sour_apple_seeds", "count": 2 } +} diff --git a/src/main/resources/data/unicopia/traits/organic_plant_derived.json b/src/main/resources/data/unicopia/traits/organic_plant_derived.json new file mode 100644 index 00000000..dc650d27 --- /dev/null +++ b/src/main/resources/data/unicopia/traits/organic_plant_derived.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "traits": "earth:2 life:1", + "items": [ + "unicopia:green_apple_leaves", + "unicopia:sweet_apple_leaves", + "unicopia:sour_apple_leaves" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/traits/organic_plant_derived_zap.json b/src/main/resources/data/unicopia/traits/organic_plant_derived_zap.json new file mode 100644 index 00000000..172f955c --- /dev/null +++ b/src/main/resources/data/unicopia/traits/organic_plant_derived_zap.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "traits": "earth:2 life:1 chaos:3", + "items": [ + "unicopia:zap_leaves", + "unicopia:zap_log", + "unicopia:stripped_zap_log", + "unicopia:zap_wood", + "unicopia:stripped_zap_wood" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/tree_types/sour_apple.json b/src/main/resources/data/unicopia/tree_types/sour_apple.json new file mode 100644 index 00000000..b2825d9f --- /dev/null +++ b/src/main/resources/data/unicopia/tree_types/sour_apple.json @@ -0,0 +1,6 @@ +{ + "logs": [ "minecraft:oak_log", "minecraft:oak_wood" ], + "leaves": [ "unicopia:sour_apple_leaves" ], + "wideTrunk": false, + "drops": [] +} \ No newline at end of file