Search in sources :

Example 1 with ICell

use of com.ferreusveritas.dynamictrees.api.cells.ICell in project DynamicTrees by DynamicTreesTeam.

the class BlockDynamicLeaves method getHydrationLevelFromNeighbors.

/**
 * Gathers hydration levels from neighbors before pushing the values into the solver
 */
public int getHydrationLevelFromNeighbors(IBlockAccess access, BlockPos pos, ILeavesProperties leavesProp) {
    ICell[] cells = new ICell[6];
    for (EnumFacing dir : EnumFacing.VALUES) {
        BlockPos deltaPos = pos.offset(dir);
        IBlockState state = access.getBlockState(deltaPos);
        ITreePart part = TreeHelper.getTreePart(state);
        cells[dir.ordinal()] = part.getHydrationCell(access, deltaPos, state, dir, leavesProp);
    }
    // Find center cell's value from neighbors
    return leavesProp.getCellKit().getCellSolver().solve(cells);
}
Also used : ITreePart(com.ferreusveritas.dynamictrees.api.treedata.ITreePart) IBlockState(net.minecraft.block.state.IBlockState) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) ICell(com.ferreusveritas.dynamictrees.api.cells.ICell)

Aggregations

ICell (com.ferreusveritas.dynamictrees.api.cells.ICell)1 ITreePart (com.ferreusveritas.dynamictrees.api.treedata.ITreePart)1 IBlockState (net.minecraft.block.state.IBlockState)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1