added "setup_loot" boolean to PocketGenerator
This commit is contained in:
parent
8ae9300502
commit
315a8e2e0d
2 changed files with 10 additions and 1 deletions
|
@ -41,6 +41,7 @@ public abstract class PocketGenerator implements Weighted<PocketGenerationParame
|
||||||
|
|
||||||
private String weight;
|
private String weight;
|
||||||
private Equation weightEquation;
|
private Equation weightEquation;
|
||||||
|
private Boolean setupLoot;
|
||||||
|
|
||||||
private final List<String> tags = new ArrayList<>();
|
private final List<String> tags = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -83,6 +84,8 @@ public abstract class PocketGenerator implements Weighted<PocketGenerationParame
|
||||||
this.weight = tag.contains("weight") ? tag.getString("weight") : defaultWeightEquation;
|
this.weight = tag.contains("weight") ? tag.getString("weight") : defaultWeightEquation;
|
||||||
parseWeight();
|
parseWeight();
|
||||||
|
|
||||||
|
if (tag.contains("setup_loot")) setupLoot = tag.getBoolean("setup_loot");
|
||||||
|
|
||||||
if (tag.contains("modifiers")) {
|
if (tag.contains("modifiers")) {
|
||||||
ListTag modifiersTag = tag.getList("modifiers", 10);
|
ListTag modifiersTag = tag.getList("modifiers", 10);
|
||||||
for (int i = 0; i < modifiersTag.size(); i++) {
|
for (int i = 0; i < modifiersTag.size(); i++) {
|
||||||
|
@ -104,6 +107,8 @@ public abstract class PocketGenerator implements Weighted<PocketGenerationParame
|
||||||
|
|
||||||
if (!weight.equals("5")) tag.putString("weight", weight);
|
if (!weight.equals("5")) tag.putString("weight", weight);
|
||||||
|
|
||||||
|
if (setupLoot != null) tag.putBoolean("setup_loot", setupLoot);
|
||||||
|
|
||||||
ListTag modifiersTag = new ListTag();
|
ListTag modifiersTag = new ListTag();
|
||||||
for (Modifier modifier : modifierList) {
|
for (Modifier modifier : modifierList) {
|
||||||
modifiersTag.add(modifier.toTag(new CompoundTag()));
|
modifiersTag.add(modifier.toTag(new CompoundTag()));
|
||||||
|
@ -133,6 +138,10 @@ public abstract class PocketGenerator implements Weighted<PocketGenerationParame
|
||||||
return this.weightEquation.apply(parameters.toVariableMap(new HashMap<>()));
|
return this.weightEquation.apply(parameters.toVariableMap(new HashMap<>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getSetupLoot() {
|
||||||
|
return setupLoot;
|
||||||
|
}
|
||||||
|
|
||||||
public void applyModifiers(PocketGenerationParameters parameters, RiftManager manager) {
|
public void applyModifiers(PocketGenerationParameters parameters, RiftManager manager) {
|
||||||
for (Modifier modifier : modifierList) {
|
for (Modifier modifier : modifierList) {
|
||||||
modifier.apply(parameters, manager);
|
modifier.apply(parameters, manager);
|
||||||
|
|
|
@ -99,7 +99,7 @@ public abstract class PocketGeneratorReference extends VirtualSingularPocket {
|
||||||
generator.applyModifiers(parameters, manager);
|
generator.applyModifiers(parameters, manager);
|
||||||
|
|
||||||
this.applyModifiers(parameters, manager);
|
this.applyModifiers(parameters, manager);
|
||||||
generator.setup(pocket, parameters, setupLoot != null ? setupLoot : true);
|
generator.setup(pocket, parameters, setupLoot != null ? setupLoot : (generator.getSetupLoot()) != null ? generator.getSetupLoot() : true);
|
||||||
return pocket;
|
return pocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue