Java Code Examples for net.minecraft.block.material.Material#water()

The following examples show how to use net.minecraft.block.material.Material#water() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OceanMonument.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
private static void generatePillar(World world, int x, int y, int z, Block block, int meta) {
	for (int i = 1; i <= 5; i++)
		generatePillarSection(world, x, y - i, z, block, meta);
	y -= 5;

	for (; y >= 0; y--) {
		generatePillarSection(world, x, y, z, block, meta);
		for (int i = 0; i < 4; i++)
			for (int k = 0; k < 4; k++)
				if (world.getBlock(x + i, y, z).getMaterial() != Material.water && y > 3) {
					generatePillarSection(world, x, y - 1, z, block, meta);
					generatePillarSection(world, x, y - 2, z, block, meta);
					return;
				}
	}
}
 
Example 2
Source File: MoCTools.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static float distanceToSurface(Entity entity)
{
    //double d = entity.posY + (double)entity.getEyeHeight();
    int i = MathHelper.floor_double(entity.posX);
    int j = MathHelper.floor_double(entity.posY);
    int k = MathHelper.floor_double(entity.posZ);
    int l = entity.worldObj.getBlockId(i, j, k);
    if (l != 0 && Block.blocksList[l].blockMaterial == Material.water)
    {
        for (int x = 1; x < 64; x++)
        {
            l = entity.worldObj.getBlockId(i, j + x, k);
            if (l == 0 || Block.blocksList[l].blockMaterial != Material.water) { return (float) x; }
        }

    }
    return 0F;

}
 
Example 3
Source File: ExtendedFluidCollection.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
private static void populateAmmonia()
{
    Fluid tAmmoniaFluid = ModFluidManager.GetNewFluid("Ammonia");
    tAmmoniaFluid.setGaseous(true);
    tAmmoniaFluid.setViscosity(-500);
    tAmmoniaFluid.setDensity(0);
    tAmmoniaFluid.setLuminosity(8);
    tAmmoniaFluid.setTemperature(300);
    tAmmoniaFluid.setRarity(EnumRarity.epic); // The rarity of the fluid. Used primarily in tool tips.
    
    _mAmmonia = new ModSimpleBaseFluid(tAmmoniaFluid, Material.water);

    
    // Add potion effects to the fluid if player steps into a pool
    // Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
    // Level 0: Potion Level I
    // Level 1: Potion Level II
    // ...
    // For the duration: Set it low to vanish the effect as soon as the player leaves the pool
    // If you set the duration to 200, the potion timer will start to tick for 10 seconds after 
    // the player has left the pool.
    //_mAmmonia.addPotionEffect(new PotionEffect(Potion.blindness.id, 2, 0));
    
    // Same for stacking potion effects, except that you want to set the duration to the amount which will be
    // ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
    // fluid block
    _mAmmonia.addStackingPotionEffect(new PotionEffect(bop_loaded?24:Potion.poison.id, 20, 0));
    
    _mAmmonia.setRegisterBucket(false); // don't register a bucket
}
 
Example 4
Source File: ExtendedFluidCollection.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
private static void populateNitricAcid()
{
    Fluid tNitricAcidFluid = ModFluidManager.GetNewFluid("NitricAcid");
    tNitricAcidFluid.setGaseous(false);
    tNitricAcidFluid.setViscosity(1000);
    tNitricAcidFluid.setDensity(1);
    tNitricAcidFluid.setLuminosity(0);
    tNitricAcidFluid.setTemperature(300);
    tNitricAcidFluid.setRarity(EnumRarity.epic); // The rarity of the fluid. Used primarily in tool tips.

    _mNitricAcid = new ModSimpleBaseFluid(tNitricAcidFluid, Material.water);


    // Add potion effects to the fluid if player steps into a pool
    // Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
    // Level 0: Potion Level I
    // Level 1: Potion Level II
    // ...
    // For the duration: Set it low to vanish the effect as soon as the player leaves the pool
    // If you set the duration to 200, the potion timer will start to tick for 10 seconds after
    // the player has left the pool.
    _mNitricAcid.addPotionEffect(new PotionEffect(Potion.weakness.id, 20, 1));

    // Same for stacking potion effects, except that you want to set the duration to the amount which will be
    // ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
    // fluid block
    _mNitricAcid.addStackingPotionEffect(new PotionEffect(Potion.poison.id, 10, 0));

    _mNitricAcid.setRegisterBucket(true); // don't register a bucket
}
 
Example 5
Source File: ExtendedFluidCollection.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
private static void populateFermentedBacterialSludge()
{
    Fluid tFermentedBacterialSludge = ModFluidManager.GetNewFluid("FermentedBacterialSludge");
    tFermentedBacterialSludge.setGaseous(false);
    tFermentedBacterialSludge.setViscosity(1000);
    tFermentedBacterialSludge.setDensity(1);
    tFermentedBacterialSludge.setLuminosity(8);
    tFermentedBacterialSludge.setTemperature(300);
    tFermentedBacterialSludge.setRarity(EnumRarity.epic); // The rarity of the fluid. Used primarily in tool tips.

    _mFermentedBacterialSludge = new ModSimpleBaseFluid(tFermentedBacterialSludge, Material.water);


    // Add potion effects to the fluid if player steps into a pool
    // Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
    // Level 0: Potion Level I
    // Level 1: Potion Level II
    // ...
    // For the duration: Set it low to vanish the effect as soon as the player leaves the pool
    // If you set the duration to 200, the potion timer will start to tick for 10 seconds after
    // the player has left the pool.

    // Same for stacking potion effects, except that you want to set the duration to the amount which will be
    // ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
    // fluid block
    _mFermentedBacterialSludge.addStackingPotionEffect(new PotionEffect(bop_loaded?24:Potion.poison.id, 20, 0));

    _mFermentedBacterialSludge.addStackingPotionEffect(new PotionEffect(bop_loaded?25:Potion.moveSlowdown.id, 20, 0));

    _mFermentedBacterialSludge.setRegisterBucket(true); // don't register a bucket
}
 
Example 6
Source File: ExtendedFluidCollection.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
private static void populateEnrichedBacterialSludge()
{
    Fluid tEnrichedBacterialSludge = ModFluidManager.GetNewFluid("EnrichedBacterialSludge");
    tEnrichedBacterialSludge.setGaseous(false);
    tEnrichedBacterialSludge.setViscosity(1000);
    tEnrichedBacterialSludge.setDensity(1);
    tEnrichedBacterialSludge.setLuminosity(15);
    tEnrichedBacterialSludge.setTemperature(300);
    tEnrichedBacterialSludge.setRarity(EnumRarity.epic); // The rarity of the fluid. Used primarily in tool tips.

    _mEnrichedBacterialSludge = new ModSimpleBaseFluid(tEnrichedBacterialSludge, Material.water);


    // Add potion effects to the fluid if player steps into a pool
    // Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
    // Level 0: Potion Level I
    // Level 1: Potion Level II
    // ...
    // For the duration: Set it low to vanish the effect as soon as the player leaves the pool
    // If you set the duration to 200, the potion timer will start to tick for 10 seconds after
    // the player has left the pool.

    // Same for stacking potion effects, except that you want to set the duration to the amount which will be
    // ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
    // fluid block
    _mEnrichedBacterialSludge.addStackingPotionEffect(new PotionEffect(bop_loaded?24:Potion.poison.id, 40, 0));

    _mEnrichedBacterialSludge.addStackingPotionEffect(new PotionEffect(bop_loaded?25:Potion.moveSlowdown.id, 40, 0));

    _mEnrichedBacterialSludge.setRegisterBucket(true); // don't register a bucket
}
 
Example 7
Source File: ExtendedFluidCollection.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
private static void populateCompressedOxygen()
{
    Fluid tCompressedOxygenFluid = ModFluidManager.GetNewFluid("CompressedOxygen");
    tCompressedOxygenFluid.setGaseous(true);
    tCompressedOxygenFluid.setViscosity(1);
    tCompressedOxygenFluid.setDensity(1);
    tCompressedOxygenFluid.setLuminosity(0);
    tCompressedOxygenFluid.setTemperature(295);
    tCompressedOxygenFluid.setRarity(EnumRarity.epic); // The rarity of the fluid. Used primarily in tool tips.

    _mCompressedOxygen = new ModSimpleBaseFluid(tCompressedOxygenFluid, Material.water);


    // Add potion effects to the fluid if player steps into a pool
    // Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
    // Level 0: Potion Level I
    // Level 1: Potion Level II
    // ...
    // For the duration: Set it low to vanish the effect as soon as the player leaves the pool
    // If you set the duration to 200, the potion timer will start to tick for 10 seconds after
    // the player has left the pool.
    _mCompressedOxygen.addPotionEffect(new PotionEffect(Potion.weakness.id, 20, 3));

    // Same for stacking potion effects, except that you want to set the duration to the amount which will be
    // ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
    // fluid block
    _mCompressedOxygen.addStackingPotionEffect(new PotionEffect(Potion.weakness.id, 20, 3));

    _mCompressedOxygen.setRegisterBucket(false); // don't register a bucket
}
 
Example 8
Source File: ExtendedFluidCollection.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
private static void populateCompressedNitrogen()
{
    Fluid tCompressedNitrogenFluid = ModFluidManager.GetNewFluid("CompressedNitrogen");
    tCompressedNitrogenFluid.setGaseous(true);
    tCompressedNitrogenFluid.setViscosity(1);
    tCompressedNitrogenFluid.setDensity(1);
    tCompressedNitrogenFluid.setLuminosity(0);
    tCompressedNitrogenFluid.setTemperature(295);
    tCompressedNitrogenFluid.setRarity(EnumRarity.epic); // The rarity of the fluid. Used primarily in tool tips.

    _mCompressedNitrogen = new ModSimpleBaseFluid(tCompressedNitrogenFluid, Material.water);


    // Add potion effects to the fluid if player steps into a pool
    // Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
    // Level 0: Potion Level I
    // Level 1: Potion Level II
    // ...
    // For the duration: Set it low to vanish the effect as soon as the player leaves the pool
    // If you set the duration to 200, the potion timer will start to tick for 10 seconds after
    // the player has left the pool.
    _mCompressedNitrogen.addPotionEffect(new PotionEffect(Potion.weakness.id, 20, 3));

    // Same for stacking potion effects, except that you want to set the duration to the amount which will be
    // ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
    // fluid block
    _mCompressedNitrogen.addStackingPotionEffect(new PotionEffect(Potion.weakness.id, 20, 3));

    _mCompressedNitrogen.setRegisterBucket(false); // don't register a bucket
}
 
Example 9
Source File: ExtendedFluidCollection.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
private static void populatePollution()
{
    Fluid tPollution = ModFluidManager.GetNewFluid("Pollution");
    tPollution.setGaseous(false);
    tPollution.setViscosity(1);
    tPollution.setDensity(1);
    tPollution.setLuminosity(0);
    tPollution.setTemperature(295);
    tPollution.setRarity(EnumRarity.epic); // The rarity of the fluid. Used primarily in tool tips.

    _mPollution = new ModSimpleBaseFluid(tPollution, Material.water);


    // Add potion effects to the fluid if player steps into a pool
    // Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
    // Level 0: Potion Level I
    // Level 1: Potion Level II
    // ...
    // For the duration: Set it low to vanish the effect as soon as the player leaves the pool
    // If you set the duration to 200, the potion timer will start to tick for 10 seconds after
    // the player has left the pool.
    _mPollution.addPotionEffect(new PotionEffect(Potion.weakness.id, 20, 3));

    // Same for stacking potion effects, except that you want to set the duration to the amount which will be
    // ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
    // fluid block
    _mPollution.addStackingPotionEffect(new PotionEffect(Potion.weakness.id, 20, 3));
    _mPollution.addStackingPotionEffect(new PotionEffect(Potion.poison.id, 10, 0));

    _mPollution.setRegisterBucket(true); // don't register a bucket
}
 
Example 10
Source File: Sponge.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
private boolean absorb(World world, int x, int y, int z) {
	LinkedList<Tuple> linkedlist = Lists.newLinkedList();
	ArrayList<WorldCoord> arraylist = Lists.newArrayList();
	linkedlist.add(new Tuple(new WorldCoord(x, y, z), 0));
	int i = 0;
	WorldCoord blockpos1;

	while (!linkedlist.isEmpty()) {
		Tuple tuple = linkedlist.poll();
		blockpos1 = (WorldCoord) tuple.getFirst();
		int j = (Integer) tuple.getSecond();

		for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
			WorldCoord blockpos2 = blockpos1.add(dir);

			if (world.getBlock(blockpos2.x, blockpos2.y, blockpos2.z).getMaterial() == Material.water) {
				world.setBlockToAir(blockpos2.x, blockpos2.y, blockpos2.z);
				arraylist.add(blockpos2);
				i++;
				if (j < 6)
					linkedlist.add(new Tuple(blockpos2, j + 1));
			}
		}

		if (i > 64)
			break;
	}

	Iterator<WorldCoord> iterator = arraylist.iterator();

	while (iterator.hasNext()) {
		blockpos1 = iterator.next();
		world.notifyBlockOfNeighborChange(blockpos1.x, blockpos1.y, blockpos1.z, Blocks.air);
	}

	return i > 0;
}
 
Example 11
Source File: EntityShip.java    From archimedes-ships with MIT License 5 votes vote down vote up
public static boolean isAABBInLiquidNotFall(World world, AxisAlignedBB aabb)
{
	int i = MathHelper.floor_double(aabb.minX);
	int j = MathHelper.floor_double(aabb.maxX + 1D);
	int k = MathHelper.floor_double(aabb.minY);
	int l = MathHelper.floor_double(aabb.maxY + 1D);
	int i1 = MathHelper.floor_double(aabb.minZ);
	int j1 = MathHelper.floor_double(aabb.maxZ + 1D);
	
	for (int x = i; x < j; ++x)
	{
		for (int y = k; y < l; ++y)
		{
			for (int z = i1; z < j1; ++z)
			{
				Block block = world.getBlock(x, y, z);
				
				if (block != null && (block.getMaterial() == Material.water || block.getMaterial() == Material.lava))
				{
					int j2 = world.getBlockMetadata(x, y, z);
					double d0 = y + 1;
					
					if (j2 < 8)
					{
						d0 = y + 1 - j2 / 8.0D;
						
						if (d0 >= aabb.minY)
						{
							return true;
						}
					}
				}
			}
		}
	}
	
	return false;
}
 
Example 12
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
private static boolean canCreatureTypeSpawnAtLocation(EnumCreatureType enumcreaturetype, World world, int i, int j, int k)
{
    if (enumcreaturetype.getCreatureMaterial() == Material.water)
    {
        return world.getBlockMaterial(i, j, k).isLiquid() && !world.isBlockNormalCube(i, j + 1, k);
    }
    else
    {
        return world.isBlockNormalCube(i, j - 1, k) && !world.isBlockNormalCube(i, j, k) && !world.getBlockMaterial(i, j, k).isLiquid() && !world.isBlockNormalCube(i, j + 1, k);
    }
}
 
Example 13
Source File: BlockBRGenericFluid.java    From BigReactors with MIT License 4 votes vote down vote up
public BlockBRGenericFluid(Fluid fluid, String unlocalizedName) {
	super(fluid, Material.water);

	setBlockName("fluid." + unlocalizedName + ".still");
}
 
Example 14
Source File: WrapperMaterial.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperMaterial getWater() {
    return new WrapperMaterial(Material.water);
}
 
Example 15
Source File: BlockFluidPneumaticCraft.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public BlockFluidPneumaticCraft(Fluid fluid){
    this(fluid, Material.water);
}
 
Example 16
Source File: MoCBlock.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
{
    int plantID = plant.getPlantID(world, x, y + 1, z);
    EnumPlantType plantType = plant.getPlantType(world, x, y + 1, z);

    if (plantID == cactus.blockID && blockID == cactus.blockID)
    {
        return true;
    }

    if (plantID == reed.blockID && blockID == reed.blockID)
    {
        return true;
    }
    
    
    if (plant instanceof BlockFlower)
    {
        return true;
    }

    switch (plantType)
    {
        case Desert: return blockID == sand.blockID;
        case Nether: return blockID == slowSand.blockID;
        case Crop:   return blockID == tilledField.blockID;
        case Cave:   return isBlockSolidOnSide(world, x, y, z, UP);
        case Plains: return blockID == grass.blockID || blockID == dirt.blockID;
        case Water:  return world.getBlockMaterial(x, y, z) == Material.water && world.getBlockMetadata(x, y, z) == 0;
        case Beach:
            boolean isBeach = (blockID == Block.grass.blockID || blockID == Block.dirt.blockID || blockID == Block.sand.blockID);
            boolean hasWater = (world.getBlockMaterial(x - 1, y, z    ) == Material.water ||
                                world.getBlockMaterial(x + 1, y, z    ) == Material.water ||
                                world.getBlockMaterial(x,     y, z - 1) == Material.water ||
                                world.getBlockMaterial(x,     y, z + 1) == Material.water);
            return isBeach && hasWater;
    }

    return false;
}
 
Example 17
Source File: BioFluidBlock.java    From bartworks with MIT License 4 votes vote down vote up
public BioFluidBlock() {
    super(FluidLoader.ff, Material.water);
    this.setBlockName("BioFluidBlock");
    //this.setCreativeTab(MainMod.BioTab);
    this.textureName = "gregtech:fluids/fluid.molten.autogenerated";
}