added "setup_loot" boolean to PocketGenerator

This commit is contained in:
CreepyCre 2021-02-13 14:05:25 +01:00
parent 8ae9300502
commit 315a8e2e0d
2 changed files with 10 additions and 1 deletions

View file

@ -41,6 +41,7 @@ public abstract class PocketGenerator implements Weighted<PocketGenerationParame
private String weight;
private Equation weightEquation;
private Boolean setupLoot;
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;
parseWeight();
if (tag.contains("setup_loot")) setupLoot = tag.getBoolean("setup_loot");
if (tag.contains("modifiers")) {
ListTag modifiersTag = tag.getList("modifiers", 10);
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 (setupLoot != null) tag.putBoolean("setup_loot", setupLoot);
ListTag modifiersTag = new ListTag();
for (Modifier modifier : modifierList) {
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<>()));
}
public Boolean getSetupLoot() {
return setupLoot;
}
public void applyModifiers(PocketGenerationParameters parameters, RiftManager manager) {
for (Modifier modifier : modifierList) {
modifier.apply(parameters, manager);

View file

@ -99,7 +99,7 @@ public abstract class PocketGeneratorReference extends VirtualSingularPocket {
generator.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;
}