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; }
@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; }
@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; }
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; }
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; } }
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; }
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; }
/** * 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; }
@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; }
@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; }
@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); }
@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); } } }
@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); } } } }
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(); }
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_; }
@SubscribeEvent public void onVillageBlocks(BiomeEvent.GetVillageBlockID event) { IBlockState original = event.getOriginal(); if (event.getBiome() == ATGBiomes.TUNDRA) { if (original.getBlock() == Blocks.LOG || original.getBlock() == Blocks.LOG2) { event.setResult(Event.Result.DENY); event.setReplacement(Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE).withProperty(BlockLog.LOG_AXIS, original.getValue(BlockLog.LOG_AXIS))); } else if (original.getBlock() == Blocks.PLANKS) { event.setResult(Event.Result.DENY); event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.SPRUCE)); } else if (original.getBlock() == Blocks.OAK_STAIRS) { event.setResult(Event.Result.DENY); event.setReplacement(Blocks.SPRUCE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, original.getValue(BlockStairs.FACING))); } else if (original.getBlock() == Blocks.OAK_FENCE) { event.setResult(Event.Result.DENY); event.setReplacement(Blocks.SPRUCE_FENCE.getDefaultState()); } } else if (event.getBiome() == ATGBiomes.SCRUBLAND) { if (original.getBlock() == Blocks.LOG || original.getBlock() == Blocks.LOG2) { event.setResult(Event.Result.DENY); event.setReplacement(Blocks.LOG2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(BlockLog.LOG_AXIS, original.getValue(BlockLog.LOG_AXIS))); } else if (original.getBlock() == Blocks.PLANKS) { event.setResult(Event.Result.DENY); event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.ACACIA)); } else if (original.getBlock() == Blocks.OAK_STAIRS) { event.setResult(Event.Result.DENY); event.setReplacement(Blocks.ACACIA_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, original.getValue(BlockStairs.FACING))); } else if (original.getBlock() == Blocks.OAK_FENCE) { event.setResult(Event.Result.DENY); event.setReplacement(Blocks.ACACIA_FENCE.getDefaultState()); } } }
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) { return false; } else { this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 10, 7, true, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES); this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.entryDoor, 1, 7, 0); this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 7); IBlockState iblockstate = Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH); for (int i = 0; i < 6; ++i) { this.setBlockState(worldIn, iblockstate, 1, 6 - i, 1 + i, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 2, 6 - i, 1 + i, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 3, 6 - i, 1 + i, structureBoundingBoxIn); if (i < 5) { this.setBlockState(worldIn, Blocks.STONEBRICK.getDefaultState(), 1, 5 - i, 1 + i, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.STONEBRICK.getDefaultState(), 2, 5 - i, 1 + i, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.STONEBRICK.getDefaultState(), 3, 5 - i, 1 + i, structureBoundingBoxIn); } } return true; } }
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { IBlockState iblockstate = Blocks.NETHER_BRICK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH); for (int i = 0; i <= 9; ++i) { int j = Math.max(1, 7 - i); int k = Math.min(Math.max(j + 5, 14 - i), 13); int l = i; this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, i, 4, j, i, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, j + 1, i, 3, k - 1, i, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); if (i <= 6) { this.setBlockState(worldIn, iblockstate, 1, j + 1, i, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 2, j + 1, i, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 3, j + 1, i, structureBoundingBoxIn); } this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, k, i, 4, k, i, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, j + 1, i, 0, k - 1, i, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, j + 1, i, 4, k - 1, i, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); if ((i & 1) == 0) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, j + 2, i, 0, j + 3, i, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, j + 2, i, 4, j + 3, i, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); } for (int i1 = 0; i1 <= 4; ++i1) { this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), i1, -1, l, structureBoundingBoxIn); } } return true; }
/** * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes * Mineshafts at the end, it adds Fences... */ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) { return false; } else { this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 10, 7, true, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES); this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.entryDoor, 1, 7, 0); this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 7); IBlockState iblockstate = Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH); for (int i = 0; i < 6; ++i) { this.setBlockState(worldIn, iblockstate, 1, 6 - i, 1 + i, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 2, 6 - i, 1 + i, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 3, 6 - i, 1 + i, structureBoundingBoxIn); if (i < 5) { this.setBlockState(worldIn, Blocks.STONEBRICK.getDefaultState(), 1, 5 - i, 1 + i, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.STONEBRICK.getDefaultState(), 2, 5 - i, 1 + i, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.STONEBRICK.getDefaultState(), 3, 5 - i, 1 + i, structureBoundingBoxIn); } } return true; } }
/** * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes * Mineshafts at the end, it adds Fences... */ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { IBlockState iblockstate = Blocks.NETHER_BRICK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH); for (int i = 0; i <= 9; ++i) { int j = Math.max(1, 7 - i); int k = Math.min(Math.max(j + 5, 14 - i), 13); int l = i; this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, i, 4, j, i, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, j + 1, i, 3, k - 1, i, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); if (i <= 6) { this.setBlockState(worldIn, iblockstate, 1, j + 1, i, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 2, j + 1, i, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 3, j + 1, i, structureBoundingBoxIn); } this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, k, i, 4, k, i, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, j + 1, i, 0, k - 1, i, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, j + 1, i, 4, k - 1, i, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); if ((i & 1) == 0) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, j + 2, i, 0, j + 3, i, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, j + 2, i, 4, j + 3, i, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); } for (int i1 = 0; i1 <= 4; ++i1) { this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), i1, -1, l, structureBoundingBoxIn); } } return true; }
public static ForgeDirection[] getValidVanillaBlockRotations(Block block) { return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireHook || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockRailDetector || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block == Blocks.field_150444_as || block == Blocks.field_150472_an || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator || block instanceof BlockTrapDoor || block instanceof BlockHugeMushroom || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; }
default boolean isStructureComplete(World world, BlockPos pos) { for (Template.BlockInfo info : getStructure().blockInfos()) { if (info.blockState == null) continue; if (info.blockState.getMaterial() == Material.AIR || info.blockState.getBlock() == Blocks.STRUCTURE_VOID) continue; BlockPos realPos = info.pos.add(pos).subtract(offsetToCenter()); IBlockState state = world.getBlockState(realPos); if (state != info.blockState) { if (state.getBlock() == ModBlocks.CREATIVE_MANA_BATTERY && info.blockState.getBlock() == ModBlocks.MANA_BATTERY) { continue; } if (info.blockState.getBlock() instanceof BlockStairs && state.getBlock() instanceof BlockStairs && info.blockState.getBlock() == state.getBlock() && info.blockState.getValue(BlockStairs.HALF) == state.getValue(BlockStairs.HALF) && info.blockState.getValue(BlockStairs.SHAPE) == state.getValue(BlockStairs.SHAPE)) { if (info.blockState.getValue(BlockStairs.FACING) != state.getValue(BlockStairs.FACING)) world.setBlockState(realPos, info.blockState); continue; } return false; } } return true; }
default HashSet<BlockPos> getErroredBlocks(World world, BlockPos pos) { HashSet<BlockPos> set = new HashSet<>(); for (Template.BlockInfo info : getStructure().blockInfos()) { if (info.blockState == null) continue; if (info.blockState.getMaterial() == Material.AIR || info.blockState.getBlock() == Blocks.STRUCTURE_VOID) continue; BlockPos realPos = info.pos.add(pos).subtract(offsetToCenter()); IBlockState state = world.getBlockState(realPos); if (state != info.blockState) { if (state.getBlock() == ModBlocks.CREATIVE_MANA_BATTERY && info.blockState.getBlock() == ModBlocks.MANA_BATTERY) { continue; } if (info.blockState.getBlock() instanceof BlockStairs && state.getBlock() instanceof BlockStairs && info.blockState.getBlock() == state.getBlock() && info.blockState.getValue(BlockStairs.HALF) == state.getValue(BlockStairs.HALF) && info.blockState.getValue(BlockStairs.SHAPE) == state.getValue(BlockStairs.SHAPE)) { continue; } set.add(realPos); } } return set; }
@SubscribeEvent(priority = EventPriority.LOWEST) @Optional.Method(modid = "shearmadness") @SideOnly(Side.CLIENT) public static void onShearMadnessRegisterVariations(RegisterShearMadnessVariationEvent event) { final IVariationRegistry registry = event.getRegistry(); //Java 7 Style Registration //noinspection Convert2Lambda registry.registerVariation( new Function<ItemStack, Boolean>() { @Override public Boolean apply(ItemStack itemStack) { return ItemStackHelper.isStackForBlock( itemStack, Blocks.RAIL, Blocks.ACTIVATOR_RAIL, Blocks.DETECTOR_RAIL, Blocks.GOLDEN_RAIL ); } }, new RailTransformations() ); registry.registerVariation( itemStack -> ItemStackHelper.isStackForBlockSubclassOf( itemStack, BlockStairs.class ), new StairTransformations() ); }
private void buildColumn(World world, int x, int z) { this.fillWithBlocks(world, boundingBox, x, 1, z, x, 5, z, StateHelper.NETHER_BRICK); IBlockState netherBrickStairsTopState = StateHelper.NETHER_BRICK_STAIRS_SOUTH; IBlockState netherBrickStairsBotState = StateHelper.NETHER_BRICK_STAIRS_NORTH; IBlockState netherBrickStairsLeftState = StateHelper.NETHER_BRICK_STAIRS_EAST; IBlockState netherBrickStairsRightState = StateHelper.NETHER_BRICK_STAIRS_WEST; // stairs this.placeBlockAtCurrentPosition(world, netherBrickStairsBotState, x - 1, 1, z - 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsBotState, x, 1, z - 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsBotState, x + 1, 1, z - 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsLeftState, x - 1, 1, z, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsRightState, x + 1, 1, z, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsTopState, x - 1, 1, z + 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsTopState, x, 1, z + 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsTopState, x + 1, 1, z + 1, boundingBox); // stairs top netherBrickStairsTopState = netherBrickStairsTopState.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP); netherBrickStairsBotState = netherBrickStairsBotState.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP); netherBrickStairsLeftState = netherBrickStairsLeftState.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP); netherBrickStairsRightState = netherBrickStairsRightState.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP); this.placeBlockAtCurrentPosition(world, netherBrickStairsBotState, x - 1, 5, z - 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsBotState, x, 5, z - 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsBotState, x + 1, 5, z - 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsLeftState, x - 1, 5, z, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsRightState, x + 1, 5, z, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsTopState, x - 1, 5, z + 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsTopState, x, 5, z + 1, boundingBox); this.placeBlockAtCurrentPosition(world, netherBrickStairsTopState, x + 1, 5, z + 1, boundingBox); }
public static void addStairs() { ShiftedSnowApi.addProvider((state, world, pos) -> { if (state.getBlock() instanceof BlockStairs) { return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.BOTTOM ? EnumSnowType.OVER_STAIRS : null; } return null; }); }
public BlockSnowOverStairs() { super(); setTickRandomly(true); setDefaultState( blockState.getBaseState().withProperty(HEIGHT_8, 1).withProperty(BlockStairs.FACING, EnumFacing.NORTH) .withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.STRAIGHT)); setHardness(0.1F); setLightOpacity(0); }
@Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { IBlockState stateUnder = worldIn.getBlockState(pos.down()).getActualState(worldIn, pos.down()); state = state.withProperty(BlockStairs.FACING, stateUnder.getValue(BlockStairs.FACING)); state = state.withProperty(BlockStairs.SHAPE, stateUnder.getValue(BlockStairs.SHAPE)); return state; }
public static boolean canCreatureSpawn(Block block, IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) { IBlockState state = world.getBlockState(pos); if (block instanceof BlockSlab) { return (block.isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP); } else if (block instanceof BlockStairs) { return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; } return block.isSideSolid(world, pos, EnumFacing.UP); }
public BlockStairsTFC(IBlockState modelState) { super(modelState.getBlock().getMaterial(modelState), null); setDefaultState(this.blockState.getBaseState().withProperty(BlockStairs.FACING, EnumFacing.NORTH).withProperty(BlockStairs.HALF, EnumHalf.BOTTOM).withProperty(BlockStairs.SHAPE, EnumShape.STRAIGHT)); this.modelBlock = modelState.getBlock(); this.modelState = modelState; //setHardness(this.modelBlock.blockHardness); //setResistance(this.modelBlock.blockResistance / 3.0F); this.setSoundType(SoundType.WOOD); setLightOpacity(255); this.setCreativeTab(TFCTabs.TFCBuilding); }
/** * @return Can this block attach to other blocks for support checks in this direction */ @Override public boolean canSupportFacing(IBlockState myState, IBlockAccess world, BlockPos pos, EnumFacing facing) { EnumFacing f = (EnumFacing)myState.getValue(BlockStairs.FACING); if(facing == f.rotateY() || facing == f.rotateYCCW()) return true; return myState.getBlock().isSideSolid(myState, world, pos, facing); }