當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。