use of net.minecraft.block.state.IBlockState in project MinecraftForge by MinecraftForge.
the class BlockFluidBase method getFlowDirection.
public static double getFlowDirection(IBlockAccess world, BlockPos pos) {
IBlockState state = world.getBlockState(pos);
if (!state.getMaterial().isLiquid()) {
return -1000.0;
}
Vec3d vec = ((BlockFluidBase) state.getBlock()).getFlowVector(world, pos);
return vec.xCoord == 0.0D && vec.zCoord == 0.0D ? -1000.0D : Math.atan2(vec.zCoord, vec.xCoord) - Math.PI / 2D;
}
use of net.minecraft.block.state.IBlockState in project MinecraftForge by MinecraftForge.
the class BlockFluidBase method getFluidHeightForRender.
public float getFluidHeightForRender(IBlockAccess world, BlockPos pos) {
IBlockState here = world.getBlockState(pos);
IBlockState up = world.getBlockState(pos.down(densityDir));
if (here.getBlock() == this) {
if (up.getMaterial().isLiquid() || up.getBlock() instanceof IFluidBlock) {
return 1;
}
if (getMetaFromState(here) == getMaxRenderHeightMeta()) {
return 0.875F;
}
}
if (here.getBlock() instanceof BlockLiquid) {
return Math.min(1 - BlockLiquid.getLiquidHeightPercent(here.getValue(BlockLiquid.LEVEL)), 14f / 16);
}
return !here.getMaterial().isSolid() && up.getBlock() == this ? 1 : this.getQuantaPercentage(world, pos) * 0.875F;
}
use of net.minecraft.block.state.IBlockState in project MinecraftForge by MinecraftForge.
the class BlockFluidClassic method getQuantaValue.
@Override
public int getQuantaValue(IBlockAccess world, BlockPos pos) {
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == Blocks.AIR) {
return 0;
}
if (state.getBlock() != this) {
return -1;
}
int quantaRemaining = quantaPerBlock - state.getValue(LEVEL);
return quantaRemaining;
}
use of net.minecraft.block.state.IBlockState in project MinecraftForge by MinecraftForge.
the class BlockFluidClassic method canFlowInto.
protected boolean canFlowInto(IBlockAccess world, BlockPos pos) {
if (world.isAirBlock(pos))
return true;
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == this) {
return true;
}
if (displacements.containsKey(state.getBlock())) {
return displacements.get(state.getBlock());
}
Material material = state.getMaterial();
if (material.blocksMovement() || material == Material.WATER || material == Material.LAVA || material == Material.PORTAL) {
return false;
}
int density = getDensity(world, pos);
if (density == Integer.MAX_VALUE) {
return true;
}
if (this.density > density) {
return true;
} else {
return false;
}
}
use of net.minecraft.block.state.IBlockState in project MinecraftForge by MinecraftForge.
the class BlockLiquidWrapper method getTankProperties.
@Override
public IFluidTankProperties[] getTankProperties() {
FluidStack containedStack = null;
IBlockState blockState = world.getBlockState(blockPos);
if (blockState.getBlock() == blockLiquid) {
containedStack = getStack(blockState);
}
return new FluidTankProperties[] { new FluidTankProperties(containedStack, Fluid.BUCKET_VOLUME, false, true) };
}
Aggregations