当前位置: 首页>>代码示例>>Java>>正文


Java World.setBlock方法代码示例

本文整理汇总了Java中net.minecraft.world.World.setBlock方法的典型用法代码示例。如果您正苦于以下问题:Java World.setBlock方法的具体用法?Java World.setBlock怎么用?Java World.setBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.World的用法示例。


在下文中一共展示了World.setBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addOreSpawn

import net.minecraft.world.World; //导入方法依赖的package包/类
private void addOreSpawn(Block block, Block target, World world, Random random, int posX, int posZ) {
	int veinSize = 96;
	veinSize += random.nextInt(128);
	int posY = random.nextInt(16 + 64 - (1 + block.getHarvestLevel(0)) * 16);
	if(random.nextInt(25 + block.getHarvestLevel(0) * 5) == 0) {
		new TechnicalWorldGenMinable(block, veinSize, target).generateSparse(world, random, posX, posY, posZ);
	} else {
		for(int i = 0; i < 10; i++) {
			int x = posX + random.nextInt(16);
			int y = random.nextInt(128);
			int z = posZ + random.nextInt(16);
			if(world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, target)) {
				world.setBlock(x, y, z, block);
			}
		}
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:18,代码来源:TechnicalWorldGenerator.java

示例2: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:Centrifuge.java

示例3: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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.ElectrolyserMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectrolyserMediumIdle);

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

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:ElectrolyserMedium.java

示例4: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:Miner.java

示例5: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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.GrinderAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.GrinderAdvancedIdle);

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

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:GrinderAdvanced.java

示例6: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:CentrifugeAdvanced.java

示例7: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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.MinerMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.MinerMediumIdle);

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

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:MinerMedium.java

示例8: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
	if (world.isRemote)
		return;

	int surroundingBlockCount = 0;
	for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
		Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
		if (block == this || block == Blocks.ice || block == Blocks.packed_ice)
			if (++surroundingBlockCount >= 4)
				break;
	}

	if (surroundingBlockCount < 4 || rand.nextInt(100) <= 33) {
		int meta = world.getBlockMetadata(x, y, z);
		if (meta < 3)
			world.setBlockMetadataWithNotify(x, y, z, meta + 1, 2);
		else
			world.setBlock(x, y, z, Blocks.water);
	}

	world.scheduleBlockUpdate(x, y, z, this, 40 + rand.nextInt(40));
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:24,代码来源:FrostedIce.java

示例9: onItemUse

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
	if (stack.stackSize == 0)
		return false;
	else if (!player.canPlayerEdit(x, y, z, side, stack))
		return false;
	else {
		Block block = world.getBlock(x, y, z);
		int meta = world.getBlockMetadata(x, y, z);
		boolean flag = meta == 1;

		if (block == field_150939_a && (side == 1 && !flag || side == 0 && flag)) {
			if (world.checkNoEntityCollision(field_150939_a.getCollisionBoundingBoxFromPool(world, x, y, z)) && world.setBlock(x, y, z, field_150939_a, 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 func_150946_a(stack, player, world, x, y, z, side) ? true : super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:23,代码来源:ItemGenericSlab.java

示例10: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:Grinder.java

示例11: removeStone

import net.minecraft.world.World; //导入方法依赖的package包/类
private void removeStone(World world, Random random, int x, int z) {
	int id = world.getBiomeGenForCoords(x, z).biomeID;
	Block block = Blocks.stone;

	if(id == 35 || id == 163 || id == 29 || id == 157 || id == 6 || id == 134 || id == 160 || id == 161 || id == 32 || id == 33) {
		block = Granite;
	} else if(id == 36 || id == 164 || id == 16 || id == 14 || id == 15 || id == 0 || id == 24 || id == 26) {
		block = Basalt;
	} else if(id == 2 || id == 1 || id == 7 || id == 129 || id == 5 || id == 30 || id == 11) {
		block = Limestone;
	} else if(id == 130 || id == 17 || id == 21 || id == 149 || id == 23 || id == 151 || id == 22 || id == 133 || id == 155 || id == 19 || id == 31 || id == 158 || id == 27) {
		block = Shale;
	} else if(id == 37 || id == 165 || id == 132 || id == 4 || id == 3 || id == 131 || id == 34 || id == 162 || id == 28 || id == 156 || id == 25) {
		block = Slate;
	} else if(id == 39 || id == 167 || id == 38 || id == 166 || id == 18 || id == 13 || id == 12 || id == 140) {
		block = Gneiss;
	} else {
		FMLLog.log(Level.ERROR, Technical.modName + ": TechnicalWorldGenerator could not find stone type for " + world.getBiomeGenForCoords(x, z).biomeName + " (id " + id + "). Please report this to the mod author(s)");
	}

	for(int y = 0; y < world.getActualHeight(); y++) {
		if(world.getBlock(x, y, z) == Blocks.stone)
			world.setBlock(x, y, z, block, 0, 0);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:26,代码来源:TechnicalWorldGenerator.java

示例12: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:ElectricFurnaceAdvanced.java

示例13: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:RepairingForgeAdvanced.java

示例14: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:ElectricFurnaceBasic.java

示例15: updateBlockState

import net.minecraft.world.World; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:GrinderMedium.java


注:本文中的net.minecraft.world.World.setBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。