Java Code Examples for net.minecraft.world.World#doesBlockHaveSolidTopSurface()

The following examples show how to use net.minecraft.world.World#doesBlockHaveSolidTopSurface() . These examples are extracted from open source projects. 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 Project: qcraft-mod   File: BlockQuantumLogic.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean canPlaceBlockAt( World world, int x, int y, int z )
{
    if( World.doesBlockHaveSolidTopSurface( world, x, y - 1, z ) )
    {
        return super.canPlaceBlockAt( world, x, y, z );
    }
    return false;
}
 
Example 2
Source Project: qcraft-mod   File: BlockQuantumLogic.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean canBlockStay( World world, int x, int y, int z )
{
    if( World.doesBlockHaveSolidTopSurface( world, x, y - 1, z ) )
    {
        return super.canBlockStay( world, x, y, z );
    }
    return false;
}
 
Example 3
Source Project: Et-Futurum   File: Sponge.java    License: The Unlicense 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
	if (world.getBlockMetadata(x, y, z) == 1) {
		ForgeDirection dir = getRandomDirection(rand);

		if (dir != ForgeDirection.UP && !World.doesBlockHaveSolidTopSurface(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) {
			double d0 = x;
			double d1 = y;
			double d2 = z;

			if (dir == ForgeDirection.DOWN) {
				d1 -= 0.05D;
				d0 += rand.nextDouble();
				d2 += rand.nextDouble();
			} else {
				d1 += rand.nextDouble() * 0.8D;

				if (dir == ForgeDirection.EAST || dir == ForgeDirection.WEST) {
					d2 += rand.nextDouble();

					if (dir == ForgeDirection.EAST)
						d0++;
					else
						d0 += 0.05D;
				} else {
					d0 += rand.nextDouble();

					if (dir == ForgeDirection.SOUTH)
						d2++;
					else
						d2 += 0.05D;
				}
			}

			world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
		}
	}
}
 
Example 4
Source Project: archimedes-ships   File: BlockGauge.java    License: MIT License 5 votes vote down vote up
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
{
	if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z))
	{
		dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
		world.setBlockToAir(x, y, z);
	}
}
 
Example 5
Source Project: archimedes-ships   File: BlockCrate.java    License: MIT License 5 votes vote down vote up
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
{
	if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z))
	{
		dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
		world.setBlockToAir(x, y, z);
	}
}
 
Example 6
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
	return World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || par1World.getBlock(par2, par3 - 1, par4).equals(Blocks.glowstone);
}
 
Example 7
Source Project: archimedes-ships   File: BlockGauge.java    License: MIT License 4 votes vote down vote up
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z)
{
	return World.doesBlockHaveSolidTopSurface(world, x, y - 1, z);
}
 
Example 8
Source Project: archimedes-ships   File: BlockCrate.java    License: MIT License 4 votes vote down vote up
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z)
{
	return World.doesBlockHaveSolidTopSurface(world, x, y - 1, z);
}
 
Example 9
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
    return par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || par1World.getBlock(par2, par3 - 1, par4).equals(Blocks.glowstone);
}