Java 类net.minecraftforge.fluids.BlockFluidFinite 实例源码

项目:EnderIOAddons    文件:EngineNiard.java   
public EngineNiard setFluid(Fluid fluid) {
  if (fluid.canBePlacedInWorld()) {
    this.radiusItr = radius >= 0 ? new RadiusIterator(owner.getLocation(), radius) : null;
    this.fluid = fluid;
    this.downflowDirection = fluid.getDensity() > 0 ? ForgeDirection.DOWN : ForgeDirection.UP;
    block = fluid.getBlock();
    if (block instanceof BlockFluidClassic) {
      type = FluidType.CLASSIC;
    } else if (block instanceof BlockFluidFinite) {
      type = FluidType.FINITE;
    } else if (block instanceof BlockLiquid) {
      type = FluidType.VANILLA;
    } else {
      this.fluid = null;
    }
  } else {
    this.fluid = null;
  }
  return this;
}
项目:EnderIOAddons    文件:EngineNiard.java   
private void setSourceBlock(BlockCoord bc) {
  Block blockToSet = block;
  int metaToSet = 0;
  final World world = owner.getWorldObj();
  switch (type) {
  case CLASSIC:
    metaToSet = ((BlockFluidClassic) block).getMaxRenderHeightMeta();
    break;
  case FINITE:
    metaToSet = ((BlockFluidFinite) block).getMaxRenderHeightMeta();
    break;
  case VANILLA:
    if (world.provider.isHellWorld && fluid == FluidRegistry.WATER && !niardAllowWaterInHell.getBoolean()) {
      world.playSoundEffect(bc.x + 0.5F, bc.y + 0.1F, bc.z + 0.5F, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
      for (int l = 0; l < 8; ++l) {
        spawnParticle(world, "largesmoke", bc.x - 1 + 3 * Math.random(), bc.y + Math.random(), bc.z - 1 + 3 * Math.random(), 0.0D, 0.0D, 0.0D);
      }
      setVerticalBlock(bc, false);
      return;
    }
    metaToSet = 0;
    break;
  }
  world.setBlock(bc.x, bc.y, bc.z, blockToSet, metaToSet, 3);
}
项目:EnderIOAddons    文件:FluidHelper.java   
private FluidHelper(@Nonnull World world, @Nonnull FluidStack stack, @Nullable BlockCoord startbc) throws Exception {
  this.world = world;
  this.stack = stack;
  this.fluid = notnullF(stack.getFluid(), "FluidStack.getFluid()");
  this.block = notnull(fluid.getBlock(), "Invalid Fluid (it has no source block)");
  this.downflowDirection = fluid.getDensity() > 0 ? ForgeDirection.DOWN : ForgeDirection.UP;
  this.upflowDirection = downflowDirection == ForgeDirection.UP ? ForgeDirection.DOWN : ForgeDirection.UP;
  if (this.block instanceof BlockFluidClassic) {
    this.type = FluidType.CLASSIC;
  } else if (this.block instanceof BlockFluidFinite) {
    this.type = FluidType.FINITE;
  } else if (this.block instanceof BlockLiquid) {
    this.type = FluidType.VANILLA;
  } else {
    throw new Exception();
  }
  this.startbc = startbc;
}
项目:EnderIOAddons    文件:FluidHelper.java   
public static boolean isSourceBlock(@Nonnull World world, @Nonnull BlockCoord bc) {
  if (!world.blockExists(bc.x, bc.y, bc.z)) {
    return false;
  }
  Block block = bc.getBlock(world);
  if (block instanceof BlockFluidClassic) {
    return ((BlockFluidClassic) block).isSourceBlock(world, bc.x, bc.y, bc.z);
  } else if (block instanceof BlockFluidFinite) {
    return ((BlockFluidFinite)block).canDrain(world, bc.x, bc.y, bc.z);
  } else if (block instanceof BlockLiquid) {
    return world.getBlockMetadata(bc.x, bc.y, bc.z) == 0;
  } else {
    return false;
  }
}
项目:Enterprise    文件:FluidPrefab.java   
public BlockFluidBase makeBlock(){
    return new BlockFluidFinite(this, Material.water);
}
项目:Gizmos    文件:FluidPrefab.java   
public BlockFluidBase makeBlock(){
    return new BlockFluidFinite(this, Material.water);
}