mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-27 12:45:25 +01:00
Preserve BlockData in 1.13+
This commit is contained in:
parent
1df8a0a3d4
commit
53e029bd3b
@ -17,6 +17,7 @@ import java.util.Map;
|
||||
public class BlockData {
|
||||
|
||||
private String material;
|
||||
private String blockData = "";
|
||||
private String biome;
|
||||
private String stateType = BlockStateType.NORMAL.toString();
|
||||
private String dataType = BlockDataType.NORMAL.toString();
|
||||
@ -72,6 +73,15 @@ public class BlockData {
|
||||
this.material = material.name();
|
||||
}
|
||||
|
||||
public String getBlockData() {
|
||||
return blockData;
|
||||
}
|
||||
|
||||
public void setBlockData(String blockData) {
|
||||
this.blockData = blockData;
|
||||
}
|
||||
|
||||
|
||||
public String getBiome() {
|
||||
return this.biome;
|
||||
}
|
||||
|
@ -28,6 +28,10 @@ public final class BlockUtil extends BlockUtils {
|
||||
int NMSVersion = NMSUtil.getVersionNumber();
|
||||
blockData.setVersion(NMSVersion);
|
||||
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
|
||||
blockData.setBlockData(block.getBlockData().getAsString());
|
||||
}
|
||||
|
||||
BlockState blockState = block.getState();
|
||||
MaterialData materialData = blockState.getData();
|
||||
|
||||
@ -252,7 +256,10 @@ public final class BlockUtil extends BlockUtils {
|
||||
Material material = Material.valueOf(materialStr);
|
||||
if (material == Material.AIR) return;
|
||||
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13))
|
||||
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData());
|
||||
else
|
||||
block.setBlockData(Bukkit.getServer().createBlockData(blockData.getBlockData()));
|
||||
|
||||
// TODO Create a class to support biome changes
|
||||
// block.setBiome(Biome.valueOf(blockData.getBiome().toUpperCase()));
|
||||
|
Loading…
Reference in New Issue
Block a user