1
1
package com .jkantrell .mc .underilla .spigot .impl ;
2
2
3
+ import org .bukkit .block .data .BlockData ;
4
+ import org .bukkit .generator .LimitedRegion ;
3
5
import com .jkantrell .mc .underilla .core .api .Biome ;
4
6
import com .jkantrell .mc .underilla .core .api .Block ;
5
7
import com .jkantrell .mc .underilla .core .api .ChunkData ;
6
8
import com .jkantrell .mc .underilla .core .vector .VectorIterable ;
7
- import org .bukkit .block .data .BlockData ;
8
- import org .bukkit .generator .LimitedRegion ;
9
9
10
10
public class BukkitRegionChunkData implements ChunkData {
11
11
12
- //FIELDS
12
+ // FIELDS
13
13
private final LimitedRegion region_ ;
14
14
private final int minHeight_ , maxHeight_ , chunkX_ , chunkZ_ , absX_ , absZ_ ;
15
15
16
16
17
- //CONSTRUCTORS
17
+ // CONSTRUCTORS
18
18
public BukkitRegionChunkData (LimitedRegion region , int chunkX , int chunkZ , int minHeight , int maxHeight ) {
19
19
this .region_ = region ;
20
20
this .minHeight_ = minHeight ;
@@ -26,23 +26,19 @@ public BukkitRegionChunkData(LimitedRegion region, int chunkX, int chunkZ, int m
26
26
}
27
27
28
28
29
- //GETTERS
30
- public LimitedRegion getRegion () {
31
- return this .region_ ;
32
- }
29
+ // GETTERS
30
+ public LimitedRegion getRegion () { return this .region_ ; }
33
31
34
32
35
- //IMPLEMENTATIONS
33
+ // IMPLEMENTATIONS
36
34
@ Override
37
- public int getMaxHeight () {
38
- return this .maxHeight_ ;
39
- }
35
+ public int getMaxHeight () { return this .maxHeight_ ; }
40
36
@ Override
41
- public int getMinHeight () {
42
- return this .minHeight_ ;
43
- }
37
+ public int getMinHeight () { return this .minHeight_ ; }
44
38
@ Override
45
39
public Block getBlock (int x , int y , int z ) {
40
+ // TODO also save state of block if needed (for structure chests).
41
+ // this.region_.getBlockState(this.absX_ + x, y, this.absZ_ + z);
46
42
BlockData d = this .region_ .getBlockData (this .absX_ + x , y , this .absZ_ + z );
47
43
return new BukkitBlock (d );
48
44
}
@@ -57,12 +53,16 @@ public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax
57
53
}
58
54
@ Override
59
55
public void setBlock (int x , int y , int z , Block block ) {
60
- if (!(block instanceof BukkitBlock bukkitBlock )) { return ; }
56
+ if (!(block instanceof BukkitBlock bukkitBlock )) {
57
+ return ;
58
+ }
61
59
this .region_ .setBlockData (this .absX_ + x , y , this .absZ_ + z , bukkitBlock .getBlockData ());
62
60
}
63
61
@ Override
64
62
public void setBiome (int x , int y , int z , Biome biome ) {
65
- if (!(biome instanceof BukkitBiome bukkitBiome )) { return ; }
63
+ if (!(biome instanceof BukkitBiome bukkitBiome )) {
64
+ return ;
65
+ }
66
66
this .region_ .setBiome (this .absX_ + x , y , this .absZ_ + z , bukkitBiome .getBiome ());
67
67
}
68
68
}
0 commit comments