diff --git a/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/BlocksTreeWalchia.java b/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/BlocksTreeWalchia.java new file mode 100644 index 0000000..b0c84c9 --- /dev/null +++ b/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/BlocksTreeWalchia.java @@ -0,0 +1,84 @@ +package com.aechtrob.prehistoricnature.block.trees.walchia; + +import com.aechtrob.prehistoricnature.PrehistoricNatureMod; +import com.aechtrob.prehistoricnature.block.BlockHandler; +import com.aechtrob.prehistoricnature.block.BlockRegistration; +import com.aechtrob.prehistoricnature.block.trees.WoodTypeHelper; +import com.aechtrob.prehistoricnature.creativetabs.CreativeTabHelper; +import com.aechtrob.prehistoricnature.datagen.loottable.BlockLootSubProvider; +import com.aechtrob.prehistoricnature.world.tree.walchia.WalchiaTreeGrower; +import com.ibm.icu.impl.Pair; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.properties.WoodType; +import net.minecraftforge.registries.RegistryObject; + +import java.util.List; + +public class BlocksTreeWalchia { + public static class WalchiaBlockTags { + public static TagKey WALCHIA_LOGS = BlockTags.create(new ResourceLocation(PrehistoricNatureMod.MOD_ID, "walchia_logs")); + } + public static class WalchiaItemTags { + public static TagKey WALCHIA_LOGS = ItemTags.create(new ResourceLocation(PrehistoricNatureMod.MOD_ID, "walchia_logs")); + } + public static String treeName = "walchia"; + public static int treeId = 1; + public static final WoodType WALCHIA = WoodTypeHelper.putWoodType(WoodType.create(treeName)); + + public static final RegistryObject WALCHIA_STRIPPED_LOG = BlockRegistration.strippedLogBlock( + List.of(WalchiaBlockTags.WALCHIA_LOGS,BlockTags.MINEABLE_WITH_AXE,BlockTags.LOGS,BlockTags.LOGS_THAT_BURN,BlockTags.OVERWORLD_NATURAL_LOGS), + List.of(WalchiaItemTags.WALCHIA_LOGS, ItemTags.LOGS,ItemTags.LOGS_THAT_BURN),treeName,treeId); + public static final RegistryObject WALCHIA_LOG = BlockRegistration.logBlock(WALCHIA_STRIPPED_LOG, + List.of(WalchiaBlockTags.WALCHIA_LOGS,BlockTags.MINEABLE_WITH_AXE,BlockTags.LOGS,BlockTags.LOGS_THAT_BURN,BlockTags.OVERWORLD_NATURAL_LOGS), + List.of(WalchiaItemTags.WALCHIA_LOGS, ItemTags.LOGS,ItemTags.LOGS_THAT_BURN),treeName,treeId); + public static final RegistryObject WALCHIA_STRIPPED_WOOD = BlockRegistration.strippedWoodBlock(WALCHIA_STRIPPED_LOG, + List.of(WalchiaBlockTags.WALCHIA_LOGS, BlockTags.MINEABLE_WITH_AXE,BlockTags.LOGS,BlockTags.LOGS_THAT_BURN,BlockTags.OVERWORLD_NATURAL_LOGS), + List.of(WalchiaItemTags.WALCHIA_LOGS, ItemTags.LOGS,ItemTags.LOGS_THAT_BURN), treeName, treeId); + public static final RegistryObject WALCHIA_WOOD = BlockRegistration.woodBlock(WALCHIA_LOG,WALCHIA_STRIPPED_WOOD, List.of(WalchiaBlockTags.WALCHIA_LOGS, BlockTags.MINEABLE_WITH_AXE,BlockTags.LOGS,BlockTags.LOGS_THAT_BURN,BlockTags.OVERWORLD_NATURAL_LOGS), + List.of(WalchiaItemTags.WALCHIA_LOGS, ItemTags.LOGS,ItemTags.LOGS_THAT_BURN), treeName, treeId); + public static final RegistryObject WALCHIA_SAPLING = BlockRegistration.saplingBlock(new WalchiaTreeGrower(),List.of(BlockTags.SAPLINGS), + List.of(ItemTags.SAPLINGS), treeName, treeId); + public static final RegistryObject WALCHIA_LEAVES = BlockRegistration.leafBlock(WALCHIA_SAPLING, + List.of(BlockTags.MINEABLE_WITH_HOE, BlockTags.LEAVES),List.of(ItemTags.LEAVES), treeName, treeId); + public static final RegistryObject WALCHIA_PLANKS = BlockRegistration.plankBlock(WalchiaItemTags.WALCHIA_LOGS,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.PLANKS), + List.of(ItemTags.PLANKS),treeName,treeId); + public static final RegistryObject WALCHIA_SLAB = BlockRegistration.slabBlock(WALCHIA_PLANKS,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.WOODEN_SLABS), + List.of(ItemTags.WOODEN_SLABS),treeName,treeId); + public static final RegistryObject WALCHIA_STAIRS = BlockRegistration.stairsBlock(WALCHIA_PLANKS,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.WOODEN_STAIRS), + List.of(ItemTags.WOODEN_STAIRS),treeName,treeId); + public static final RegistryObject WALCHIA_FENCE = BlockRegistration.fenceBlock(WALCHIA_PLANKS,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.WOODEN_FENCES), + List.of(ItemTags.WOODEN_FENCES),treeName,treeId); + public static final RegistryObject WALCHIA_FENCE_GATE = BlockRegistration.fenceGateBlock(WALCHIA_PLANKS,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.FENCE_GATES), + List.of(ItemTags.FENCE_GATES), treeName, treeId); + public static final RegistryObject WALCHIA_DOOR = BlockRegistration.doorBlock(WALCHIA_PLANKS,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.WOODEN_DOORS), + List.of(ItemTags.WOODEN_DOORS), treeName, treeId); + //Needs manual json file. + public static final RegistryObject WALCHIA_TRAPDOOR = BlockRegistration.trapdoorBlock(WALCHIA_PLANKS,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.WOODEN_TRAPDOORS), + List.of(ItemTags.WOODEN_TRAPDOORS), treeName, treeId); + public static final RegistryObject WALCHIA_PRESSURE_PLATE = BlockRegistration.pressurePlateBlock(WALCHIA_PLANKS,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.WOODEN_PRESSURE_PLATES), + List.of(ItemTags.WOODEN_PRESSURE_PLATES), treeName, treeId); + public static final RegistryObject WALCHIA_BUTTON = BlockRegistration.buttonBlock(WALCHIA_PLANKS ,List.of(BlockTags.MINEABLE_WITH_AXE,BlockTags.WOODEN_BUTTONS), + List.of(ItemTags.WOODEN_BUTTONS), treeName, treeId); + public static final RegistryObject WALCHIA_WALL_SIGN = BlockRegistration.wallSignBlock(WALCHIA,List.of(BlockTags.WALL_SIGNS),treeName); + public static final RegistryObject WALCHIA_SIGN = BlockRegistration.standingSignBlock(WALCHIA_WALL_SIGN,WALCHIA,List.of(BlockTags.STANDING_SIGNS),treeName); + + public static final RegistryObject WALCHIA_LADDER = BlockRegistration.ladderBlock( + WALCHIA_PLANKS, List.of(BlockTags.MINEABLE_WITH_AXE, BlockTags.CLIMBABLE),List.of(),treeName,treeId); + + +// public static final RegistryObject WALCHIA_BENCH = BlockHandler.registerBlock("walchia_bench", +// () -> new PNBenchBlock(BlockBehaviour.Properties.copy(Blocks.OAK_BUTTON) +// , 30, true, SoundEvents.WOODEN_BUTTON_CLICK_OFF, SoundEvents.WOODEN_BUTTON_CLICK_ON)); + + //Other tree-specific stuff: + + public static void register() { + } +} diff --git a/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/EntitiesTreeWalchia.java b/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/EntitiesTreeWalchia.java new file mode 100644 index 0000000..841df82 --- /dev/null +++ b/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/EntitiesTreeWalchia.java @@ -0,0 +1,20 @@ +package com.aechtrob.prehistoricnature.block.trees.walchia; + +import com.aechtrob.prehistoricnature.entity.block.blocks.PNSignBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraftforge.registries.RegistryObject; + +import static com.aechtrob.prehistoricnature.entity.block.PNBlockEntities.BLOCK_ENTITY_REGISTER; + +public class EntitiesTreeWalchia { + + public static void register(){ + + } + public static final RegistryObject> WALCHIA_SIGN_BLOCK_ENTITIES = + BLOCK_ENTITY_REGISTER.register("walchia_sign_block_entity", ()-> + BlockEntityType.Builder.of(PNSignBlockEntity::new, BlocksTreeWalchia.WALCHIA_WALL_SIGN.get(), + BlocksTreeWalchia.WALCHIA_SIGN.get()).build(null)); + + +} diff --git a/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/ItemsTreeWalchia.java b/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/ItemsTreeWalchia.java new file mode 100644 index 0000000..4910773 --- /dev/null +++ b/src/main/java/com/aechtrob/prehistoricnature/block/trees/walchia/ItemsTreeWalchia.java @@ -0,0 +1,39 @@ +package com.aechtrob.prehistoricnature.block.trees.walchia; + +import com.aechtrob.prehistoricnature.block.BlockRegistration; +import com.aechtrob.prehistoricnature.entity.entities.PNBoat; +import com.aechtrob.prehistoricnature.item.ItemHandler; +import com.aechtrob.prehistoricnature.item.items.PNBoatItem; +import com.ibm.icu.impl.Pair; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Item; +import net.minecraftforge.registries.RegistryObject; + +import java.util.List; + +import static com.aechtrob.prehistoricnature.creativetabs.CreativeTabHelper.transportTabBoatTier; + +public class ItemsTreeWalchia { + public static void register(){} + public static final RegistryObject WALCHIA_SIGN_ITEM = BlockRegistration.signItem(BlocksTreeWalchia.WALCHIA_PLANKS, BlocksTreeWalchia.WALCHIA_WALL_SIGN, BlocksTreeWalchia.WALCHIA_SIGN, + List.of(ItemTags.SIGNS), BlocksTreeWalchia.treeName, BlocksTreeWalchia.treeId); + + + public static final RegistryObject WALCHIA_BOAT_ITEM = ItemHandler.addItem("walchia_boat", + () -> new PNBoatItem(false, PNBoat.Type.WALCHIA, new Item.Properties().stacksTo(1)), + (provider, item) -> {provider.basicItem(item);}, + List.of(Pair.of("prehistoricnature_transport_tab",Pair.of(transportTabBoatTier, BlocksTreeWalchia.treeId))), + "Walchia Boat"); + + public static final RegistryObject WALCHIA_CHEST_BOAT_ITEM = ItemHandler.addItem("walchia_chest_boat", + () -> new PNBoatItem(true, PNBoat.Type.WALCHIA, new Item.Properties().stacksTo(1)), + (provider, item) -> {provider.basicItem(item);}, + List.of(Pair.of("prehistoricnature_transport_tab",Pair.of(transportTabBoatTier, BlocksTreeWalchia.treeId))), + "Walchia Chest Boat"); + + + //regular item creation applies + + + +} diff --git a/src/main/java/com/aechtrob/prehistoricnature/entity/entities/PNBoat.java b/src/main/java/com/aechtrob/prehistoricnature/entity/entities/PNBoat.java index 825622c..f4636a1 100644 --- a/src/main/java/com/aechtrob/prehistoricnature/entity/entities/PNBoat.java +++ b/src/main/java/com/aechtrob/prehistoricnature/entity/entities/PNBoat.java @@ -1,6 +1,8 @@ package com.aechtrob.prehistoricnature.entity.entities; import com.aechtrob.prehistoricnature.block.trees.lepidodendron.*; +import com.aechtrob.prehistoricnature.block.trees.walchia.BlocksTreeWalchia; +import com.aechtrob.prehistoricnature.block.trees.walchia.ItemsTreeWalchia; import net.minecraft.nbt.*; import net.minecraft.network.protocol.*; import net.minecraft.network.protocol.game.*; @@ -35,9 +37,11 @@ public PNBoat.Type getPNBoatType() { public Item getDropItem() { return switch (this.getPNBoatType()) { case LEPIDODENDRON -> ItemsTreeLepidodendron.LEPIDODENDRON_BOAT_ITEM.get(); + case WALCHIA -> ItemsTreeWalchia.WALCHIA_BOAT_ITEM.get(); }; } + public void setPNBoatType(PNBoat.Type boatType) { this.getEntityData().set(BOAT_TYPE, boatType.ordinal()); } @@ -67,7 +71,12 @@ public Packet getAddEntityPacket() { //TODO add every woodtype thats added to the mod here public enum Type { - LEPIDODENDRON(BlocksTreeLepidodendron.LEPIDODENDRON_PLANKS.get(),BlocksTreeLepidodendron.treeName); + + WALCHIA(BlocksTreeWalchia.WALCHIA_PLANKS.get(), BlocksTreeWalchia.treeName), + LEPIDODENDRON(BlocksTreeLepidodendron.LEPIDODENDRON_PLANKS.get(), BlocksTreeLepidodendron.treeName); + + + private final String name; private final Block block; diff --git a/src/main/java/com/aechtrob/prehistoricnature/world/ModConfiguredFeatures.java b/src/main/java/com/aechtrob/prehistoricnature/world/ModConfiguredFeatures.java index ccc0faa..aa25f49 100644 --- a/src/main/java/com/aechtrob/prehistoricnature/world/ModConfiguredFeatures.java +++ b/src/main/java/com/aechtrob/prehistoricnature/world/ModConfiguredFeatures.java @@ -13,7 +13,9 @@ public class ModConfiguredFeatures { public static final DeferredRegister> CONFIGURED_FEATURES = DeferredRegister.create(Registries.CONFIGURED_FEATURE, PrehistoricNatureMod.MOD_ID); + //TODO add configured features for all trees in mod public static final ResourceKey> LEPIDODENDRON_TREE = createKey("lepidodendron_tree"); + public static final ResourceKey> WALCHIA_TREE = createKey("walchia_tree"); public static ResourceKey> createKey(String name) { return ResourceKey.create(CONFIGURED_FEATURES.getRegistryKey(), new ResourceLocation(PrehistoricNatureMod.MOD_ID, name)); diff --git a/src/main/java/com/aechtrob/prehistoricnature/world/tree/PNFoliagePlacerType.java b/src/main/java/com/aechtrob/prehistoricnature/world/tree/PNFoliagePlacerType.java index 4f059d6..7ddc0fc 100644 --- a/src/main/java/com/aechtrob/prehistoricnature/world/tree/PNFoliagePlacerType.java +++ b/src/main/java/com/aechtrob/prehistoricnature/world/tree/PNFoliagePlacerType.java @@ -2,6 +2,7 @@ import com.aechtrob.prehistoricnature.PrehistoricNatureMod; import com.aechtrob.prehistoricnature.world.tree.lepidodendron.LepidodendronFoliagePlacer; +import com.aechtrob.prehistoricnature.world.tree.walchia.WalchiaFoliagePlacer; import net.minecraft.core.registries.Registries; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType; import net.minecraftforge.registries.DeferredRegister; @@ -11,6 +12,10 @@ public class PNFoliagePlacerType { public static final DeferredRegister> FOLIAGE_PLACER_TYPES = DeferredRegister.create(Registries.FOLIAGE_PLACER_TYPE, PrehistoricNatureMod.MOD_ID); public static RegistryObject> LEPIDODENDRON_FOLIAGE_PLACER = FOLIAGE_PLACER_TYPES.register("lepidodendron_foliage_placer", () -> new FoliagePlacerType<>(LepidodendronFoliagePlacer.CODEC)); + + public static RegistryObject> WALCHIA_FOLIAGE_PLACER = FOLIAGE_PLACER_TYPES.register("walchia_foliage_placer", () -> new FoliagePlacerType<>(WalchiaFoliagePlacer.CODEC)); + + //public static RegistryObject> FANCY_CHERRY_TREE_Foliage_PLACER = Foliage_PLACER_TYPES.register("fancy_cherry_blossom_tree_Foliage_placer", () -> new FoliagePlacerType<>(FancyCherryBlossomFoliagePlacer.CODEC)); //public static RegistryObject> GRAND_CHERRY_TREE_Foliage_PLACER = Foliage_PLACER_TYPES.register("grand_cherry_blossom_tree_Foliage_placer", () -> new FoliagePlacerType<>(GrandCherryBlossomFoliagePlacer.CODEC)); diff --git a/src/main/java/com/aechtrob/prehistoricnature/world/tree/PNTrunkPlacerType.java b/src/main/java/com/aechtrob/prehistoricnature/world/tree/PNTrunkPlacerType.java index 31b03b9..4ffe22c 100644 --- a/src/main/java/com/aechtrob/prehistoricnature/world/tree/PNTrunkPlacerType.java +++ b/src/main/java/com/aechtrob/prehistoricnature/world/tree/PNTrunkPlacerType.java @@ -2,6 +2,7 @@ import com.aechtrob.prehistoricnature.PrehistoricNatureMod; import com.aechtrob.prehistoricnature.world.tree.lepidodendron.LepidodendronTrunkPlacer; +import com.aechtrob.prehistoricnature.world.tree.walchia.WalchiaTrunkPlacer; import net.minecraft.core.registries.Registries; import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType; import net.minecraftforge.registries.DeferredRegister; @@ -11,6 +12,9 @@ public class PNTrunkPlacerType { public static final DeferredRegister> TRUNK_PLACER_TYPES = DeferredRegister.create(Registries.TRUNK_PLACER_TYPE, PrehistoricNatureMod.MOD_ID); public static RegistryObject> LEPIDODENDRON_TRUNK_PLACER = TRUNK_PLACER_TYPES.register("lepidodendron_trunk_placer", () -> new TrunkPlacerType<>(LepidodendronTrunkPlacer.CODEC)); + + public static RegistryObject> WALCHIA_TRUNK_PLACER = TRUNK_PLACER_TYPES.register("walchia_trunk_placer", () -> new TrunkPlacerType<>(WalchiaTrunkPlacer.CODEC)); + //public static RegistryObject> LEPIDODENDRON_TRUNK_PLACER = TRUNK_PLACER_TYPES.register("lepidodendron_trunk_placer", () -> new TrunkPlacerType<>(LepidodendronTrunkPlacer.CODEC)); } \ No newline at end of file diff --git a/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaFoliagePlacer.java b/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaFoliagePlacer.java new file mode 100644 index 0000000..08efaee --- /dev/null +++ b/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaFoliagePlacer.java @@ -0,0 +1,52 @@ +package com.aechtrob.prehistoricnature.world.tree.walchia; + +import com.aechtrob.prehistoricnature.block.blocks.PNDecayableDirectional; +import com.aechtrob.prehistoricnature.block.trees.walchia.BlocksTreeWalchia; +import com.aechtrob.prehistoricnature.world.tree.PNFoliagePlacerType; +import com.aechtrob.prehistoricnature.world.tree.PNTreeFeature; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.BlockPos; +import net.minecraft.util.RandomSource; +import net.minecraft.util.valueproviders.IntProvider; +import net.minecraft.world.level.LevelSimulatedReader; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; +import net.minecraft.world.level.levelgen.feature.foliageplacers.BlobFoliagePlacer; +import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType; + +import java.util.function.BiConsumer; + +public class WalchiaFoliagePlacer extends BlobFoliagePlacer { + public WalchiaFoliagePlacer(IntProvider p_161356_, IntProvider p_161357_, int p_161358_) { + super(p_161356_, p_161357_, p_161358_); + } + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { + return blobParts(instance).apply(instance, WalchiaFoliagePlacer::new); + }); + + @Override + protected FoliagePlacerType type() { + return PNFoliagePlacerType.WALCHIA_FOLIAGE_PLACER.get(); + } + + BlockState leafState = BlocksTreeWalchia.WALCHIA_LEAVES.get().defaultBlockState(); + //BlockState strobilusState = BlocksTreeWalchia.WALCHIA_STROBILUS.get().defaultBlockState().setValue(PNDecayableDirectional.PERSISTENT, false); + + @Override + protected void createFoliage(LevelSimulatedReader levelSimulatedReader, BiConsumer biConsumer, RandomSource random, TreeConfiguration treeConfiguration, int ii, FoliageAttachment foliageAttachment, int p_161366_, int p_161367_, int p_161368_) { + //This sets a single block of foliage only, and is detailed in the Trunk generator for where exactly it all has to go. + //For trees with no flowers, strobili or variant leaf blocks, do not use this, use PNFoliagePlacer instead. + BlockPos pos = foliageAttachment.pos(); + BlockState state = treeConfiguration.foliageProvider.getState(random, pos); + switch (foliageAttachment.radiusOffset()) { //Co-opting the radius field as a block enumerator for varied blocks + case 0: default: + state = leafState; + break; + } + + if (PNTreeFeature.canLeavesReplaceBlock(levelSimulatedReader, pos)) { + biConsumer.accept(pos, state); + } + } +} diff --git a/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaTreeGrower.java b/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaTreeGrower.java new file mode 100644 index 0000000..a5e46c9 --- /dev/null +++ b/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaTreeGrower.java @@ -0,0 +1,17 @@ +package com.aechtrob.prehistoricnature.world.tree.walchia; + +import com.aechtrob.prehistoricnature.world.ModConfiguredFeatures; +import net.minecraft.resources.ResourceKey; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.grower.AbstractTreeGrower; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import org.jetbrains.annotations.Nullable; + +public class WalchiaTreeGrower extends AbstractTreeGrower { + @Nullable + @Override + protected ResourceKey> getConfiguredFeature(RandomSource pRandom, boolean pLargeHive) { + return ModConfiguredFeatures.WALCHIA_TREE; + } + +} diff --git a/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaTrunkPlacer.java b/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaTrunkPlacer.java new file mode 100644 index 0000000..1a427eb --- /dev/null +++ b/src/main/java/com/aechtrob/prehistoricnature/world/tree/walchia/WalchiaTrunkPlacer.java @@ -0,0 +1,465 @@ +package com.aechtrob.prehistoricnature.world.tree.walchia; + +import com.aechtrob.prehistoricnature.block.blocks.PNRotatedPillarFlammableBlock; +import com.aechtrob.prehistoricnature.block.trees.walchia.BlocksTreeWalchia; +import com.aechtrob.prehistoricnature.world.tree.PNTreeFeature; +import com.aechtrob.prehistoricnature.world.tree.PNTrunkPlacerType; +import com.google.common.collect.Lists; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.LevelSimulatedReader; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; +import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacer; +import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacer; +import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType; + +import java.util.List; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +public class WalchiaTrunkPlacer extends TrunkPlacer { + + private LevelSimulatedReader levelSimulatedReader; + private BiConsumer biConsumer; + private RandomSource randomSource; + private BlockPos pos; + private TreeConfiguration treeConfiguration; + + + public WalchiaTrunkPlacer(int p_70268_, int p_70269_, int p_70270_) { + super(p_70268_, p_70269_, p_70270_); + } + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { + return trunkPlacerParts(instance).apply(instance, WalchiaTrunkPlacer::new); + }); + + protected void setFoliage(LevelSimulatedReader levelSimulatedReader, BiConsumer biConsumer, RandomSource random, TreeConfiguration treeConfiguration, int ii, FoliagePlacer.FoliageAttachment foliageAttachment, int p_161366_, int p_161367_, int p_161368_) { + BlockPos pos = foliageAttachment.pos(); + if (PNTreeFeature.canLeavesReplaceBlock(levelSimulatedReader, pos)) { + biConsumer.accept(pos, treeConfiguration.foliageProvider.getState(random, pos)); + } + } + + @Override + protected TrunkPlacerType type() { + return PNTrunkPlacerType.WALCHIA_TRUNK_PLACER.get(); + } + + @Override + public List placeTrunk(LevelSimulatedReader levelSimulatedReader, BiConsumer biConsumer, + RandomSource random, int p_161871_, BlockPos pos, TreeConfiguration treeConfiguration) { + this.levelSimulatedReader = levelSimulatedReader; + this.biConsumer = biConsumer; + this.randomSource = random; + this.pos = pos; + this.treeConfiguration = treeConfiguration; + List list = Lists.newArrayList(); + + int height = 0; + BlockState logState = BlocksTreeWalchia.WALCHIA_LOG.get().defaultBlockState(); + BlockState woodState = BlocksTreeWalchia.WALCHIA_WOOD.get().defaultBlockState(); + + List> placableBlocks = List.of( + (blockPos) -> {}, + (blockPos) -> {placeLog(blockPos, logState.setValue(PNRotatedPillarFlammableBlock.AXIS,Direction.Axis.Y));}, + (blockPos) -> {placeLog(blockPos, woodState);}, + (blockPos) -> {placeFoliage(blockPos, 0, list);}, + (blockPos) -> {placeRandomFoliage(blockPos, 0.4, 1, list);}, + (blockPos) -> {placeLog(blockPos, logState.setValue(PNRotatedPillarFlammableBlock.AXIS,Direction.Axis.Z));}, + (blockPos) -> {placeLog(blockPos, logState.setValue(PNRotatedPillarFlammableBlock.AXIS,Direction.Axis.X));} + ); + int x = 0; + + //Wood: + //stump + + int[][][] trunk ={ + { + {x,x,2,x,x}, + {x,2,1,1,x}, + {2,1,1,1,2}, + {x,2,1,2,x}, + {x,x,2,x,x} + }, { + {x,x,x,x,x}, + {x,x,1,x,x}, + {x,1,1,1,x}, + {x,x,1,x,x}, + {x,x,x,x,x} + } + }; + + int[][][] crown = { + { + {x,x,x,x,x,x,4,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,4,x,x,x,x,x,4,x,x,x}, + {x,x,4,x,x,x,x,x,x,x,4,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {4,x,x,x,x,x,1,x,x,x,x,x,4}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,4,x,x,x,x,x,x,x,4,x,x}, + {x,x,x,4,x,x,x,x,x,4,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,4,x,x,x,x,x,x} + }, + { + {x,x,x,x,x,x,3,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,3,x,x,x,x,x,3,x,x,x}, + {x,x,3,x,x,x,3,x,x,x,3,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {3,x,x,3,x,x,1,x,x,3,x,x,3}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,3,x,x,x,3,x,x,x,3,x,x}, + {x,x,x,3,x,x,x,x,x,3,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,3,x,x,x,x,x,x} + }, + { + {x,x,x,x,x,x,3,x,x,x,x,x,x}, + {x,x,x,x,x,3,3,3,x,x,x,x,x}, + {x,x,x,3,3,3,2,3,3,3,x,x,x}, + {x,x,3,x,x,3,6,3,x,x,3,x,x}, + {x,x,3,x,x,x,6,x,x,x,3,x,x}, + {x,3,3,3,x,3,6,3,x,3,3,3,x}, + {3,3,2,5,5,5,1,5,5,5,2,3,3}, + {x,3,3,3,x,3,6,3,x,3,3,3,x}, + {x,x,3,x,x,x,6,x,x,x,3,x,x}, + {x,x,3,x,x,3,6,3,x,x,3,x,x}, + {x,x,x,3,3,3,2,3,3,3,x,x,x}, + {x,x,x,x,x,3,3,3,x,x,x,x,x}, + {x,x,x,x,x,x,3,x,x,x,x,x,x} + }, + { + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,3,3,3,x,3,3,3,x,x,x}, + {x,x,x,3,1,3,3,3,1,3,x,x,x}, + {x,x,x,3,3,1,3,1,3,3,x,x,x}, + {x,x,x,x,3,3,1,3,3,x,x,x,x}, + {x,x,x,3,3,1,3,1,3,3,x,x,x}, + {x,x,x,3,1,3,3,3,1,3,x,x,x}, + {x,x,x,3,3,3,x,3,3,3,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x} + }, + { + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,3,x,x,x,3,x,x,x,x}, + {x,x,x,x,x,x,3,x,x,x,x,x,x}, + {x,x,x,x,x,3,1,3,x,x,x,x,x}, + {x,x,x,x,x,x,3,x,x,x,x,x,x}, + {x,x,x,x,3,x,x,x,3,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x} + }, + { + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,3,x,x,x,x,x,x}, + {x,x,x,x,x,3,6,3,x,x,x,x,x}, + {x,x,x,x,3,5,1,5,3,x,x,x,x}, + {x,x,x,x,x,3,6,3,x,x,x,x,x}, + {x,x,x,x,x,x,3,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x} + }, + { + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,3,x,x,x,x,x,x}, + {x,x,x,x,x,3,2,3,x,x,x,x,x}, + {x,x,x,x,x,x,3,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x}, + {x,x,x,x,x,x,x,x,x,x,x,x,x} + } + }; + + int finalHeight = height; + height = placeTreeSegment(trunk, height, placableBlocks); + //trunk + height = placeTrunk(pos, logState, height); + //crown + placeTreeSegment(crown, height, placableBlocks); + //trunk + height = placeTrunk(pos, logState, height); + //crown + placeTreeSegment(crown, height, placableBlocks); + return list; + } + + private void placeLog(BlockPos pos, BlockState logState) { + if (PNTreeFeature.canLogReplaceBlock(levelSimulatedReader, pos)) { + biConsumer.accept(pos, logState); + placeLog(levelSimulatedReader, biConsumer, randomSource, pos, treeConfiguration); + } + } + + public int placeTrunk(BlockPos pos, BlockState logState, int height){ + height += (int) ((18D) + Math.round((Math.random() * 10D) / 2D) + Math.round((Math.random() * 10D) / 2D) + + Math.round((Math.random() * 10D) / 2D)); + int counter = 1; + while (counter <= height) { + placeLog(pos.above(1 + counter), logState); + counter += 1; + } + return height; + } + + public void placeRandomFoliage(BlockPos pos, double odds, int foliageId, List list){ + if ((Math.random() > odds)) { + list.add(new FoliagePlacer.FoliageAttachment(pos, foliageId, true)); + } + } + + public void placeFoliage(BlockPos pos, int foliageId, List list){ + list.add(new FoliagePlacer.FoliageAttachment(pos, foliageId, true)); + } + + public int placeTreeSegment(int[][][] segment, int height, List> blockPlacingConsumer){ + for (int layer = 0; layer < segment.length; layer++) { + for (int row = 0; row < segment[layer].length; row++) { + for (int block = 0; block < segment[layer][row].length; block++) { + int middleV = Math.round(segment[layer].length / 2); + int middleH = Math.round(segment[layer][row].length / 2); + int distanceV = block - middleV; + int distanceH = row - middleH; + blockPlacingConsumer.get(segment[layer][row][block]).accept(pos.offset(distanceH, height, distanceV)); + } + } + height++; + } + return height; + } +} + + + +// placeLog(pos, logState); +// placeLog(pos.above(), logState); +// placeLog(pos.south(), logState); +// placeLog(pos.south(2), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.north(), logState); +// placeLog(pos.north(2), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.east(), logState); +// placeLog(pos.east(2), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.west(), logState); +// placeLog(pos.west(2), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.east().above(), woodState); +// placeLog(pos.west().above(), woodState); +// placeLog(pos.south().above(), woodState); +// placeLog(pos.north().above(), woodState); +// +// height = placeTrunk(pos, logState, height); +// +// //crown +// placeLog(pos.offset(0, height + 1, 0), logState); +// placeLog(pos.offset(0, height + 2, 0), logState); +// placeLog(pos.offset(0, height + 3, 0), logState); +// placeLog(pos.offset(0, height + 4, 0), logState); +// placeLog(pos.offset(0, height + 5, 0), logState); +// placeLog(pos.offset(0, height + 6, 0), woodState); +// placeLog(pos.offset(0, height + 2, 1), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(0, height + 2, 2), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(0, height + 2, 3), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(0, height + 2, 4), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(0, height + 2, -1), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(0, height + 2, -2), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(0, height + 2, -3), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(0, height + 2, -4), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(1, height + 2, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(2, height + 2, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(3, height + 2, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(4, height + 2, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(-1, height + 2, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(-2, height + 2, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(-3, height + 2, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(-4, height + 2, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(1, height + 3, 1), woodState); +// placeLog(pos.offset(-1, height + 3, 1), woodState); +// placeLog(pos.offset(-1, height + 3, -1), woodState); +// placeLog(pos.offset(1, height + 3, -1), woodState); +// placeLog(pos.offset(-2, height + 3, -2), woodState); +// placeLog(pos.offset(2, height + 3, -2), woodState); +// placeLog(pos.offset(2, height + 3, 2), woodState); +// placeLog(pos.offset(-2, height + 3, 2), woodState); +// placeLog(pos.offset(1, height + 5, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(-1, height + 5, 0), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.X)); +// placeLog(pos.offset(0, height + 5, 1), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// placeLog(pos.offset(0, height + 5, -1), logState.setValue(PNRotatedPillarFlammableBlock.AXIS, Direction.Axis.Z)); +// +// //Leaves: +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 1, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(6, height + 1, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 1, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-6, height + 1, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 1, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 1, 6), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 1, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 1, -6), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 1, 4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 1, -4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 1, 4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 1, -4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(4, height + 1, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(4, height + 1, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-4, height + 1, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-4, height + 1, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 2, 5), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 2, 6), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 3, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 3, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 3, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 3, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 3, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 3, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 3, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 3, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 3, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 3, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 3, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 3, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 2, -5), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 2, -6), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(5, height + 2, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(6, height + 2, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-5, height + 2, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-6, height + 2, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 2, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 2, 4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 2, 5), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 2, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 2, 4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 2, 5), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 2, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 2, -4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 2, -5), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 2, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 2, -4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 2, -5), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 2, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(4, height + 2, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(5, height + 2, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 2, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(4, height + 2, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(5, height + 2, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 2, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-4, height + 2, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-5, height + 2, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 2, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-4, height + 2, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-5, height + 2, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 2, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 2, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 2, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 2, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 2, 4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 2, 4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 2, 4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 2, 4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 2, -4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 2, -4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 2, -4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 2, -4), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(4, height + 2, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(4, height + 2, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(4, height + 2, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(4, height + 2, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-4, height + 2, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-4, height + 2, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-4, height + 2, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-4, height + 2, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 3, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 3, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 3, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 3, 3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 3, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 3, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 3, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 3, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 3, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 3, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 3, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 3, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 3, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 3, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 3, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 3, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 3, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 3, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 3, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 3, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(3, height + 3, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 3, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-3, height + 3, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 3, -3), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 4, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 4, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 4, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 4, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 4, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 4, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 4, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 4, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(2, height + 5, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 5, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 5, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 5, 2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 5, -2), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 5, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 5, -1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-2, height + 5, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 6, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(1, height + 6, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(-1, height + 6, 0), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 6, 1), 0, true)); +// list.add(new FoliagePlacer.FoliageAttachment(pos.offset(0, height + 6, -1), 0, true)); +// +// //Strobili: +// placeRandomFoliage(pos.offset(6, height, 0),0.4, 1, list); +// placeRandomFoliage(pos.offset(-6, height, 0),0.4, 1, list); +// placeRandomFoliage(pos.offset(0, height, 6),0.4, 1, list); +// placeRandomFoliage(pos.offset(0, height, -6),0.4,1, list); +// placeRandomFoliage(pos.offset(3, height, 4),0.4, 1, list); +// placeRandomFoliage(pos.offset(3, height, -4),0.4, 1, list); +// placeRandomFoliage(pos.offset(-3, height, 4),0.4, 1, list); +// placeRandomFoliage(pos.offset(-3, height, -4),0.4, 1, list); +// placeRandomFoliage(pos.offset(4, height, 3),0.4, 1, list); +// placeRandomFoliage(pos.offset(4, height, -3),0.4, 1, list); +// placeRandomFoliage(pos.offset(-4, height, 3),0.4, 1, list); +// placeRandomFoliage(pos.offset(-4, height, -3),0.4, 1, list); +// placeRandomFoliage(pos.offset(1, height + 1, 5),0.4, 1, list); +// placeRandomFoliage(pos.offset(-1, height + 1, 5),0.4, 1, list); +// placeRandomFoliage(pos.offset(1, height + 1, -5),0.4, 1, list); +// placeRandomFoliage(pos.offset(-1, height + 1, -5),0.4, 1, list); +// placeRandomFoliage(pos.offset(5, height + 1, 1),0.4, 1, list); +// placeRandomFoliage(pos.offset(5, height + 1, -1),0.4, 1, list); +// placeRandomFoliage(pos.offset(-5, height + 1, 1),0.4, 1, list); +// placeRandomFoliage(pos.offset(-5, height + 1, -1),0.4, 1, list); +