Add biome support to blueprints.

https://github.com/BentoBoxWorld/BentoBox/issues/1571
This commit is contained in:
tastybento 2020-11-08 12:24:40 -08:00
parent 3581537537
commit 1ec886472d
3 changed files with 26 additions and 0 deletions

View File

@ -241,6 +241,8 @@ public class BlueprintClipboard {
// Block state // Block state
BlockState blockState = block.getState(); BlockState blockState = block.getState();
BlueprintBlock b = new BlueprintBlock(block.getBlockData().getAsString()); BlueprintBlock b = new BlueprintBlock(block.getBlockData().getAsString());
// Biome
b.setBiome(block.getBiome());
// Signs // Signs
if (blockState instanceof Sign) { if (blockState instanceof Sign) {
Sign sign = (Sign)blockState; Sign sign = (Sign)blockState;

View File

@ -243,6 +243,10 @@ public class BlueprintPaster {
} }
block.setBlockData(bd, false); block.setBlockData(bd, false);
setBlockState(block, bpBlock); setBlockState(block, bpBlock);
// Set biome
if (bpBlock.getBiome() != null) {
block.setBiome(bpBlock.getBiome());
}
// pos1 and pos2 update // pos1 and pos2 update
updatePos(block.getLocation()); updatePos(block.getLocation());
}); });

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.bukkit.block.Biome;
import org.bukkit.block.banner.Pattern; import org.bukkit.block.banner.Pattern;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -23,6 +24,11 @@ public class BlueprintBlock {
private Map<Integer, ItemStack> inventory; private Map<Integer, ItemStack> inventory;
@Expose @Expose
private BlueprintCreatureSpawner creatureSpawner; private BlueprintCreatureSpawner creatureSpawner;
/**
* Since 1.15.2
*/
@Expose
private Biome biome;
/** /**
* @since 1.8.0 * @since 1.8.0
*/ */
@ -104,4 +110,18 @@ public class BlueprintBlock {
public void setBannerPatterns(List<Pattern> bannerPatterns) { public void setBannerPatterns(List<Pattern> bannerPatterns) {
this.bannerPatterns = 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;
}
} }