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

The following examples show how to use net.minecraft.world.World#doesBlockHaveSolidTopSurface() . 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: BlockQuantumLogic.java    From qcraft-mod with 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 File: BlockQuantumLogic.java    From qcraft-mod with 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 File: Sponge.java    From Et-Futurum with 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 File: BlockGauge.java    From archimedes-ships with 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 File: BlockCrate.java    From archimedes-ships with 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
Source File: BlockRoadLine.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
@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 File: BlockGauge.java    From archimedes-ships with 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 File: BlockCrate.java    From archimedes-ships with 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
Source File: BlockRoadLine.java    From Chisel with GNU General Public License v2.0 4 votes vote down vote up
@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);
}