Package org.spout.api.material

Examples of org.spout.api.material.BlockMaterial


    short data = BlockFullState.getData(state);
    if ((index & 1) == 0) {
      material1 = BlockMaterial.get(id, data);
      nibbleStore = getMinecraftData(material1, data);
    } else {
      BlockMaterial material2 = BlockMaterial.get(id, data);
      nibbleStore |= getMinecraftData(material2, data) << 4;
      fullChunkData[index - 1] = (byte) (getMinecraftId(material1) & 0xFF);
      fullChunkData[index] = (byte) (getMinecraftId(material2) & 0xFF);
      fullChunkData[(index >> 1) + VOLUME] = (byte) nibbleStore;
    }
View Full Code Here


    super.resolve(light, material, height, coords, false);
  }

  @Override
  protected int getEmittedLight(ImmutableCuboidBlockMaterialBuffer material, ImmutableHeightMapBuffer height, int x, int y, int z) {
    BlockMaterial m = material.get(x, y, z);
    short data = material.getData(x, y, z);
    return m.getLightLevel(data);
  }
View Full Code Here

        int xIndex = xx - x + 1;
        int zIndex = 1;
        int yIndex = yy - y + 1;
        int[] zArray = emittedLight[xIndex][yIndex];
        for (int zz = z; zz < z + size; zz++) {
          BlockMaterial m = material.get(xx, yy, zz);
          zArray[zIndex++] = m.getLightLevel(m.getData());
        }
      }
    }
  }
View Full Code Here

      @Override
      public boolean execute(int x, int y, int z, short id, short data) {
        x -= baseX;
        z -= baseZ;

        BlockMaterial m = BlockMaterial.get(id, data);

        int lightLevel = m.getLightLevel(m.getData());
        if (lightLevel > 0) {
          light[x + 1][y + 1][z + 1] = lightLevel;
        }
        return true;
      }
View Full Code Here

    }
    this.direction = BlockFace.THIS;
  }

  public static MinecartTrackLogic create(Block block) {
    BlockMaterial mat = block.getMaterial();
    if (!(mat instanceof RailBase)) {
      return null;
    }

    return new MinecartTrackLogic(block, (RailBase) mat);
View Full Code Here

      @Override
      public boolean execute(int x, int y, int z, short id, short data) {
        x -= baseX;
        z -= baseZ;

        BlockMaterial m = BlockMaterial.get(id, data);
        if (height[x][z] < y && m.isSurface()) {
          height[x][z] = y;
        }
        return true;
      }
    });
View Full Code Here

    // TODO: Send any player effects
  }

  @EventHandler
  public void onBlockUpdate(BlockUpdateEvent event) {
    BlockMaterial material = event.getChunk().getBlockMaterial(event.getX(), event.getY(), event.getZ());
    short data = event.getChunk().getBlockData(event.getX(), event.getY(), event.getZ());
    short id = getMinecraftId(material);
    int x = event.getX() + event.getChunk().getBlockX();
    int y = event.getY() + event.getChunk().getBlockY();
    int z = event.getZ() + event.getChunk().getBlockZ();
View Full Code Here

  @Override
  public boolean canPlace(Block block, short data, BlockFace against, Vector3f clickedPos, boolean isClickedBlock, Cause<?> cause) {
    if (against == BlockFace.BOTTOM && super.canPlace(block, data, against, clickedPos, isClickedBlock, cause)) {
      Block below = block.translate(BlockFace.BOTTOM);
      BlockMaterial material = below.getMaterial();
      Block headBlock = block.translate(PlayerUtil.getFacing(cause));
      if (!VanillaMaterials.AIR.equals(headBlock)) {
        return false;
      }
      if (material instanceof VanillaBlockMaterial) {
View Full Code Here

    if (inv != null && inv.get() != null && inv.get().isMaterial(Dye.BONE_MEAL) && type.equals(Action.RIGHT_CLICK)) {
      if (!PlayerUtil.isCostSuppressed(entity)) {
        inv.addAmount(-1);
      }
      if (GenericMath.getRandom().nextDouble() < 0.4D) {
        final BlockMaterial mushroomType = block.getMaterial();
        final VariableHeightObject mushroom;
        if (mushroomType == VanillaMaterials.RED_MUSHROOM) {
          mushroom = new HugeMushroomObject(HugeMushroomType.RED);
        } else {
          mushroom = new HugeMushroomObject(HugeMushroomType.BROWN);
View Full Code Here

    final Random rand = GenericMath.getRandom();
    if (rand.nextInt(chance) == 0) {
      if (isFullyGrown(block)) {
        for (int i = 0; i < BlockFaces.NESW.size(); i++) {
          Block spread = block.translate(BlockFaces.NESW.get(i));
          BlockMaterial material = spread.getMaterial();
          if (material == VanillaMaterials.AIR) {
            BlockMaterial belowSpread = spread.translate(BlockFace.BOTTOM).getMaterial();
            if (belowSpread.isMaterial(VanillaMaterials.FARMLAND, VanillaMaterials.DIRT, VanillaMaterials.GRASS)) {
              spread.setMaterial(this.getLastStageMaterial());
              break;
            }
          } else if (material == getLastStageMaterial()) {
            break;
View Full Code Here

TOP

Related Classes of org.spout.api.material.BlockMaterial

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.