Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.bukkit.block.Banner;
import org.bukkit.block.BlockState;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.TrialSpawner;
import org.bukkit.spawner.TrialSpawnerConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.LimitedRegion;
Expand All @@ -20,6 +22,7 @@

import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintCreatureSpawner;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintTrialSpawner;
import world.bentobox.bentobox.util.Pair;
import world.bentobox.boxed.Boxed;
import world.bentobox.boxed.generators.chunks.AbstractBoxedChunkGenerator.ChestData;
Expand Down Expand Up @@ -98,6 +101,10 @@ public void setBlockState(BlockState bs, BlueprintBlock bpBlock) {
else if (bs instanceof CreatureSpawner spawner) {
setSpawner(spawner, bpBlock.getCreatureSpawner());
}
// Trial spawners
else if (bs instanceof TrialSpawner trialSpawner && bpBlock.getTrialSpawner() != null) {
setTrialSpawner(trialSpawner, bpBlock.getTrialSpawner());
}
// Banners
else if (bs instanceof Banner banner && bpBlock.getBannerPatterns() != null) {
bpBlock.getBannerPatterns().removeIf(Objects::isNull);
Expand Down Expand Up @@ -129,4 +136,16 @@ public void setSpawner(CreatureSpawner spawner, BlueprintCreatureSpawner s) {
spawner.update(true, false);
}

/**
* Set the trial spawner configuration from the blueprint
*
* @param trialSpawner - trial spawner
* @param bts - blueprint trial spawner
*/
public void setTrialSpawner(TrialSpawner trialSpawner, BlueprintTrialSpawner bts) {
TrialSpawnerConfiguration config = trialSpawner.getNormalConfiguration();
trialSpawner.setOminous(bts.configTrialSpawner(config));
trialSpawner.update(true, false);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.bukkit.block.BlockState;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.Sign;
import org.bukkit.block.TrialSpawner;
import org.bukkit.entity.AbstractHorse;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.ChestedHorse;
Expand All @@ -36,6 +37,7 @@
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintCreatureSpawner;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintTrialSpawner;
import world.bentobox.boxed.Boxed;

/**
Expand Down Expand Up @@ -175,6 +177,12 @@ private BlueprintBlock getBluePrintBlock(Block block) {
b.setCreatureSpawner(getSpawner(spawner));
}

// Trial spawner
if (blockState instanceof TrialSpawner trialSpawner) {
b.setTrialSpawner(new BlueprintTrialSpawner(trialSpawner.isOminous(),
trialSpawner.isOminous() ? trialSpawner.getOminousConfiguration() : trialSpawner.getNormalConfiguration()));
}

// Banners
if (blockState instanceof Banner banner) {
b.setBannerPatterns(banner.getPatterns());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class NewAreaListener implements Listener {
"mineshaft", "mineshaft_mesa", "monument", "nether_fossil", "ocean_ruin_cold", "ocean_ruin_warm",
"pillager_outpost", "ruined_portal_desert", "ruined_portal_jungle", "ruined_portal_mountain",
"ruined_portal_nether", "ruined_portal_ocean", "ruined_portal_swamp", "ruined_portal", "shipwreck_beached",
"shipwreck", "stronghold", "swamp_hut", "village_desert", "village_plains", "village_savanna",
"shipwreck", "stronghold", "swamp_hut", "trial_chambers", "village_desert", "village_plains", "village_savanna",
"village_snowy", "village_taiga");
private final Boxed addon;
private final File structureFile;
Expand Down
Loading