本文整理匯總了Java中net.minecraft.block.BlockStairs類的典型用法代碼示例。如果您正苦於以下問題:Java BlockStairs類的具體用法?Java BlockStairs怎麽用?Java BlockStairs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BlockStairs類屬於net.minecraft.block包,在下文中一共展示了BlockStairs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: canPlaceTorchOn
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4)
{
if (par1World.isBlockNormalCubeDefault(par2, par3, par4, true))
{
return true;
}
Block i = par1World.getBlock(par2, par3, par4);
if (i == Blocks.fence || i == Blocks.nether_brick_fence || i == Blocks.glass)
{
return true;
}
if (i != null && (i instanceof BlockStairs))
{
int j = par1World.getBlockMetadata(par2, par3, par4);
if ((4 & j) != 0)
{
return true;
}
}
return false;
}
示例2: isSideSolid
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
@Override
public boolean isSideSolid(IBlockState state,IBlockAccess world, BlockPos pos, EnumFacing side)
{
boolean flipped = state.getValue(BlockStairs.HALF) == EnumHalf.TOP;
EnumShape shape = (EnumShape)state.getValue(BlockStairs.SHAPE);
EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING);
if (side == EnumFacing.UP) return flipped;
if (side == EnumFacing.DOWN) return !flipped;
if (facing == side) return true;
if (flipped)
{
if (shape == EnumShape.INNER_LEFT) return side == facing.rotateYCCW();
if (shape == EnumShape.INNER_RIGHT) return side == facing.rotateY();
}
else
{
if (shape == EnumShape.INNER_LEFT) return side == facing.rotateY();
if (shape == EnumShape.INNER_RIGHT) return side == facing.rotateYCCW();
}
return false;
}
示例3: doesSideBlockRendering
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
@Override
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
{
if (net.minecraftforge.common.ForgeModContainer.disableStairSlabCulling)
return super.doesSideBlockRendering(state, world, pos, face);
if ( state.isOpaqueCube() )
return true;
state = this.getActualState(state, world, pos);
EnumHalf half = state.getValue(BlockStairs.HALF);
EnumFacing side = state.getValue(BlockStairs.FACING);
EnumShape shape = state.getValue(BlockStairs.SHAPE);
if (face == EnumFacing.UP) return half == EnumHalf.TOP;
if (face == EnumFacing.DOWN) return half == EnumHalf.BOTTOM;
if (shape == EnumShape.OUTER_LEFT || shape == EnumShape.OUTER_RIGHT) return false;
if (face == side) return true;
if (shape == EnumShape.INNER_LEFT && face.rotateY() == side) return true;
if (shape == EnumShape.INNER_RIGHT && face.rotateYCCW() == side) return true;
return false;
}
示例4: getCollisionBoxList
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
private static List<AxisAlignedBB> getCollisionBoxList(IBlockState bstate)
{
List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
boolean flag = bstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
list.add(flag ? AABB_SLAB_TOP : AABB_SLAB_BOTTOM);
BlockStairs.EnumShape blockstairs$enumshape = (BlockStairs.EnumShape)bstate.getValue(BlockStairs.SHAPE);
if (blockstairs$enumshape == BlockStairs.EnumShape.STRAIGHT || blockstairs$enumshape == BlockStairs.EnumShape.INNER_LEFT || blockstairs$enumshape == BlockStairs.EnumShape.INNER_RIGHT)
{
list.add(getCollQuarterBlock(bstate));
}
if (blockstairs$enumshape != BlockStairs.EnumShape.STRAIGHT)
{
list.add(getCollEighthBlock(bstate));
}
return list;
}
示例5: getCollQuarterBlock
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
private static AxisAlignedBB getCollQuarterBlock(IBlockState bstate)
{
boolean flag = bstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
switch ((EnumFacing)bstate.getValue(BlockStairs.FACING))
{
case NORTH:
default:
return flag ? AABB_QTR_BOT_NORTH : AABB_QTR_TOP_NORTH;
case SOUTH:
return flag ? AABB_QTR_BOT_SOUTH : AABB_QTR_TOP_SOUTH;
case WEST:
return flag ? AABB_QTR_BOT_WEST : AABB_QTR_TOP_WEST;
case EAST:
return flag ? AABB_QTR_BOT_EAST : AABB_QTR_TOP_EAST;
}
}
示例6: renderBlockStairs
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
public boolean renderBlockStairs(BlockStairs p_147722_1_, int p_147722_2_, int p_147722_3_, int p_147722_4_)
{
p_147722_1_.func_150147_e(this.blockAccess, p_147722_2_, p_147722_3_, p_147722_4_);
this.setRenderBoundsFromBlock(p_147722_1_);
this.renderStandardBlock(p_147722_1_, p_147722_2_, p_147722_3_, p_147722_4_);
boolean var5 = p_147722_1_.func_150145_f(this.blockAccess, p_147722_2_, p_147722_3_, p_147722_4_);
this.setRenderBoundsFromBlock(p_147722_1_);
this.renderStandardBlock(p_147722_1_, p_147722_2_, p_147722_3_, p_147722_4_);
if (var5 && p_147722_1_.func_150144_g(this.blockAccess, p_147722_2_, p_147722_3_, p_147722_4_))
{
this.setRenderBoundsFromBlock(p_147722_1_);
this.renderStandardBlock(p_147722_1_, p_147722_2_, p_147722_3_, p_147722_4_);
}
return true;
}
示例7: renderBlockStairs
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
public boolean renderBlockStairs(BlockStairs p_147722_1_, int p_147722_2_, int p_147722_3_, int p_147722_4_)
{
p_147722_1_.func_150147_e(this.blockAccess, p_147722_2_, p_147722_3_, p_147722_4_);
this.setRenderBoundsFromBlock(p_147722_1_);
this.renderStandardBlock(p_147722_1_, p_147722_2_, p_147722_3_, p_147722_4_);
this.field_152631_f = true;
boolean flag = p_147722_1_.func_150145_f(this.blockAccess, p_147722_2_, p_147722_3_, p_147722_4_);
this.setRenderBoundsFromBlock(p_147722_1_);
this.renderStandardBlock(p_147722_1_, p_147722_2_, p_147722_3_, p_147722_4_);
if (flag && p_147722_1_.func_150144_g(this.blockAccess, p_147722_2_, p_147722_3_, p_147722_4_))
{
this.setRenderBoundsFromBlock(p_147722_1_);
this.renderStandardBlock(p_147722_1_, p_147722_2_, p_147722_3_, p_147722_4_);
}
this.field_152631_f = false;
return true;
}
示例8: renderBlockStairs
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
/**
* Renders a stair block at the given coordinates
*/
public boolean renderBlockStairs(BlockStairs par1BlockStairs, int par2, int par3, int par4)
{
par1BlockStairs.func_82541_d(this.blockAccess, par2, par3, par4);
this.setRenderBoundsFromBlock(par1BlockStairs);
this.renderStandardBlock(par1BlockStairs, par2, par3, par4);
boolean flag = par1BlockStairs.func_82542_g(this.blockAccess, par2, par3, par4);
this.setRenderBoundsFromBlock(par1BlockStairs);
this.renderStandardBlock(par1BlockStairs, par2, par3, par4);
if (flag && par1BlockStairs.func_82544_h(this.blockAccess, par2, par3, par4))
{
this.setRenderBoundsFromBlock(par1BlockStairs);
this.renderStandardBlock(par1BlockStairs, par2, par3, par4);
}
return true;
}
示例9: getStateFromMeta
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = getDefaultState().withProperty(HALF, (meta & 4) > 0 ? BlockStairs.EnumHalf.TOP : BlockStairs.EnumHalf.BOTTOM);
iblockstate = iblockstate.withProperty(FACING, EnumFacing.getFront(5 - (meta & 3)));
return iblockstate;
}
示例10: getMetaFromState
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if (state.getValue(HALF) == BlockStairs.EnumHalf.TOP) {
i |= 4;
}
i = i | 5 - state.getValue(FACING).getIndex();
return i;
}
示例11: getStateForPlacement
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
IBlockState iblockstate = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand);
iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing());
return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || hitY <= 0.5F) ?
iblockstate.withProperty(HALF, BlockStairs.EnumHalf.BOTTOM) :
iblockstate.withProperty(HALF, BlockStairs.EnumHalf.TOP);
}
示例12: safeImpact
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
@Override
public void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
int box = 1 + (int) ((float) amplifier / 2F);
BlockPos posI = pos.add(box, box, box);
BlockPos posF = pos.add(-box, -box, -box);
Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
for (BlockPos spot : spots) {
Block block = world.getBlockState(spot).getBlock();
IBlockState state = world.getBlockState(spot);
boolean place = amplifier > 2 || world.rand.nextBoolean();
if (BlockStairs.isBlockStairs(state)) {
IBlockState newState = Blocks.NETHER_BRICK_STAIRS.getDefaultState()
.withProperty(BlockStairs.FACING, state.getValue(BlockStairs.FACING))
.withProperty(BlockStairs.HALF, state.getValue(BlockStairs.HALF));
world.setBlockState(spot, newState);
} else if (place && stateMap.containsKey(block)) {
world.setBlockState(spot, stateMap.get(block), 3);
} else if (state.getBlock() == Blocks.LOG) {
world.setBlockState(spot, ModBlocks.nethersteel.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.LOG2) {
world.setBlockState(spot, ModBlocks.nethersteel.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.BRICK_BLOCK) {
world.setBlockState(spot, ModBlocks.scorned_bricks.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.STONEBRICK) {
world.setBlockState(spot, ModBlocks.scorned_bricks.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.END_BRICKS) {
world.setBlockState(spot, ModBlocks.scorned_bricks.getDefaultState(), 3);
} else if (state.getBlock() == ModBlocks.embittered_bricks) {
world.setBlockState(spot, ModBlocks.scorned_bricks.getDefaultState(), 3);
} else if (state.getBlock() == ModBlocks.fake_ice_fence) {
world.setBlockState(spot, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 3);
}
}
}
示例13: safeImpact
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
int box = 1 + (int) ((float) amplifier / 2F);
BlockPos posI = pos.add(box, box, box);
BlockPos posF = pos.add(-box, -box, -box);
Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
for (BlockPos spot : spots) {
boolean place = amplifier > 2 || world.rand.nextBoolean();
if (place) {
IBlockState state = world.getBlockState(spot);
Block block = state.getBlock();
if (block == Blocks.SANDSTONE_STAIRS) {
IBlockState newState = Blocks.RED_SANDSTONE_STAIRS.getDefaultState()
.withProperty(BlockStairs.FACING, state.getValue(BlockStairs.FACING))
.withProperty(BlockStairs.HALF, state.getValue(BlockStairs.HALF));
world.setBlockState(spot, newState);
} else if (stateMap.containsKey(block)) {
world.setBlockState(spot, stateMap.get(block), 3);
} else if (block == Blocks.SANDSTONE) {
BlockSandStone.EnumType type = state.getValue(BlockSandStone.TYPE);
IBlockState other = getSandStone(type);
world.setBlockState(spot, other, 3);
}
}
}
}
示例14: runIfAirOrStairsHeld
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
public void runIfAirOrStairsHeld(Runnable runnable) {
Item heldItem = player.getHeldItemMainhand().getItem();
Block heldBlock = Block.getBlockFromItem(heldItem);
if(heldItem.equals(Items.AIR)) {
info("You don't hold stairs. The command will do the cleaning.");
} else if(!(heldBlock instanceof BlockStairs)) {
info("Hold stairs");
return;
}
runnable.run();
}
示例15: func_175847_a
import net.minecraft.block.BlockStairs; //導入依賴的package包/類
protected IBlockState func_175847_a(IBlockState p_175847_1_)
{
if (this.isDesertVillage)
{
if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2)
{
return Blocks.sandstone.getDefaultState();
}
if (p_175847_1_.getBlock() == Blocks.cobblestone)
{
return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.DEFAULT.getMetadata());
}
if (p_175847_1_.getBlock() == Blocks.planks)
{
return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata());
}
if (p_175847_1_.getBlock() == Blocks.oak_stairs)
{
return Blocks.sandstone_stairs.getDefaultState().withProperty(BlockStairs.FACING, p_175847_1_.getValue(BlockStairs.FACING));
}
if (p_175847_1_.getBlock() == Blocks.stone_stairs)
{
return Blocks.sandstone_stairs.getDefaultState().withProperty(BlockStairs.FACING, p_175847_1_.getValue(BlockStairs.FACING));
}
if (p_175847_1_.getBlock() == Blocks.gravel)
{
return Blocks.sandstone.getDefaultState();
}
}
return p_175847_1_;
}