From 1ec886472d4d9ced5415c6a92d595dd2cf690678 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 8 Nov 2020 12:24:40 -0800 Subject: [PATCH] Add biome support to blueprints. https://github.com/BentoBoxWorld/BentoBox/issues/1571 --- .../blueprints/BlueprintClipboard.java | 2 ++ .../bentobox/blueprints/BlueprintPaster.java | 4 ++++ .../dataobjects/BlueprintBlock.java | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintClipboard.java b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintClipboard.java index 36205c4e8..be5f3199e 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintClipboard.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintClipboard.java @@ -241,6 +241,8 @@ public class BlueprintClipboard { // Block state BlockState blockState = block.getState(); BlueprintBlock b = new BlueprintBlock(block.getBlockData().getAsString()); + // Biome + b.setBiome(block.getBiome()); // Signs if (blockState instanceof Sign) { Sign sign = (Sign)blockState; diff --git a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java index 6616816cd..8327ffc01 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/BlueprintPaster.java @@ -243,6 +243,10 @@ public class BlueprintPaster { } block.setBlockData(bd, false); setBlockState(block, bpBlock); + // Set biome + if (bpBlock.getBiome() != null) { + block.setBiome(bpBlock.getBiome()); + } // pos1 and pos2 update updatePos(block.getLocation()); }); diff --git a/src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintBlock.java b/src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintBlock.java index a54c38a0b..4aa327bdf 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintBlock.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintBlock.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.bukkit.block.Biome; import org.bukkit.block.banner.Pattern; import org.bukkit.inventory.ItemStack; @@ -23,6 +24,11 @@ public class BlueprintBlock { private Map inventory; @Expose private BlueprintCreatureSpawner creatureSpawner; + /** + * Since 1.15.2 + */ + @Expose + private Biome biome; /** * @since 1.8.0 */ @@ -104,4 +110,18 @@ public class BlueprintBlock { public void setBannerPatterns(List bannerPatterns) { this.bannerPatterns = bannerPatterns; } + + /** + * @return the biome + */ + public Biome getBiome() { + return biome; + } + + /** + * @param biome the biome to set + */ + public void setBiome(Biome biome) { + this.biome = biome; + } }