use of net.minecraft.block.BlockLog in project GregTech by GregTechCE.
the class TreeChopTask method isLogBlock.
public static int isLogBlock(IBlockState blockState) {
if (blockState.getMaterial() == Material.AIR) {
return 0;
}
if (blockState.getBlock() instanceof BlockLog) {
return 1;
} else if (blockState.getBlock() instanceof BlockLeaves) {
return 2;
}
Item itemBlock = Item.getItemFromBlock(blockState.getBlock());
ItemStack blockStack = new ItemStack(itemBlock, 1, blockState.getBlock().damageDropped(blockState));
Set<String> blocks = OreDictUnifier.getOreDictionaryNames(blockStack);
if (blocks.contains("logWood")) {
return 1;
} else if (blocks.contains("treeLeaves")) {
return 2;
} else
return 0;
}
use of net.minecraft.block.BlockLog in project BetterWithAddons by DaedalusGame.
the class StumpingHandler method breakBlock.
@SubscribeEvent
public void breakBlock(PlayerEvent.BreakSpeed breakEvent) {
World world = breakEvent.getEntity().getEntityWorld();
BlockPos breakpos = breakEvent.getPos();
IBlockState state = world.getBlockState(breakpos);
Block block = state.getBlock();
float speed = breakEvent.getNewSpeed();
float multiplier = 1f;
if (InteractionBTWTweak.HARD_STUMPS) {
if (block instanceof BlockLog && state.getValue(BlockLog.LOG_AXIS) == BlockLog.EnumAxis.Y) {
IBlockState bottomstate = world.getBlockState(breakpos.down());
Material material = bottomstate.getMaterial();
if (material == Material.GROUND || material == Material.GRASS)
multiplier = (float) InteractionBTWTweak.HARD_STUMPS_MODIFIER;
}
}
if (InteractionBTWTweak.SOFT_WOODS) {
WoodHardness wood = getSoftWood(block, block.damageDropped(state));
if (wood != null)
multiplier = wood.hardness / state.getBlockHardness(world, breakpos);
}
breakEvent.setNewSpeed(speed * multiplier);
}
use of net.minecraft.block.BlockLog in project Realistic-Terrain-Generation by Team-RTG.
the class TreeRTGQuercusRobur method func_175937_a.
void func_175937_a(BlockPos p_175937_1_, BlockPos p_175937_2_, IBlockState p_175937_3_) {
BlockPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ());
int i = this.getGreatestDistance(blockpos);
float f = (float) blockpos.getX() / (float) i;
float f1 = (float) blockpos.getY() / (float) i;
float f2 = (float) blockpos.getZ() / (float) i;
for (int j = 0; j <= i; ++j) {
BlockPos blockpos1 = p_175937_1_.add((double) (0.5F + (float) j * f), (double) (0.5F + (float) j * f1), (double) (0.5F + (float) j * f2));
BlockLog.EnumAxis blocklog$enumaxis = this.func_175938_b(p_175937_1_, blockpos1);
this.setBlockAndNotifyAdequately(this.world, blockpos1, p_175937_3_.withProperty(BlockLog.LOG_AXIS, blocklog$enumaxis));
}
}
use of net.minecraft.block.BlockLog in project takumicraft by TNTModders.
the class TakumiWorldGenBigTree method limb.
void limb(BlockPos p_175937_1_, BlockPos p_175937_2_, Block p_175937_3_) {
BlockPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ());
int i = this.getGreatestDistance(blockpos);
float f = (float) blockpos.getX() / (float) i;
float f1 = (float) blockpos.getY() / (float) i;
float f2 = (float) blockpos.getZ() / (float) i;
for (int j = 0; j <= i; ++j) {
BlockPos blockpos1 = p_175937_1_.add((double) (0.5F + (float) j * f), (double) (0.5F + (float) j * f1), (double) (0.5F + (float) j * f2));
if (this.log.getBlock() instanceof BlockLog) {
EnumAxis blocklog$enumaxis = this.getLogAxis(p_175937_1_, blockpos1);
this.setBlockAndNotifyAdequately(this.world, blockpos1, p_175937_3_.getDefaultState().withProperty(BlockLog.LOG_AXIS, blocklog$enumaxis));
} else {
this.setBlockAndNotifyAdequately(this.world, blockpos1, p_175937_3_.getDefaultState());
}
}
}
Aggregations