use of com.ferreusveritas.dynamictrees.blocks.BlockTrunkShell in project DynamicTrees by DynamicTreesTeam.
the class WailaBranchHandler method getTreeVolume.
private float getTreeVolume(World world, BlockPos pos) {
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
// Dereference proxy trunk shell block
if (block instanceof BlockTrunkShell) {
ShellMuse muse = ((BlockTrunkShell) block).getMuse(world, pos);
if (muse != null) {
state = muse.state;
block = state.getBlock();
pos = muse.pos;
}
}
if (block instanceof BlockBranch) {
BlockBranch branch = (BlockBranch) block;
// Analyze only part of the tree beyond the break point and calculate it's volume, then destroy the branches
NodeNetVolume volumeSum = new NodeNetVolume();
branch.analyse(state, world, pos, null, new MapSignal(volumeSum));
return volumeSum.getVolume() * ModConfigs.treeHarvestMultiplier;
}
return 0;
}
use of com.ferreusveritas.dynamictrees.blocks.BlockTrunkShell in project DynamicTrees by DynamicTreesTeam.
the class WorldListener method sendBlockBreakProgress.
@Override
public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) {
if (mcServer == null) {
return;
}
IBlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof BlockTrunkShell) {
for (EntityPlayerMP entityplayermp : this.mcServer.getPlayerList().getPlayers()) {
if (entityplayermp != null && entityplayermp.world == this.world) {
double d0 = (double) pos.getX() - entityplayermp.posX;
double d1 = (double) pos.getY() - entityplayermp.posY;
double d2 = (double) pos.getZ() - entityplayermp.posZ;
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
BlockPos centerPos = pos.add(state.getValue(BlockTrunkShell.COREDIR).getOffset());
entityplayermp.connection.sendPacket(new SPacketBlockBreakAnim((-breakerId) - 1, centerPos, progress));
}
}
}
}
}
Aggregations