Java Code Examples for net.minecraft.world.World.getBlockMetadata()

The following are Jave code examples for showing how to use getBlockMetadata() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Technical   File: BlastFurnaceAdvanced.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceAdvancedIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 2
Project: connor41-etfuturum2   File: InvertedDaylightDetector.java   Source Code and License Vote up 6 votes
@Override
public void func_149957_e(World world, int x, int y, int z) {
	if (!world.provider.hasNoSky) {
		int meta = world.getBlockMetadata(x, y, z);
		int light = world.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) - world.skylightSubtracted;
		float angle = world.getCelestialAngleRadians(1.0F);

		if (angle < (float) Math.PI)
			angle += (0.0F - angle) * 0.2F;
		else
			angle += ((float) Math.PI * 2F - angle) * 0.2F;

		light = Math.round(light * MathHelper.cos(angle));

		if (light < 0)
			light = 0;
		if (light > 15)
			light = 15;

		light = invertedValues[light];
		if (meta != light)
			world.setBlockMetadataWithNotify(x, y, z, light, 3);
	}
}
 
Example 3
Project: Technical   File: CentrifugeMedium.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeMediumIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 4
Project: Technical   File: Centrifuge.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 5
Project: Technical   File: RepairingForge.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.RepairingForgeActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.RepairingForgeIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 6
Project: Technical   File: Electrolyser.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.ElectrolyserActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectrolyserIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 7
Project: Technical   File: WasherMedium.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.WasherMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.WasherMediumIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 8
Project: Technical   File: BlastFurnaceMedium.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceMediumIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 9
Project: Technical   File: ElectricFurnaceAdvanced.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceAdvancedIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 10
Project: Technical   File: BlastFurnace.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 11
Project: Technical   File: Pump.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.PumpActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.PumpIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 12
Project: Technical   File: ElectricFurnaceBasic.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceBasicActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceBasicIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 13
Project: Technical   File: GrinderMedium.java   Source Code and License Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.GrinderMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.GrinderMediumIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 14
Project: connor41-etfuturum2   File: Sponge.java   Source Code and License Vote up 5 votes
@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 15
Project: Prospecting   File: BlockIndicatorFlowerDouble.java   Source Code and License Vote up 5 votes
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block b) {
	if (isTop(world, x, y, z)) {
		super.onNeighborBlockChange(world, x, y, z, b);
	} else if (world.getBlock(x, y+1, z) != this || world.getBlockMetadata(x, y+1, z) != 1) {
		world.setBlockToAir(x, y, z);
	}
}
 
Example 16
Project: ThaumOres   File: BlockInfusedBlockOre.java   Source Code and License Vote up 5 votes
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
	double viewDistance = 0D;
	double currentDistance = player.getDistance(x + 0.5D, y + 0.5D, z + 0.5D);
	boolean hasVisualAcuity = false;
	boolean hasWarpVisualAcuity = false;
	boolean canView = false;
	if (player != null) {
		hasVisualAcuity = ThaumUtils.isComplete(player, TOThaum.riVisualAcuity);
		hasWarpVisualAcuity = ThaumUtils.isComplete(player, TOThaum.riWarpVisualAcuity);
		if ((player.inventory.armorItemInSlot(3) != null)
				&& (player.inventory.armorItemInSlot(3).getItem() instanceof IRevealer)
				&& (((IRevealer) player.inventory.armorItemInSlot(3).getItem())
						.showNodes(player.inventory.armorItemInSlot(3), player))) {
			canView = true;
			viewDistance = hasVisualAcuity ? 32.0D : 16.0D;
		} else if ((player.inventory.getCurrentItem() != null)
				&& (player.inventory.getCurrentItem().getItem() instanceof ItemThaumometer)
				&& (UtilsFX.isVisibleTo(0.44F, player, x, y, z))) {
			canView = true;
			viewDistance = hasVisualAcuity ? 16.0D : 8.0D;
		}
		if (hasWarpVisualAcuity) {
			int warp = ThaumUtils.getWarp(player);
			canView = true;
			double warpViewDistance = warp * TOConfig.generalWarpVisualAcuityModifier;
			if (warpViewDistance > viewDistance)
				viewDistance = warpViewDistance;
		}
	}
	if (canView && currentDistance <= viewDistance) {
		return new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
	} else
		return new ItemStack(baseBlock, 1, baseMeta);
}
 
Example 17
Project: ThaumOres   File: TOInfusedOreWandTrigger.java   Source Code and License Vote up 5 votes
@Override
public boolean executeAction(World world, ItemStack wand, EntityPlayer player, int x, int y, int z, int side,
		int event) {
	int md = world.getBlockMetadata(x, y, z);
	BlockInfusedBlockOre block = (BlockInfusedBlockOre) world.getBlock(x, y, z);
	if (world.isRemote) {
		for (int i = 0; i < 10; i++)
			if (md < 6)
				UtilsFX.infusedStoneSparkle(world, x, y, z, md + 1);
		return false;
	} else {
		ForgeDirection dir = ForgeDirection.getOrientation(side);
		int iX = dir.equals(ForgeDirection.EAST) ? x + 1 : dir.equals(ForgeDirection.WEST) ? x - 1 : x;
		int iY = dir.equals(ForgeDirection.UP) ? y + 1 : dir.equals(ForgeDirection.DOWN) ? y - 1 : y;
		int iZ = dir.equals(ForgeDirection.SOUTH) ? z + 1 : dir.equals(ForgeDirection.NORTH) ? z - 1 : z;
		for (ItemStack item : block.getDropsWand(world, x, y, z, md, player.isSneaking())) {
			float f = 0.7F;
			double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
			double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
			double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
			EntityItem entityitem = new EntityItem(world, (double) iX + d0, (double) iY + d1, (double) iZ + d2,
					item);
			entityitem.delayBeforeCanPickup = 10;
			world.spawnEntityInWorld(entityitem);

		}
		world.setBlock(x, y, z, block.getBaseBlock(), block.getBaseMeta(), 2);
		return true;
	}
}
 
Example 18
Project: ThaumOres   File: BlockInfusedBlockOre.java   Source Code and License Vote up 5 votes
@SideOnly(Side.CLIENT)
@Override
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
	int md = worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ);
	if (md < 6)
		UtilsFX.infusedStoneSparkle(worldObj, target.blockX, target.blockY, target.blockZ, md + 1);
	return super.addHitEffects(worldObj, target, effectRenderer);
}
 
Example 19
Project: connor41-etfuturum2   File: ChorusFlower.java   Source Code and License Vote up 4 votes
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
	if (world.isRemote)
		return;
	int meta = world.getBlockMetadata(x, y, z);
	if (meta >= 5)
		return;

	if (!canBlockStay(world, x, y, z))
		world.func_147480_a(x, y, z, true);
	else if (world.isAirBlock(x, y + 1, z)) {
		boolean canGrowUp = false;
		boolean isSegmentOnEndstone = false;
		Block lowerBlock = world.getBlock(x, y - 1, z);
		if (lowerBlock == Blocks.end_stone)
			canGrowUp = true;
		else if (lowerBlock == ModBlocks.chorus_plant) {
			int par8 = 1;
			int height;
			for (height = 0; height < 4; height++) {
				Block b = world.getBlock(x, y - (par8 + 1), z);
				if (b != ModBlocks.chorus_plant) {
					if (b == Blocks.end_stone)
						isSegmentOnEndstone = true;
					break;
				}
				par8++;
			}

			height = 4;
			if (isSegmentOnEndstone)
				height++;

			if (par8 < 2 || rand.nextInt(height) >= par8)
				canGrowUp = true;
		} else if (lowerBlock.isAir(world, x, y - 1, z))
			canGrowUp = true;

		if (canGrowUp && isSpaceAroundFree(world, x, y + 1, z, ForgeDirection.DOWN) && world.isAirBlock(x, y + 2, z)) {
			world.setBlock(x, y, z, ModBlocks.chorus_plant);
			world.setBlock(x, y + 1, z, this, meta, 3);
		} else if (meta < 4) {
			int tries = rand.nextInt(4);
			boolean grew = false;
			if (isSegmentOnEndstone)
				tries++;
			for (int i = 0; i < tries; i++) {
				ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[rand.nextInt(ForgeDirection.VALID_DIRECTIONS.length)];
				int xx = x + dir.offsetX;
				int yy = y + dir.offsetY;
				int zz = z + dir.offsetZ;
				if (world.isAirBlock(xx, yy, zz) && isSpaceAroundFree(world, xx, yy, zz, dir.getOpposite())) {
					world.setBlock(xx, yy, zz, this, meta + 1, 3);
					grew = true;
				}
			}
			if (grew)
				world.setBlock(x, y, z, ModBlocks.chorus_plant, 0, 3);
			else
				world.setBlock(x, y, z, this, 5, 3);
		} else if (meta == 4)
			world.setBlock(x, y, z, this, 5, 3);
	}
}
 
Example 20
Project: Prospecting   File: BlockIndicatorFlowerDouble.java   Source Code and License Vote up 4 votes
private boolean isTop(World world, int x, int y, int z) {
	return world.getBlockMetadata(x, y, z) == 1;
}