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


Java BlockWood类代码示例

本文整理汇总了Java中net.minecraft.block.BlockWood的典型用法代码示例。如果您正苦于以下问题:Java BlockWood类的具体用法?Java BlockWood怎么用?Java BlockWood使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onItemUse

import net.minecraft.block.BlockWood; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float textureX, float textureY, float textureZ) {
   	if(!world.isRemote) {
   		if(world.getBlock(x, y, z) instanceof BlockColoured || world.getBlock(x, y, z) instanceof BlockColored || world.getBlock(x, y, z) instanceof BlockStainedGlass || world.getBlock(x, y, z) instanceof BlockStainedGlassPane) {
   			if(world.getBlockMetadata(x, y, z) != this.getDamage(itemstack)) {
   				world.setBlockMetadataWithNotify(x, y, z, this.getDamage(itemstack), 2);
   				player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
       			return true;
   			} else return false;
   		} else if(world.getBlock(x, y, z) instanceof BlockHardenedClay) {
   			world.setBlock(x, y, z, Blocks.stained_hardened_clay, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		} else if(world.getBlock(x, y, z) instanceof BlockGlass) {
   			world.setBlock(x, y, z, Blocks.stained_glass, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		} else if(world.getBlock(x, y, z) == Blocks.glass_pane) {
   			world.setBlock(x, y, z, Blocks.stained_glass_pane, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		} else if(world.getBlock(x, y, z) instanceof BlockWood) {
   			world.setBlock(x, y, z, ModBlocks.woodColoured, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		} else if(world.getBlock(x, y, z) == Blocks.brick_block) {
   			world.setBlock(x, y, z, ModBlocks.brickColoured, this.getDamage(itemstack), 2);
   			player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
   			return true;
   		}
   	}
   	return false;
   }
 
开发者ID:OmgImAlexis,项目名称:TheStuffMod,代码行数:34,代码来源:ItemPaintbrush.java

示例2: blockIdToSound

import net.minecraft.block.BlockWood; //导入依赖的package包/类
private String blockIdToSound(int id) {
  Block b = Block.blocksList[id];
  if (b == null) return "fysiksfun:rubble";
  if (b instanceof BlockWood || b instanceof BlockLog) return "fysiksfun:woodCrack";
  return "fysiksfun:rubble";
}
 
开发者ID:mbrx,项目名称:FysiksFun,代码行数:7,代码来源:SolidBlockPhysics.java


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