Started implementation of FillerSet
This commit is contained in:
parent
a2df79bc01
commit
564d638159
1 changed files with 38 additions and 0 deletions
38
src/main/java/cr0s/warpdrive/conf/structures/FillerSet.java
Normal file
38
src/main/java/cr0s/warpdrive/conf/structures/FillerSet.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package cr0s.warpdrive.conf.structures;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import cr0s.warpdrive.conf.InvalidXmlException;
|
||||
import cr0s.warpdrive.conf.MetaBlock;
|
||||
import cr0s.warpdrive.conf.XmlRepresentable;
|
||||
|
||||
public class FillerSet implements XmlRepresentable {
|
||||
|
||||
private MetaBlock[] weightedFillerBlocks;
|
||||
|
||||
public FillerSet() {
|
||||
//To prevent getting rand.nextInt(0)
|
||||
weightedFillerBlocks = new MetaBlock[1];
|
||||
}
|
||||
|
||||
public MetaBlock getRandomBlock(Random rand) {
|
||||
return weightedFillerBlocks[rand.nextInt(weightedFillerBlocks.length)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFromXmlElement(Element e) throws InvalidXmlException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToXmlElement(Element e, Document d) throws InvalidXmlException {
|
||||
// TODO Not really needed
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue