本文整理汇总了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;
}
示例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";
}