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

The following are Jave code examples for showing how to use setBlockMetadataWithNotify() 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: 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 2
Project: Technical   File: CentrifugeAdvanced.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.CentrifugeAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeAdvancedIdle);

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

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 3
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 4
Project: Technical   File: RepairingForgeMedium.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.RepairingForgeMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.RepairingForgeMediumIdle);

	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: 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 6
Project: Technical   File: ElectricFurnaceMedium.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.ElectricFurnaceMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceMediumIdle);

	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: MinerAdvanced.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.MinerAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.MinerAdvancedIdle);

	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: 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 9
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 10
Project: Technical   File: Washer.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.WasherActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.WasherIdle);

	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: RepairingForgeAdvanced.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.RepairingForgeAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.RepairingForgeAdvancedIdle);

	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: Miner.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.MinerActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.MinerIdle);

	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: 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 14
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 15
Project: Technical   File: Machine.java   Source Code and License Vote up 6 votes
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemStack) {
	int direction = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

	if (direction == 0)
		world.setBlockMetadataWithNotify(x, y, z, 2, 2);

	if (direction == 1)
		world.setBlockMetadataWithNotify(x, y, z, 5, 2);

	if (direction == 2)
		world.setBlockMetadataWithNotify(x, y, z, 3, 2);

	if (direction == 3)
		world.setBlockMetadataWithNotify(x, y, z, 4, 2);

	if (itemStack.hasDisplayName()) {
		((TileEntityMachine) world.getTileEntity(x, y, z)).setMachineName(itemStack.getDisplayName());
	}
}
 
Example 16
Project: Technical   File: ElectricFurnace.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.ElectricFurnaceActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceIdle);

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

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 17
Project: Technical   File: Grinder.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.GrinderActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.GrinderIdle);

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

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 18
Project: connor41-etfuturum2   File: ItemGenericSlab.java   Source Code and License Vote up 5 votes
private boolean func_150946_a(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) {
	if (side == 0)
		y--;
	if (side == 1)
		y++;
	if (side == 2)
		z--;
	if (side == 3)
		z++;
	if (side == 4)
		x--;
	if (side == 5)
		x++;

	Block block = world.getBlock(x, y, z);
	int meta = world.getBlockMetadata(x, y, z);

	if (block == field_150939_a && meta != 2) {
		if (world.checkNoEntityCollision(field_150939_a.getCollisionBoundingBoxFromPool(world, x, y, z)) && world.setBlockMetadataWithNotify(x, y, z, 2, 3)) {
			world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, field_150939_a.stepSound.func_150496_b(), (field_150939_a.stepSound.getVolume() + 1.0F) / 2.0F, field_150939_a.stepSound.getPitch() * 0.8F);
			stack.stackSize--;
		}

		return true;
	} else
		return false;
}
 
Example 19
Project: connor41-etfuturum2   File: Sponge.java   Source Code and License Vote up 4 votes
protected void tryAbsorb(World worldIn, int x, int y, int z, boolean wet) {
	if (!wet && absorb(worldIn, x, y, z)) {
		worldIn.setBlockMetadataWithNotify(x, y, z, 1, 2);
		worldIn.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(Blocks.water));
	}
}
 
Example 20
Project: OpenSensors   File: BlockSensor.java   Source Code and License Vote up 4 votes
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
	super.onBlockPlacedBy(world, x, y, z, player, stack);
	int dir = MathHelper.floor_double((double) ((player.rotationYaw * 4F) / 360F) + 0.5D) & 3;
	world.setBlockMetadataWithNotify(x, y, z, dir, 3);
}