Progress on Implementing Dungeon Packs

1. Integrated support for dungeon pack config options into the code
(i.e. we actually DO what the settings specify)
2. Added random transitions from one dungeon type to another. Dungeons
might also begin with a non-default pack.
3. Fixed a config reading bug that caused settings to be ignored and
some invalid settings wouldn't trigger exceptions. Also fixed other
dungeon pack bugs.
This commit is contained in:
SenseiKiwi
2013-08-21 14:26:10 -04:00
parent 99d9b5a2a1
commit 0e67596ca0
9 changed files with 263 additions and 41 deletions

View File

@@ -11,6 +11,25 @@ public class DungeonChainRuleDefinition
public DungeonChainRuleDefinition(ArrayList<String> conditions, ArrayList<WeightedContainer<String>> products)
{
//Validate the arguments, just in case
if (conditions == null)
{
throw new NullPointerException("conditions cannot be null");
}
if (products.isEmpty())
{
throw new IllegalArgumentException("products cannot be an empty list");
}
for (WeightedContainer<String> product : products)
{
//Check for weights less than 1. Those could cause Minecraft's random selection algorithm to throw an exception.
//At the very least, they're useless values.
if (product.itemWeight < 1)
{
throw new IllegalArgumentException("products cannot contain items with weights less than 1");
}
}
this.conditions = conditions;
this.products = products;
}