public static boolean isValidBlock(IBlockState state) { return state.isOpaqueCube() || state.getRenderType() == EnumBlockRenderType.MODEL; }
@Override public boolean isTransparent() { if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades ) { return true; } return this.getBlockState().isOpaqueCube(); }
private FacadeRenderState getFacadeRenderState( EnumFacing side ) { // Store the "masqueraded" itemstack for the given side, if there is a facade final IFacadePart facade = this.getFacade( side.ordinal() ); if( facade != null ) { final ItemStack textureItem = facade.getTextureItem(); final IBlockState blockState = facade.getBlockState(); if( blockState != null && textureItem != null ) { return new FacadeRenderState( blockState, !facade.getBlockState().isOpaqueCube() ); } } return null; } }
@Override public boolean isOpaqueCube() { return state.isOpaqueCube(); }
public boolean isWall(World world, BlockPos pos, IBlockState state) { if(!state.isFullBlock() || !state.isOpaqueCube() || !STONE_PREDICATE.apply(state)) return false; return isBorder(world, pos, state); }
protected final boolean checkSolidCube(int x1, int y1, int z1, int x2, int y2, int z2) { IBlockState block; for (int yy = y1; yy <= y2; yy++) for (int xx = x1; xx <= x2; xx++) for (int zz = z1; zz <= z2; zz++) { block = world.getBlockState(new BlockPos(xx, yy, zz)); if (!block.isOpaqueCube()) return false; } return true; } }
@SideOnly(Side.CLIENT) @Override public void randomDisplayTick(@Nonnull IBlockState stateIn, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) { TileImpulseHopper te = getTileEntity(world, pos); if (te != null && te.isActive() && !world.getBlockState(pos.up()).isOpaqueCube()) { if (rand.nextInt(8) == 0) { float startX = pos.getX() + 0.8F - rand.nextFloat() * 0.6F; float startY = pos.getY() + 1.0F; float startZ = pos.getZ() + 0.8F - rand.nextFloat() * 0.6F; world.spawnParticle(EnumParticleTypes.REDSTONE, startX, startY, startZ, 0, 0, 0); } } }
@Override public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { return super.doesSideBlockRendering(state, world, pos, face) || (CableHelpers.hasFacade(world, pos) && CableHelpers.getFacade(world, pos).isOpaqueCube()); }
private void decorateTubers(World world, BlockPos blockpos, Random random, RoomType roomType){ if(world.getBlockState(blockpos.up()).isOpaqueCube() && random.nextInt(roomType == RoomType.ENTERANCE || roomType == RoomType.TUNNEL ? 20 : 6) == 0){ int tuberLength = roomType == RoomType.ENTERANCE || roomType == RoomType.TUNNEL ? 1 : roomType == RoomType.QUEEN ? 1 + random.nextInt(5) : 1 + random.nextInt(3); for(int i = 0; i < tuberLength; i++){ if(world.isAirBlock(blockpos.down(i))){ world.setBlockState(blockpos.down(i), jungle ? ModBlocks.myrmex_jungle_biolight.getDefaultState() : ModBlocks.myrmex_desert_biolight.getDefaultState()); } } } }
@Nullable private Vec3d findPossibleShelter() { Random random = this.creature.getRNG(); BlockPos blockpos = new BlockPos(this.creature.posX, this.creature.getEntityBoundingBox().minY, this.creature.posZ); for (int i = 0; i < 10; ++i) { BlockPos blockpos1 = blockpos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10); if (this.world.getBlockState(blockpos1).isOpaqueCube()) { return new Vec3d((double) blockpos1.getX(), (double) blockpos1.getY(), (double) blockpos1.getZ()); } } return null; } }
@Override public boolean shouldRenderInPass(int arg0) { if (getPaintSource() != null && getPaintSource().isOpaqueCube() && !YetaUtil.isFacadeHidden(this, EnderIO.proxy.getClientPlayer())) { return false; } return super.shouldRenderInPass(arg0); }
boolean isFloor(World world, BlockPos pos, IBlockState state) { if(!state.isFullBlock() || !state.isOpaqueCube()) return false; BlockPos upPos = pos.up(); return world.isAirBlock(upPos) || world.getBlockState(upPos).getBlock().isReplaceable(world, upPos); }
boolean isCeiling(World world, BlockPos pos, IBlockState state) { if(!state.isFullBlock() || !state.isOpaqueCube()) return false; BlockPos downPos = pos.down(); return world.isAirBlock(downPos) || world.getBlockState(downPos).getBlock().isReplaceable(world, downPos); }
public MOBlock(Material material, String name) { super(material); setRegistryName(new ResourceLocation(Reference.MOD_ID, name)); this.blockState = createBlockState(); this.setDefaultState(getBlockState().getBaseState()); this.fullBlock = getDefaultState().isOpaqueCube(); this.lightOpacity = fullBlock ? 255 : 0; this.setUnlocalizedName(name); setCreativeTab(MatterOverdrive.TAB_OVERDRIVE); rotationType = RotationType.FOUR_WAY; }
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos.down()); Block block = iblockstate.getBlock(); return block != Blocks.ICE && block != Blocks.PACKED_ICE ? (iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) ? true : (block == this && iblockstate.getValue(LAYERS) >= 7 ? true : iblockstate.isOpaqueCube() && iblockstate.getMaterial().blocksMovement())) : false; }
@Override public boolean canPlaceBlockAt(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos.down()); if (state.getBlock() == null) return false; if (state.getBlock() == this) return true; if (state.getBlock().isLeaves(state, world, pos.down()) && !state.isOpaqueCube()) return false; return state.getMaterial().blocksMovement(); }
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos.down()); Block block = iblockstate.getBlock(); return block != Blocks.ICE && block != Blocks.PACKED_ICE ? (iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) ? true : (block == this && iblockstate.getValue(LAYERS) >= 7 ? true : iblockstate.isOpaqueCube() && iblockstate.getMaterial().blocksMovement())) : false; }
private Set<EnumFacing> getVisibleSides(final BlockPos pos) { final VisGraph visgraph = new VisGraph(); final BlockPos posChunk = new BlockPos(pos.getX() & ~0xF, pos.getY() & ~0xF, pos.getZ() & ~0xF); for (final BlockPos.MutableBlockPos mutableBlockPos : BlockPos.getAllInBoxMutable(posChunk, posChunk.add(15, 15, 15))) { if (this.world.getBlockState(mutableBlockPos).isOpaqueCube()) { visgraph.setOpaqueCube(mutableBlockPos); } } return visgraph.getVisibleFacings(pos); }
@Override public boolean canPlaceBlockAt(World world, BlockPos blockPos) { IBlockState blockState = world.getBlockState(blockPos.add(0, -1, 0)); if (blockState == null) return false; if (blockState.getBlock() == this && (Integer) blockState.getValue(LAYERS) == 8) return true; return (blockState.getBlock().isLeaves(blockState, world, blockPos.add(0, -1, 0)) || blockState.isOpaqueCube()) && blockState.getBlock().getMaterial(blockState).blocksMovement(); }
public static Triple<BlockPos, IBlockState, IGrowable> firstBlock(World world, BlockPos glassPos) { BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos); while (true) { mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ()); if (mut.getY() < 0) return null; IBlockState state = world.getBlockState(mut); if (state.isOpaqueCube() || state.getBlock() instanceof IGrowable) { if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock()); else return null; } } } }