Java 类net.minecraft.block.BlockCarpet 实例源码

项目:SerenityCE    文件:Volkswagen.java   
public Volkswagen() {
    super("Volkswagen", 0xFFFFFF, ModuleCategory.TWEAKS);
    setHidden(true);

    listeners.add(new Listener<BlockBB>() {
        @Override
        public void call(BlockBB event) {
            String serverIP = getServerIP();

            if (serverIP == null) {
                return;
            }

            if (serverIP.toLowerCase().contains("ihaq.ca")) {
                if (new CuboidRegion(new Vec3(835, 5, 154), new Vec3(825, 5, 128)).contains(new Vec3(event.getX(), event.getY(), event.getZ()))) {
                    if (event.getBlock() instanceof BlockCarpet) {
                        event.setBoundingBox(null);
                    }
                }
            }
        }
    });


    setState(true);
}
项目:TravelHut    文件:WorldGenHandler.java   
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);
            }
          }
        }
      }
    }
  }
}
项目:TravelHut    文件:WorldGenHandler.java   
public static void create() {
  sandstone = Blocks.SANDSTONE.getDefaultState();
  bedrock = Blocks.BEDROCK.getDefaultState();
  slabs = Blocks.STONE_SLAB.getDefaultState().withProperty(BlockStoneSlab.VARIANT, BlockStoneSlab.EnumType.SAND).withProperty(BlockSlab.HALF,
      BlockSlab.EnumBlockHalf.TOP);
  lowslabs = Blocks.STONE_SLAB.getDefaultState().withProperty(BlockStoneSlab.VARIANT, BlockStoneSlab.EnumType.SAND).withProperty(BlockSlab.HALF,
      BlockSlab.EnumBlockHalf.BOTTOM);
  sand = Blocks.SAND.getDefaultState();
  obsidian = Blocks.OBSIDIAN.getDefaultState();

  portalLN = TravelHutMod.blockHutPortal.getDefaultState().withProperty(BlockHutPortal.TYPE, BlockHutPortal.Type.LEFT).withProperty(BlockHutPortal.FACING,
      EnumFacing.NORTH);
  portalLE = TravelHutMod.blockHutPortal.getDefaultState().withProperty(BlockHutPortal.TYPE, BlockHutPortal.Type.LEFT).withProperty(BlockHutPortal.FACING,
      EnumFacing.EAST);
  portalLS = TravelHutMod.blockHutPortal.getDefaultState().withProperty(BlockHutPortal.TYPE, BlockHutPortal.Type.LEFT).withProperty(BlockHutPortal.FACING,
      EnumFacing.SOUTH);
  portalLW = TravelHutMod.blockHutPortal.getDefaultState().withProperty(BlockHutPortal.TYPE, BlockHutPortal.Type.LEFT).withProperty(BlockHutPortal.FACING,
      EnumFacing.WEST);
  portalRN = TravelHutMod.blockHutPortal.getDefaultState().withProperty(BlockHutPortal.TYPE, BlockHutPortal.Type.RIGHT).withProperty(BlockHutPortal.FACING,
      EnumFacing.NORTH);
  portalRE = TravelHutMod.blockHutPortal.getDefaultState().withProperty(BlockHutPortal.TYPE, BlockHutPortal.Type.RIGHT).withProperty(BlockHutPortal.FACING,
      EnumFacing.EAST);
  portalRS = TravelHutMod.blockHutPortal.getDefaultState().withProperty(BlockHutPortal.TYPE, BlockHutPortal.Type.RIGHT).withProperty(BlockHutPortal.FACING,
      EnumFacing.SOUTH);
  portalRW = TravelHutMod.blockHutPortal.getDefaultState().withProperty(BlockHutPortal.TYPE, BlockHutPortal.Type.RIGHT).withProperty(BlockHutPortal.FACING,
      EnumFacing.WEST);

  carpet0 = Blocks.CARPET.getDefaultState().withProperty(net.minecraft.block.BlockCarpet.COLOR, EnumDyeColor.SILVER);
  carpet1 = Blocks.CARPET.getDefaultState().withProperty(net.minecraft.block.BlockCarpet.COLOR, EnumDyeColor.BLUE);
  carpet2 = Blocks.CARPET.getDefaultState().withProperty(net.minecraft.block.BlockCarpet.COLOR, EnumDyeColor.RED);
  carpet3 = Blocks.CARPET.getDefaultState().withProperty(net.minecraft.block.BlockCarpet.COLOR, EnumDyeColor.YELLOW);
  carpet4 = Blocks.CARPET.getDefaultState().withProperty(net.minecraft.block.BlockCarpet.COLOR, EnumDyeColor.GREEN);

  dirt = Blocks.DIRT.getDefaultState();

  sapling = Blocks.SAPLING.getDefaultState();

  MinecraftForge.EVENT_BUS.register(WorldGenHandler.class);
}
项目:TravelHut    文件:TeleportHandler.java   
static BlockPos getTarget(World worldIn, BlockPos startpos, EnumFacing direction, int offset) {
  BlockPos target = startpos.offset(direction, offset * 16 - 4);
  target = new BlockPos(target.getX(), 250, target.getZ());
  if (!worldIn.isBlockLoaded(target)) {
    final int chunkX = target.getX() >> 4;
    final int chunkZ = target.getZ() >> 4;
    Chunk chunk = worldIn.getChunkFromChunkCoords(chunkX, chunkZ);
    if (!chunk.isTerrainPopulated()) {
      worldIn.getChunkFromChunkCoords(chunkX + 1, chunkZ);
      worldIn.getChunkFromChunkCoords(chunkX, chunkZ + 1);
      worldIn.getChunkFromChunkCoords(chunkX + 1, chunkZ + 1);
      worldIn.getChunkFromChunkCoords(chunkX - 1, chunkZ);
      worldIn.getChunkFromChunkCoords(chunkX, chunkZ - 1);
      worldIn.getChunkFromChunkCoords(chunkX - 1, chunkZ - 1);
    }
  }
  final Block landingBlock = Config.generateBedrock.getBoolean() ? Blocks.BEDROCK : Blocks.OBSIDIAN;
  while (worldIn.getBlockState(target).getBlock() != landingBlock) {
    target = target.down();
    if (target.getY() < 0) {
      return null;
    }
  }
  if (!(worldIn.isAirBlock(target.up()) || worldIn.getBlockState(target.up()).getBlock() instanceof BlockCarpet) || !worldIn.isAirBlock(target.up(2))) {
    return null;
  }
  return target;
}
项目:Easy-Editors    文件:BlockPropertyRegistry.java   
private static void registerVanillaVariantProps() {
    // TODO: omit similar blocks
    registerVariantProperty(BlockStone.VARIANT);
    registerVariantProperty(BlockPlanks.VARIANT);
    registerVariantProperty(BlockSapling.TYPE);
    registerVariantProperty(BlockDirt.VARIANT);
    registerVariantProperty(BlockSand.VARIANT);
    registerVariantProperty(BlockOldLog.VARIANT);
    registerVariantProperty(BlockNewLog.VARIANT);
    registerVariantProperty(BlockOldLeaf.VARIANT);
    registerVariantProperty(BlockNewLeaf.VARIANT);
    registerVariantProperty(BlockSandStone.TYPE);
    registerVariantProperty(BlockTallGrass.TYPE);
    registerVariantProperty(BlockPistonExtension.TYPE);
    registerVariantProperty(BlockColored.COLOR);
    registerVariantProperty(BlockPistonMoving.TYPE);
    registerVariantProperty(Blocks.YELLOW_FLOWER.getTypeProperty());
    registerVariantProperty(Blocks.RED_FLOWER.getTypeProperty());
    registerVariantProperty(BlockStoneSlab.VARIANT);
    registerVariantProperty(BlockWoodSlab.VARIANT);
    registerVariantProperty(BlockAnvil.DAMAGE);
    registerVariantProperty(BlockQuartz.VARIANT);
    registerVariantProperty(BlockCarpet.COLOR);
    registerVariantProperty(BlockDoublePlant.VARIANT);
    registerVariantProperty(BlockStainedGlass.COLOR);
    registerVariantProperty(BlockStainedGlassPane.COLOR);
    registerVariantProperty(BlockPrismarine.VARIANT);
    registerVariantProperty(BlockRedSandstone.TYPE);
    registerVariantProperty(BlockStoneSlabNew.VARIANT);
}
项目:EnderIO    文件:BlockPaintedCarpet.java   
@Override
public boolean shouldSideBeRendered(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
  return super.shouldSideBeRendered(state, worldIn, pos, side)
      && !(side.getAxis() != EnumFacing.Axis.Y && worldIn.getBlockState(pos.offset(side)).getBlock() instanceof BlockCarpet);
}