Package org.spout.api.material

Examples of org.spout.api.material.BlockMaterial


   * Retrieve the instrument played by this note block.
   *
   * @return The instrument played.
   */
  public Instrument getInstrument() {
    BlockMaterial below = this.getBlock().translate(BlockFace.BOTTOM).getMaterial();
    return below instanceof VanillaBlockMaterial ? ((VanillaBlockMaterial) below).getInstrument() : Instrument.PIANO;
  }
View Full Code Here


    if (RedstoneChangeEvent.getHandlerList().getRegisteredListeners().length == 0) {
      return;
    }

    //Redstone event
    BlockMaterial oldMat = event.getBlock().getMaterial();
    BlockMaterial newMat = event.getSnapshot().getMaterial();
    BlockSnapshot initialState = new BlockSnapshot(event.getBlock());
    //RedstoneChangeEvent
    //Three possibilities here:
    //1.) Redstone source material was placed, generating power
    //2.) Redstone source material was removed, removing power
View Full Code Here

              }
              blockLight = (VanillaCuboidLightBuffer) chunk.getLightBuffer(VanillaLighting.BLOCK_LIGHT.getId());
              skyLight = (VanillaCuboidLightBuffer) chunk.getLightBuffer(VanillaLighting.SKY_LIGHT.getId());
              zOld = zChunk;
            }
            BlockMaterial m = chunk.getBlockMaterial(xx, yy, zz);
            if (!m.isOpaque()) {
              light += blockLight.get(xx, yy, zz);
              skylight += skyLight.get(xx, yy, zz); //use the SkyLightRaw, the real sky state would be apply by the shader
              count++;
            }
          }
View Full Code Here

    Block bottomBlock = getOrigin(w.getBlock(x, y, z));
    if (bottomBlock == null || !find(bottomBlock) || w.getGenerator() instanceof TheEndGenerator) {
      return;
    }

    BlockMaterial material;
    if (active) {
      material = VanillaMaterials.PORTAL;
    } else {
      material = VanillaMaterials.AIR;
    }
View Full Code Here

      final Point point = new Point(collideBlockEvent.getContactInfo().getNormal(), getOwner().getWorld());
      final int x = point.getBlockX();
      final int y = point.getBlockX();
      final int z = point.getBlockX();
      final Block translated = getOwner().getWorld().getBlock(x, y, z).translate(BlockFace.TOP);
      final BlockMaterial material = translated.getMaterial();
      if (material.isPlacementObstacle()) {
        Item.dropNaturally(point, new ItemStack(getMaterial(), 1));
      } else {
        translated.setMaterial(getMaterial(), getMaterial().toCause(point));
      }
      getOwner().remove();
View Full Code Here

          for (int y = end.getFloorY() - 1; y >= start.getFloorY(); y--) {
            final double yOffset = (y + 0.5f - target.getY()) / verticalSize;
            if (yOffset > -0.7 && xOffset * xOffset + yOffset * yOffset + zOffset * zOffset < 1) {
              final int xx = chunk.getFloorX() + x;
              final int zz = chunk.getFloorZ() + z;
              final BlockMaterial material = blockData.get(xx, y, zz);
              if (material.equals(VanillaMaterials.NETHERRACK)) {
                blockData.set(xx, y, zz, VanillaMaterials.AIR);
              }
            }
          }
        }
View Full Code Here

      return false;
    }
    byte adjacentNetherrackCount = 0;
    byte adjacentAirCount = 0;
    for (final BlockFace face : BlockFaces.NSEWB) {
      final BlockMaterial material = block.translate(face).getMaterial();
      if (material == VanillaMaterials.AIR) {
        adjacentAirCount++;
      } else if (material == VanillaMaterials.NETHERRACK) {
        adjacentNetherrackCount++;
      }
View Full Code Here

    metadata.addMeta(Metadata.TYPE_INT, 17, VanillaData.MINECART_SHAKE_FORCE);
    metadata.addMeta(Metadata.TYPE_INT, 18, VanillaData.MINECART_SHAKE_DIR);
    metadata.addMeta(new Metadata<Integer>(Metadata.TYPE_INT, 20) {
      @Override
      public Integer getValue() {
        BlockMaterial material = getDisplayedBlock();
        if (material instanceof VanillaBlockMaterial) {
          VanillaBlockMaterial vanillaMat = (VanillaBlockMaterial) material;
          return (vanillaMat.getMinecraftId()  & 0xFFFF) | (vanillaMat.getMinecraftData(vanillaMat.getData()) << 16);
        } else {
          return 0;
View Full Code Here

   * @return Displayed Block Material
   */
  public BlockMaterial getDisplayedBlock() {
    short id = getOwner().getData().get(VanillaData.MINECART_BLOCK_ID);
    short data = getOwner().getData().get(VanillaData.MINECART_BLOCK_DATA);
    BlockMaterial material = BlockMaterial.get(id, data);
    return material == null ? VanillaMaterials.AIR : material;
  }
View Full Code Here

   * Sets the displayed block in this Minecart. To hide the Block, pass in null or AIR.
   *
   * @param material to set to
   */
  public void setDisplayedBlock(BlockMaterial material) {
    BlockMaterial displayed = material;
    if (displayed == null) {
      displayed = VanillaMaterials.AIR;
    }
    getOwner().getData().put(VanillaData.MINECART_BLOCK_ID, material.getId());
    getOwner().getData().put(VanillaData.MINECART_BLOCK_DATA, material.getData());
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.