mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 03:25:07 +00:00
Add tiny shrub log
This commit is contained in:
1 parent
11c40fa158
commit
3919edcc3e
12 files changed
+555
-41
No files matched your search
@@ -49,8 +49,7 @@ public enum EnumETLog implements IWoodType {
|
||||
Eucalyptus3("Eucalyptus", PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
PinkIvory("Pink Ivory", PlankType.ExtraTreePlanks.PinkIvory),
|
||||
Cherry("Cherry", PlankType.ForestryPlanks.CHERRY),
|
||||
Cinnamon("Cinnamon", PlankType.VanillaPlanks.JUNGLE),
|
||||
Shrub("Shrub", PlankType.VanillaPlanks.OAK);
|
||||
Cinnamon("Cinnamon", PlankType.VanillaPlanks.JUNGLE);
|
||||
|
||||
public static final EnumETLog[] VALUES = values();
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package binnie.extratrees.block;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import binnie.Constants;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public enum EnumShrubLog implements IWoodType {
|
||||
INSTANCE;
|
||||
|
||||
public static final EnumShrubLog[] VALUES = values();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "shrub_log";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHardness() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCarbonization() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCharcoalChance(int numberOfCharcoal) {
|
||||
if (numberOfCharcoal == 3) {
|
||||
return 0.75F;
|
||||
} else if (numberOfCharcoal == 4) {
|
||||
return 0.5F;
|
||||
} else if (numberOfCharcoal == 5) {
|
||||
return 0.25F;
|
||||
}
|
||||
return 0.15F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlankTexture() {
|
||||
return Constants.EXTRA_TREES_MOD_ID + ":null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeartTexture() {
|
||||
return Constants.EXTRA_TREES_MOD_ID + ":null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDoorLowerTexture() {
|
||||
return Constants.EXTRA_TREES_MOD_ID + ":null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDoorUpperTexture() {
|
||||
return Constants.EXTRA_TREES_MOD_ID + ":null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBarkTexture() {
|
||||
return Constants.EXTRA_TREES_MOD_ID + ":null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import binnie.extratrees.block.wood.BlockETFence;
|
||||
import binnie.extratrees.block.wood.BlockETLog;
|
||||
import binnie.extratrees.block.wood.BlockETPlank;
|
||||
import binnie.extratrees.block.wood.BlockETSlab;
|
||||
import binnie.extratrees.block.wood.BlockShrubLog;
|
||||
import binnie.extratrees.block.wood.ItemBlockETWood;
|
||||
import binnie.extratrees.block.wood.ItemETSlab;
|
||||
import binnie.extratrees.genetics.ETTreeDefinition;
|
||||
@@ -29,6 +30,8 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.arboriculture.WoodAccess;
|
||||
import forestry.arboriculture.blocks.BlockForestryFenceGate;
|
||||
import forestry.arboriculture.blocks.BlockForestryStairs;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.arboriculture.items.ItemBlockWoodDoor;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.OreDictUtil;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -72,6 +75,7 @@ public class ModuleBlocks implements IInitializable {
|
||||
public Block blockDoor;
|
||||
public BlockMultiFence blockMultiFence;
|
||||
public BlockHedge blockHedge;
|
||||
public BlockShrubLog shrubLog;
|
||||
//????
|
||||
public Block blockBranch;
|
||||
|
||||
@@ -242,6 +246,11 @@ public class ModuleBlocks implements IInitializable {
|
||||
speciesToLeavesDecorative.put(speciesUid, new ItemStack(leaves, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
shrubLog = new BlockShrubLog();
|
||||
ExtraTrees.proxy.registerBlock(shrubLog, new ItemBlockETWood(shrubLog));
|
||||
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, false, shrubLog.getStateFromMeta(0), new ItemStack(shrubLog, 1, 0));
|
||||
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, true, shrubLog.getStateFromMeta(1), new ItemStack(shrubLog, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ public class WoodManager {
|
||||
|
||||
String displayName;
|
||||
|
||||
if (woodType instanceof EnumETLog) {
|
||||
if (woodType instanceof EnumETLog || woodType instanceof EnumShrubLog) {
|
||||
String customUnlocalizedName = "tile.et." + blockKind + "." + woodType + ".name";
|
||||
if (Translator.canTranslateToLocal(customUnlocalizedName)) {
|
||||
displayName = Translator.translateToLocal(customUnlocalizedName);
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
package binnie.extratrees.block.wood;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.core.models.DefaultStateMapper;
|
||||
import binnie.extratrees.block.EnumShrubLog;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouseDoor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.pattern.BlockStateMatcher;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.block.statemap.BlockStateMapper;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegister, IItemModelRegister {
|
||||
|
||||
public static final PropertyBool FIREPROOF = PropertyBool.create("fireproof");
|
||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
public static final PropertyBool WEST = PropertyBool.create("west");
|
||||
protected static final AxisAlignedBB[] BOUNDING_BOXES = new AxisAlignedBB[] {
|
||||
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
|
||||
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
|
||||
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
|
||||
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
|
||||
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
|
||||
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
|
||||
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
|
||||
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
|
||||
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D) };
|
||||
public static final AxisAlignedBB PILLAR_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.5D, 0.625D);
|
||||
public static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.625D, 0.625D, 1.5D, 1.0D);
|
||||
public static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.375D, 1.5D, 0.625D);
|
||||
public static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.5D, 0.375D);
|
||||
public static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.625D, 0.0D, 0.375D, 1.0D, 1.5D, 0.625D);
|
||||
|
||||
public BlockShrubLog() {
|
||||
super(Material.WOOD);
|
||||
this.setDefaultState(this.blockState.getBaseState()
|
||||
.withProperty(NORTH, false)
|
||||
.withProperty(EAST, false)
|
||||
.withProperty(SOUTH, false)
|
||||
.withProperty(WEST, false)
|
||||
.withProperty(FIREPROOF, false));
|
||||
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "shrub_log"));
|
||||
setUnlocalizedName("shrub_log");
|
||||
setSoundType(SoundType.WOOD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
|
||||
List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
|
||||
if (!p_185477_7_) {
|
||||
state = state.getActualState(worldIn, pos);
|
||||
}
|
||||
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, PILLAR_AABB);
|
||||
|
||||
if (state.getValue(NORTH)) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB);
|
||||
}
|
||||
|
||||
if (state.getValue(EAST)) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
|
||||
}
|
||||
|
||||
if (state.getValue(SOUTH)) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB);
|
||||
}
|
||||
|
||||
if (state.getValue(WEST)) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
state = this.getActualState(state, source, pos);
|
||||
return BOUNDING_BOXES[getBoundingBoxIdx(state)];
|
||||
}
|
||||
|
||||
private static int getBoundingBoxIdx(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if (state.getValue(NORTH)) {
|
||||
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(EAST)) {
|
||||
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(SOUTH)) {
|
||||
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(WEST)) {
|
||||
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos,
|
||||
EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(FIREPROOF) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(FIREPROOF, meta == 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
return state.withProperty(NORTH, canFenceConnectTo(worldIn, pos, EnumFacing.NORTH))
|
||||
.withProperty(EAST, canFenceConnectTo(worldIn, pos, EnumFacing.EAST))
|
||||
.withProperty(SOUTH, canFenceConnectTo(worldIn, pos, EnumFacing.SOUTH))
|
||||
.withProperty(WEST, canFenceConnectTo(worldIn, pos, EnumFacing.WEST));
|
||||
}
|
||||
|
||||
private boolean canFenceConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing) {
|
||||
IBlockState blockState = world.getBlockState(pos.offset(facing));
|
||||
Block block = blockState.getBlock();
|
||||
return block.isLeaves(blockState, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
switch (rot) {
|
||||
case CLOCKWISE_180:
|
||||
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST))
|
||||
.withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
|
||||
case COUNTERCLOCKWISE_90:
|
||||
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH))
|
||||
.withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
|
||||
case CLOCKWISE_90:
|
||||
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH))
|
||||
.withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
||||
switch (mirrorIn) {
|
||||
case LEFT_RIGHT:
|
||||
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
|
||||
case FRONT_BACK:
|
||||
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
|
||||
default:
|
||||
return super.withMirror(state, mirrorIn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] { NORTH, EAST, WEST, SOUTH, FIREPROOF });
|
||||
}
|
||||
|
||||
@Override
|
||||
public WoodBlockKind getBlockKind() {
|
||||
return WoodBlockKind.LOG;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerStateMapper() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(FIREPROOF).build());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0, "shrub_trunk");
|
||||
manager.registerItemModel(item, 1, "shrub_trunk");
|
||||
}
|
||||
|
||||
//TODO: Add meta to forestry api
|
||||
@Override
|
||||
public boolean isFireproof() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWoodType getWoodType(int meta) {
|
||||
return EnumShrubLog.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends IWoodType> getWoodTypes() {
|
||||
return Collections.singletonList(EnumShrubLog.INSTANCE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +1,80 @@
|
||||
package binnie.extratrees.gen;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.arboriculture.ITreeModifier;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import forestry.arboriculture.worldgen.TreeBlockTypeLeaf;
|
||||
import forestry.arboriculture.worldgen.TreeBlockTypeLog;
|
||||
import forestry.arboriculture.worldgen.WorldGenArboriculture;
|
||||
import forestry.core.worldgen.WorldGenHelper;
|
||||
import forestry.core.worldgen.WorldGenHelper.EnumReplaceMode;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class WorldGenShrub {
|
||||
public static class Shrub extends WorldGenTree {
|
||||
public static class Shrub extends WorldGenArboriculture {
|
||||
private static final int minHeight = 1;
|
||||
private static final int maxHeight = 10;
|
||||
|
||||
protected int girth;
|
||||
protected int height;
|
||||
|
||||
public Shrub(ITreeGenData tree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
float leafSpawn = this.height;
|
||||
float width = this.height * this.randBetween(0.7f, 0.9f);
|
||||
public Set<BlockPos> generateTrunk(World world, Random rand, TreeBlockTypeLog wood, BlockPos startPos) {
|
||||
WorldGenHelper.generateTreeTrunk(world, rand, wood, startPos, height, girth, 0, 0, null, 0);
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
|
||||
float leafSpawn = this.height + 1;
|
||||
float width = this.height * WorldGenUtils.randBetween(rand, 0.7f, 0.9f);
|
||||
if (width < 1.5f) {
|
||||
width = 1.5f;
|
||||
}
|
||||
final float f = 0.0f;
|
||||
final float h = leafSpawn;
|
||||
leafSpawn = h - 1.0f;
|
||||
this.generateCylinder(new Vector(f, h, 0.0f), 0.4f * width, 1, this.leaf, false);
|
||||
final float f2 = 0.0f;
|
||||
final float h2 = leafSpawn;
|
||||
leafSpawn = h2 - 1.0f;
|
||||
this.generateCylinder(new Vector(f2, h2, 0.0f), 0.8f * width, 1, this.leaf, false);
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 0.25f * width + girth, 1, EnumReplaceMode.SOFT);
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 0.5f * width + girth, 1, EnumReplaceMode.SOFT);
|
||||
while (leafSpawn >= 0.0f) {
|
||||
final float f3 = 0.0f;
|
||||
final float h3 = leafSpawn;
|
||||
leafSpawn = h3 - 1.0f;
|
||||
this.generateCylinder(new Vector(f3, h3, 0.0f), width, 1, this.leaf, false);
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, width + girth, 1, EnumReplaceMode.SOFT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateExtras(World world, Random rand, BlockPos startPos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preGenerate() {
|
||||
this.minHeight = 1;
|
||||
this.height = this.determineHeight(1, 1);
|
||||
this.girth = this.determineGirth(this.treeGen.getGirth());
|
||||
@Nullable
|
||||
public BlockPos getValidGrowthPos(World world, BlockPos pos) {
|
||||
return tree.canGrow(world, pos, girth, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void preGenerate(World world, Random rand, BlockPos startPos) {
|
||||
super.preGenerate(world, rand, startPos);
|
||||
height = determineHeight(world, rand, 1, 1);
|
||||
girth = tree.getGirth();
|
||||
}
|
||||
|
||||
private int determineHeight(World world, Random rand, int required, int variation) {
|
||||
ITreeModifier treeModifier = TreeManager.treeRoot.getTreekeepingMode(world);
|
||||
int baseHeight = required + rand.nextInt(variation);
|
||||
int height = Math.round(baseHeight * tree.getHeightModifier() * treeModifier.getHeightModifier(tree.getGenome(), 1f));
|
||||
return height < minHeight ? minHeight : height > maxHeight ? maxHeight : height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package binnie.extratrees.genetics;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.core.genetics.ForestryAllele;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.block.EnumETLog;
|
||||
import binnie.extratrees.block.EnumShrubLog;
|
||||
import binnie.extratrees.gen.WorldGenAlder;
|
||||
import binnie.extratrees.gen.WorldGenApple;
|
||||
import binnie.extratrees.gen.WorldGenAsh;
|
||||
@@ -1548,7 +1550,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(AlleleManager.alleleRegistry.getFruitFamily("forestry.nuts"));
|
||||
}
|
||||
},
|
||||
Blackcurrant("ribes", "nigrum", EnumLeafType.DECIDUOUS, new Color(0xA6DA5C), new Color(0xA6DA5C), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
Blackcurrant("ribes", "nigrum", EnumLeafType.DECIDUOUS, new Color(0xA6DA5C), new Color(0xA6DA5C), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -1571,7 +1573,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(ETFruitFamily.Berry);
|
||||
}
|
||||
},
|
||||
Redcurrant("ribes", "rubrum", EnumLeafType.DECIDUOUS, new Color(0x74AC00), new Color(0x74AC00), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
Redcurrant("ribes", "rubrum", EnumLeafType.DECIDUOUS, new Color(0x74AC00), new Color(0x74AC00), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -1594,7 +1596,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(ETFruitFamily.Berry);
|
||||
}
|
||||
},
|
||||
Blackberry("rubus", "fruticosus", EnumLeafType.DECIDUOUS, new Color(0x92C15B), new Color(0x92C15B), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
Blackberry("rubus", "fruticosus", EnumLeafType.DECIDUOUS, new Color(0x92C15B), new Color(0x92C15B), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -1616,7 +1618,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(ETFruitFamily.Berry);
|
||||
}
|
||||
},
|
||||
Raspberry("rubus", "idaeus", EnumLeafType.DECIDUOUS, new Color(0x83B96E), new Color(0x83B96E), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
Raspberry("rubus", "idaeus", EnumLeafType.DECIDUOUS, new Color(0x83B96E), new Color(0x83B96E), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -1639,7 +1641,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(ETFruitFamily.Berry);
|
||||
}
|
||||
},
|
||||
Blueberry("vaccinium", "corymbosum", EnumLeafType.DECIDUOUS, new Color(0x72C750), new Color(0x72C750), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
Blueberry("vaccinium", "corymbosum", EnumLeafType.DECIDUOUS, new Color(0x72C750), new Color(0x72C750), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -1662,7 +1664,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(ETFruitFamily.Berry);
|
||||
}
|
||||
},
|
||||
Cranberry("vaccinium", "oxycoccos", EnumLeafType.DECIDUOUS, new Color(0x96D179), new Color(0x96D179), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
Cranberry("vaccinium", "oxycoccos", EnumLeafType.DECIDUOUS, new Color(0x96D179), new Color(0x96D179), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -1685,7 +1687,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(ETFruitFamily.Berry);
|
||||
}
|
||||
},
|
||||
Juniper("juniperus", "communis", EnumLeafType.CONIFERS, new Color(0x90B149), new Color(0x90B149), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
Juniper("juniperus", "communis", EnumLeafType.CONIFERS, new Color(0x90B149), new Color(0x90B149), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -1708,7 +1710,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(ETFruitFamily.Berry);
|
||||
}
|
||||
},
|
||||
Gooseberry("ribes", "grossularia", EnumLeafType.DECIDUOUS, new Color(0x79BB00), new Color(0x79BB00), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
Gooseberry("ribes", "grossularia", EnumLeafType.DECIDUOUS, new Color(0x79BB00), new Color(0x79BB00), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -1730,7 +1732,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
species.addFruitFamily(ETFruitFamily.Berry);
|
||||
}
|
||||
},
|
||||
GoldenRaspberry("rubus", "occidentalis", EnumLeafType.DECIDUOUS, new Color(0x83B96E), new Color(0x83B96E), EnumSaplingType.Shrub, EnumETLog.Shrub, new Color(0xFFFFFF)) {
|
||||
GoldenRaspberry("rubus", "occidentalis", EnumLeafType.DECIDUOUS, new Color(0x83B96E), new Color(0x83B96E), EnumSaplingType.Shrub, EnumShrubLog.INSTANCE, new Color(0xFFFFFF)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenShrub.Shrub(tree);
|
||||
@@ -2156,7 +2158,10 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
|
||||
IBlockState logBlock = TreeManager.woodAccess.getBlock(woodType, WoodBlockKind.LOG, fireproof);
|
||||
|
||||
BlockLog.EnumAxis axis = BlockLog.EnumAxis.fromFacingAxis(facing.getAxis());
|
||||
return world.setBlockState(pos, logBlock.withProperty(BlockLog.LOG_AXIS, axis));
|
||||
if(logBlock.getBlock() instanceof BlockLog){
|
||||
logBlock = logBlock.withProperty(BlockLog.LOG_AXIS, axis);
|
||||
}
|
||||
return world.setBlockState(pos, logBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user