Package org.getspout.spoutapi.material

Examples of org.getspout.spoutapi.material.Block


    if (modifiedData.size() > 0) {
      ByteBuffer rawData = ByteBuffer.allocate(modifiedData.size() * (15));

      Iterator<Block> i = modifiedData.iterator();
      while (i.hasNext()) {
        Block next = i.next();

        rawData.put((byte) next.getRawId());
        rawData.put((byte) next.getRawData());
        rawData.putFloat(next.getHardness());
        rawData.putInt(next.getLightLevel());
        rawData.putFloat(next.getFriction());
        rawData.put((byte) (next.isOpaque() ? 1 : 0));
      }

      data = rawData.array();
    }
  }
View Full Code Here


    short size = input.readShort();
    for (int i = 0; i < size; i++) {
      int id = input.readInt();
      int data = input.readShort();
      float mod = input.readFloat();
      Block block = MaterialData.getBlock(id, (short) data);
      if (data == -1) {
        block = MaterialData.getCustomBlock(id);
      }
      setStrengthModifier(block, mod);
    }
View Full Code Here

    super.writeData(output);
    output.writeShort(getMaxDurability());
    Block[] mod = getStrengthModifiedBlocks();
    output.writeShort((short) mod.length);
    for (int i = 0; i < mod.length; i++) {
      Block block = mod[i];
      if (block instanceof CustomBlock) {
        output.writeInt(((CustomBlock) block).getCustomId());
        output.writeShort((short) -1);
      } else {
        output.writeInt(block.getRawId());
        output.writeShort((short) block.getRawData());
      }
      output.writeFloat(getStrengthModifier(block));
    }
  }
View Full Code Here

TOP

Related Classes of org.getspout.spoutapi.material.Block

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.