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


Java BlockSlab类代码示例

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


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

示例1: BlockWoodSlab

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public BlockWoodSlab(WoodMaterial wd) {
	super(Material.WOOD);
	this.setSoundType(SoundType.WOOD);
	this.wood = wd;
	this.blockHardness = wood.getPlankBlockHardness();
	this.blockResistance = wood.getBlastResistance();
	this.setHarvestLevel("axe", wood.getRequiredHarvestLevel());
	Blocks.FIRE.setFireInfo(this, 5, 20);
	IBlockState iblockstate = this.blockState.getBaseState();
	if (!this.isDouble()) {
		iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
	}
	this.setDefaultState(iblockstate.withProperty(VARIANT, BlockWoodSlab.Variant.DEFAULT));
	this.useNeighborBrightness = !this.isDouble();
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:16,代码来源:BlockWoodSlab.java

示例2: canPlaceBlockOnSide

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
    BlockPos blockpos = pos;
    IProperty iproperty = this.singleSlab.getVariantProperty();
    Object object = this.singleSlab.getVariant(stack);
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this.singleSlab)
    {
        boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;

        if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && object == iblockstate.getValue(iproperty))
        {
            return true;
        }
    }

    pos = pos.offset(side);
    IBlockState iblockstate1 = worldIn.getBlockState(pos);
    return iblockstate1.getBlock() == this.singleSlab && object == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:ItemSlab.java

示例3: BlockRubberSlab

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public BlockRubberSlab() {
	super(Material.WOOD, MapColor.WOOD);
	IBlockState iblockstate = this.blockState.getBaseState();

	if (!this.isDouble()) {
		iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
		setRegistryName(new ResourceLocation(TRConstants.MOD_ID, "rubber_slab"));
	} else {
		setRegistryName(new ResourceLocation(TRConstants.MOD_ID, "rubber_double_slab"));
	}
	setCreativeTab(TechRebornCreativeTab.TECHREBORN);
	setUnlocalizedName(getRegistryName().toString());
	setHarvestLevel("axe", 0);
	setHardness(2.0F);
	setResistance(15);
	setSoundType(SoundType.WOOD);
	TechReborn.blockModelsToRegister.add(this);

	this.setDefaultState(iblockstate.withProperty(VARIANT, BlockRubberSlab.Variant.DEFAULT));
}
 
开发者ID:TechReborn,项目名称:TechReborn3,代码行数:21,代码来源:BlockRubberSlab.java

示例4: test_getSubtype

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void test_getSubtype() throws Exception
{
    ContentBlockSlab content = new ContentBlockSlab();
    content.subtypes = new int[] {0, 1, 2, 3, 4, 5, 6, 7};
    content.id = "test_getSubtype";

    Block block = content.createBlock();
    CSBlock<ContentBlockSlab> csblock = (CSBlock<ContentBlockSlab>) block;
    for (int subtype = 0; subtype < 8; subtype++)
    {
        for (BlockSlab.EnumBlockHalf facing : BlockSlabWithSubtypes.HALF.getAllowedValues())
        {
            IBlockState state = block.getDefaultState()
                                     .withProperty(BlockSlabWithSubtypes.HALF, facing)
                                     .withProperty(BlockHelper.getSubtypeProperty(content.subtypes), EnumSubtype.values()[subtype]);

            assertEquals(subtype, csblock.getSubtype(state));
        }
    }

}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:24,代码来源:BlockSlabWithSubtypesTest.java

示例5: canPlaceBlockOnSide

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
    BlockPos blockpos = pos;
    IProperty<?> iproperty = this.singleSlab.getVariantProperty();
    Comparable<?> comparable = this.singleSlab.getTypeForItem(stack);
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this.singleSlab)
    {
        boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;

        if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && comparable == iblockstate.getValue(iproperty))
        {
            return true;
        }
    }

    pos = pos.offset(side);
    IBlockState iblockstate1 = worldIn.getBlockState(pos);
    return iblockstate1.getBlock() == this.singleSlab && comparable == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:ItemSlab.java

示例6: canPlaceBlockOnSide

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
    BlockPos blockpos = pos;
    IProperty<?> iproperty = this.singleSlab.getVariantProperty();
    Comparable<?> comparable = this.singleSlab.getTypeForItem(stack);
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this.singleSlab)
    {
        boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;

        if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && comparable == iblockstate.getValue(iproperty))
        {
            return true;
        }
    }

    pos = pos.offset(side);
    IBlockState iblockstate1 = worldIn.getBlockState(pos);
    return iblockstate1.getBlock() == this.singleSlab && comparable == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:ItemSlab.java

示例7: placeHut

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public static void placeHut(final World world, BlockPos startpos, int[][][] data, IBlockState[] states, Random rand) {
  for (int pass = 0; pass <= 1; pass++) {
    for (int y = 0; y < data.length; y++) {
      for (int x = 0; x < 6; x++) {
        for (int z = 0; z < 6; z++) {
          BlockPos pos = startpos.add(x + 5, -y + 5, z + 5);
          if (data[y][z][x] != -1) {
            IBlockState state = states[data[y][z][x]];
            if (state == null || (pass == 0 && (state.getBlock() instanceof BlockCarpet || state.getBlock() instanceof BlockSapling))) {
              world.setBlockToAir(pos);
            } else if (state.getBlock() instanceof BlockFalling) {
              while (world.getBlockState(pos).getBlock().isReplaceable(world, pos) && !world.isAirBlock(new BlockPos(pos.getX(), 0, pos.getZ()))) {
                world.setBlockState(pos, state);
                world.immediateBlockTick(pos, state, rand);
              }
            } else if (!(state.getBlock() instanceof BlockSlab)
                || (world.getBlockState(pos).getBlock().isReplaceable(world, pos) && world.getBlockState(pos).getMaterial() != Material.WATER)) {
              world.setBlockState(pos, state);
            }
          }
        }
      }
    }
  }
}
 
开发者ID:HenryLoenwind,项目名称:TravelHut,代码行数:26,代码来源:WorldGenHandler.java

示例8: getMetaFromState

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
@Override
  public int getMetaFromState(IBlockState state)
  {
if (!this.isDouble())
{
	if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.BOTTOM)
	{
		return 0;
	}
	else if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
	{
		return 1;
	}
}

return 0;
  }
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:18,代码来源:BlockAetherSlab.java

示例9: canPlaceBlockOnSide

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
    BlockPos blockpos = pos;
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this.singleSlab)
    {
        boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;

        if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag))
        {
            return true;
        }
    }

    pos = pos.offset(side);
    IBlockState iblockstate1 = worldIn.getBlockState(pos);
    return iblockstate1.getBlock() == this.singleSlab ? true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack);
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:21,代码来源:ItemAetherSlab.java

示例10: BlockGlassSlab

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public BlockGlassSlab()
{
	super(Material.GLASS);

	this.setSoundType(SoundType.GLASS);
	IBlockState iblockstate = this.blockState.getBaseState();
	this.setHardness(0.5F);
	
	if (!this.isDouble())
	{
		iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
		ModRegistry.setBlockName(this, "block_half_glass_slab");
		this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
	}
	else
	{
		ModRegistry.setBlockName(this, "block_glass_slab");
	}
	
	iblockstate = iblockstate.withProperty(VARIANT_PROPERTY, false);

	this.setDefaultState(iblockstate);
	this.useNeighborBrightness = !this.isDouble();
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:25,代码来源:BlockGlassSlab.java

示例11: BlockGraniteSlab

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public BlockGraniteSlab()
{
	super(Material.ROCK);

	this.setSoundType(SoundType.STONE);
	IBlockState iblockstate = this.blockState.getBaseState();
	this.setHardness(0.5F);
	
	if (!this.isDouble())
	{
		iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
		ModRegistry.setBlockName(this, "block_half_granite_slab");
		this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
	}
	else
	{
		ModRegistry.setBlockName(this, "block_granite_slab");
	}
	
	iblockstate = iblockstate.withProperty(VARIANT_PROPERTY, false);

	this.setDefaultState(iblockstate);
	this.useNeighborBrightness = !this.isDouble();
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:25,代码来源:BlockGraniteSlab.java

示例12: BlockDioriteSlab

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public BlockDioriteSlab()
{
	super(Material.ROCK);

	this.setSoundType(SoundType.STONE);
	IBlockState iblockstate = this.blockState.getBaseState();
	this.setHardness(0.5F);
	
	if (!this.isDouble())
	{
		iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
		ModRegistry.setBlockName(this, "block_half_diorite_slab");
		this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
	}
	else
	{
		ModRegistry.setBlockName(this, "block_diorite_slab");
	}
	
	iblockstate = iblockstate.withProperty(VARIANT_PROPERTY, false);

	this.setDefaultState(iblockstate);
	this.useNeighborBrightness = !this.isDouble();
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:25,代码来源:BlockDioriteSlab.java

示例13: BlockAndesiteSlab

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
public BlockAndesiteSlab()
{
	super(Material.ROCK);

	this.setSoundType(SoundType.STONE);
	IBlockState iblockstate = this.blockState.getBaseState();
	this.setHardness(0.5F);
	
	if (!this.isDouble())
	{
		iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
		ModRegistry.setBlockName(this, "block_half_andesite_slab");
		this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
	}
	else
	{
		ModRegistry.setBlockName(this, "block_andesite_slab");
	}
	
	iblockstate = iblockstate.withProperty(VARIANT_PROPERTY, false);

	this.setDefaultState(iblockstate);
	this.useNeighborBrightness = !this.isDouble();
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:25,代码来源:BlockAndesiteSlab.java

示例14: canPlaceBlockOnSide

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)  {
    if (block instanceof AlchemyBlockSlab && !((BlockSlab) block).isDouble()) {
    	BlockSlab singleSlab = (BlockSlab) block;
    	BlockPos blockpos = pos;
        IProperty<?> iproperty = singleSlab.getVariantProperty();
        Comparable<?> comparable = singleSlab.getTypeForItem(stack);
        IBlockState iblockstate = worldIn.getBlockState(pos);
        if (iblockstate.getBlock() == singleSlab) {
            boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;
            if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && comparable == iblockstate.getValue(iproperty))
            	return true;
        }
        pos = pos.offset(side);
        IBlockState iblockstate1 = worldIn.getBlockState(pos);
        return iblockstate1.getBlock() == singleSlab && comparable == iblockstate1.getValue(iproperty) ?
        		true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack);
    } else
    	return super.canPlaceBlockOnSide(worldIn, pos, side, player, stack);
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:22,代码来源:AlchemyItemBlock.java

示例15: tryPlace

import net.minecraft.block.BlockSlab; //导入依赖的package包/类
private boolean tryPlace(EntityPlayer player, ItemStack stack, World worldIn, BlockPos pos, Object itemSlabType) {
    if (block instanceof AlchemyBlockSlab && !((BlockSlab) block).isDouble()) {
    	BlockSlab singleSlab = (BlockSlab) block;
    	IBlockState iblockstate = worldIn.getBlockState(pos);
        if (iblockstate.getBlock() == singleSlab) {
            Comparable<?> comparable = iblockstate.getValue(singleSlab.getVariantProperty());
            if (comparable == itemSlabType) {
                IBlockState iblockstate1 = makeSlabState(singleSlab.getVariantProperty(), comparable);
                AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(worldIn, pos);
                if (axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(pos)) &&
                		worldIn.setBlockState(pos, iblockstate1, 11)) {
                    SoundType soundtype = singleSlab.getSoundType(iblockstate1, worldIn, pos, player);
                    worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS,
                    		(soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
                    stack.setCount(stack.getCount() - 1);
                }
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:23,代码来源:AlchemyItemBlock.java


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