ContainerProto.java

jmud-0.11/src/ContainerProto.java · 888 B

From the archive jmud-0_11.tgz

Download the archive   « Back to the archive contents

import java.io.BufferedReader;
import java.io.IOException;

import util.file.InvalidFileFormatException;
import misc.Separators;
import util.log.Log;

class ContainerProto extends ItemProto {

  int  capacity = 0;

  ContainerProto(int zoneBase, int itemId, BufferedReader itemFile) throws InvalidFileFormatException {

    super(zoneBase, itemId, itemFile);
    Log.log("Recipiente: " + getName());
    
    try {
      String line = itemFile.readLine();
      capacity = Integer.parseInt(line);
    }
    catch(IOException e) {
      throw new InvalidFileFormatException();
    }
  }

  protected void finalize() {
    super.finalize();
  }

  int getProtoType() {
    return Item.T_CONTAINER;
  }

  Item create() {
    return new Container(this);
  }

  // Sheetable:

  public String getSheet() {
    return super.getSheet() + Separators.NL +
      "Capacidade: " + capacity;
  }

}

Site Stats

Snippets: 1791
Codebases: 571