Examples of VanillaBlockMaterial


Examples of org.spout.vanilla.material.VanillaBlockMaterial

    for (BlockFace face : BlockFaces.ESWN) {
      if (face == dir || face == opp) {
        continue;
      }
      Block toCheck = block.translate(face);
      VanillaBlockMaterial material = (VanillaBlockMaterial) toCheck.getMaterial();
      short matPower = material.getRedstonePower(toCheck);
      short indPower = material.getIndirectRedstonePower(toCheck, face.getOpposite(), RedstonePowerMode.ALLEXCEPTWIRE);
      if (matPower > power) {
        power = matPower;
      }
      if (indPower > power) {
        power = indPower;
View Full Code Here

Examples of org.spout.vanilla.material.VanillaBlockMaterial

  public static boolean isFallingObstacle(BlockMaterial material) {
    if (material == BlockMaterial.AIR || material.getShape() == null) {
      return false;
    }
    if (material instanceof VanillaBlockMaterial) {
      VanillaBlockMaterial vbm = (VanillaBlockMaterial) material;
      if (!vbm.isPlacementObstacle()) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

Examples of org.spout.vanilla.material.VanillaBlockMaterial

    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

Examples of org.spout.vanilla.material.VanillaBlockMaterial

            for (int dy = 1; dy < 16; dy++) {
              if (region.containsBlock(x, y - dy, z)) {
                Block block = region.getBlock(x, y - dy, z);
                BlockMaterial mat = block.getMaterial();
                if (mat instanceof VanillaBlockMaterial) {
                  VanillaBlockMaterial vbm = (VanillaBlockMaterial) mat;
                  //Place snow ontop of solid
                  if (vbm.canSupport(VanillaMaterials.SNOW, BlockFace.TOP)) {
                    Block above = block.translate(BlockFace.TOP);
                    if (!VanillaMaterials.SNOW.willMeltAt(above)) {
                      above.setMaterial(VanillaMaterials.SNOW);
                    }
                    return;
View Full Code Here

Examples of org.spout.vanilla.material.VanillaBlockMaterial

   */
  public boolean startDigging(Point position, Material tool) {
    if (getOwner().getPhysics().getPosition().getDistance(position) > 6) { // TODO: Actually get block reach from somewhere instead of just using 6
      return false;
    }
    VanillaBlockMaterial block = (VanillaBlockMaterial) position.getBlock().getMaterial();
    float modifier = 1f, multiplicator = 1.5f;
    ToolType type = null;
    MiningTool mining = null;

    if (tool instanceof MiningTool) {
      mining = (MiningTool) tool;
      type = mining.getToolType();
    }

    if (block.isMiningType(type)) {
      if (mining != null) {
        modifier = mining.getDiggingSpeed();
      }
    } else {
      multiplicator = 5f;
    }
    byte maxAmount = 8;
    separator = ((block.getHardness() * multiplicator) / modifier) / maxAmount;
    amount = 0;
    timer = 0;

    isDigging = true;
    diggingPosition = position;
View Full Code Here

Examples of org.spout.vanilla.material.VanillaBlockMaterial

  @Override
  public List<Message> getSpawnMessages(Entity entity, RepositionManager rm) {
    FallingBlock block = entity.get(FallingBlock.class);
    if (block != null && block.getMaterial() instanceof VanillaBlockMaterial) {
      VanillaBlockMaterial material = (VanillaBlockMaterial) block.getMaterial();
      int messageData = material.getMinecraftId() | (material.getMinecraftData(material.getData()) >> 16);
      List<Message> messages = new ArrayList<Message>();
      //TODO: Redo this as FallingBlock will remain an Entity
      //
      //      final double p = 32d;
      //      Point pos = entity.getPhysics().getPosition();
View Full Code Here

Examples of org.spout.vanilla.material.VanillaBlockMaterial

      if (mat instanceof Burnable && rand.nextInt(chance) < ((Burnable) mat).getCombustChance()) {
        // Destroy the old block
        if (mat instanceof TntBlock) {
          ((TntBlock) mat).onIgnite(sBlock, toCause(b)); // Ignite TntBlock
        } else if (mat instanceof VanillaBlockMaterial) {
          VanillaBlockMaterial sVanillaBlock = (VanillaBlockMaterial) mat; // Destroy vanilla blocks without drops
          sVanillaBlock.getDrops().clear();
          sVanillaBlock.destroy(sBlock, toCause(b));
        } else {
          sBlock.setMaterial(VanillaMaterials.AIR); // Set non vanilla blocks to air
        }
        // Put fire in it's place?
        if (rand.nextInt(blockData + 10) < 5 && hasBurningSource(sBlock) && !VanillaBlockMaterial.isRaining(sBlock)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.