mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Added sour apple trees
This commit is contained in:
parent
043a54eabf
commit
81eff15912
28 changed files with 304 additions and 7 deletions
|
@ -47,6 +47,7 @@ public record Tree (
|
|||
private Optional<Predicate<BiomeSelectionContext>> selector = Optional.empty();
|
||||
private Optional<PlacementModifier> countModifier = Optional.empty();
|
||||
private Optional<Supplier<TreeFeatureConfig.Builder>> configSupplier = Optional.empty();
|
||||
private Optional<TwoLayersFeatureSize> 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<TreeFeatureConfig, ?>> 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<Block> sapling = saplingId.map(id -> UBlocks.register(id, new SaplingBlock(new SaplingGenerator() {
|
||||
|
|
|
@ -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 extends Block> T register(String name, T item) {
|
||||
return register(Unicopia.id(name), item);
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "unicopia:block/sour_apple"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "unicopia:block/sour_apple_leaves"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "unicopia:block/sour_apple_sapling"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "unicopia:block/fruit",
|
||||
"textures": {
|
||||
"cross": "unicopia:item/sour_apple"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/leaves",
|
||||
"textures": {
|
||||
"all": "unicopia:block/sour_apple_leaves"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/cross",
|
||||
"textures": {
|
||||
"cross": "unicopia:item/sour_apple_sapling"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "unicopia:block/sour_apple_leaves"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:item/sour_apple_sapling"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:item/sour_apple_seeds"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -3,6 +3,7 @@
|
|||
"values": [
|
||||
"unicopia:zap_leaves",
|
||||
"unicopia:green_apple_leaves",
|
||||
"unicopia:sweet_apple_leaves"
|
||||
"unicopia:sweet_apple_leaves",
|
||||
"unicopia:sour_apple_leaves"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"values": [
|
||||
"unicopia:zap_leaves",
|
||||
"unicopia:green_apple_leaves",
|
||||
"unicopia:sweet_apple_leaves"
|
||||
"unicopia:sweet_apple_leaves",
|
||||
"unicopia:sour_apple_leaves"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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,6 +10,7 @@
|
|||
"minecraft:oak_fence",
|
||||
"minecraft:oak_stairs",
|
||||
|
||||
"minecraft:spruce_leaves",
|
||||
"minecraft:spruce_planks",
|
||||
"minecraft:spruce_log",
|
||||
"minecraft:spruce_wood",
|
||||
|
@ -16,6 +18,7 @@
|
|||
"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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"ingredients": [
|
||||
{ "item": "unicopia:sour_apple" }
|
||||
],
|
||||
"result": { "item": "unicopia:sour_apple_seeds", "count": 2 }
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"replace": false,
|
||||
"traits": "earth:2 life:1",
|
||||
"items": [
|
||||
"unicopia:green_apple_leaves",
|
||||
"unicopia:sweet_apple_leaves",
|
||||
"unicopia:sour_apple_leaves"
|
||||
]
|
||||
}
|
|
@ -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"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"logs": [ "minecraft:oak_log", "minecraft:oak_wood" ],
|
||||
"leaves": [ "unicopia:sour_apple_leaves" ],
|
||||
"wideTrunk": false,
|
||||
"drops": []
|
||||
}
|
Loading…
Reference in a new issue