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

The following examples show how to use net.minecraft.world.World#func_147480_a() . 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: Et-Futurum   File: EntityRabbit.java    License: The Unlicense 6 votes vote down vote up
@Override
public void updateTask() {
	super.updateTask();
	getLookHelper().setLookPosition(destinationBlock.getX() + 0.5D, destinationBlock.getY() + 1, destinationBlock.getZ() + 0.5D, 10.0F, getVerticalFaceSpeed());

	if (getIsAboveDestination()) {
		World world = worldObj;
		BlockPos blockpos = destinationBlock.up();
		Block block = world.getBlock(blockpos.getX(), blockpos.getY(), blockpos.getZ());
		int meta = world.getBlockMetadata(blockpos.getX(), blockpos.getY(), blockpos.getZ());

		if (field_179499_e && block instanceof BlockCarrot && meta >= 7) {
			world.func_147480_a(blockpos.getX(), blockpos.getY(), blockpos.getZ(), false);
			carrotTicks = 100;
		}

		field_179499_e = false;
		runDelay = 10;
	}
}
 
Example 2
Source Project: Artifacts   File: BlockSpikes.java    License: MIT License 5 votes vote down vote up
@Override
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block)
   {
       if (!this.canBlockStay(par1World, par2, par3, par4))
       {
           par1World.func_147480_a/*destroyBlock*/(par2, par3, par4, true);
       }
   }
 
Example 3
Source Project: Et-Futurum   File: ChorusFlower.java    License: The Unlicense 4 votes vote down vote up
@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 4
Source Project: Et-Futurum   File: ChorusFlower.java    License: The Unlicense 4 votes vote down vote up
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) {
	if (!canBlockStay(world, x, y, z))
		world.func_147480_a(x, y, z, false);
}
 
Example 5
Source Project: Et-Futurum   File: ChorusPlant.java    License: The Unlicense 4 votes vote down vote up
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) {
	if (neighbour == this)
		world.func_147480_a(x, y, z, true);
}
 
Example 6
@Override
public void onHackFinished(World world, int x, int y, int z, EntityPlayer player){
    world.func_147480_a(x, y, z, true);//break block
}