chore: minor changes

- null check get tile in ThreadUnsafeCharBlocks
 - 0 to reserved ID
This commit is contained in:
dordsor21 2023-06-18 15:03:51 +01:00
parent 78fb74665f
commit 135c77cfb5
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
8 changed files with 8 additions and 8 deletions

View File

@ -415,7 +415,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
} }
int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); int ordinal = set.getBlock(lx, ly, lz).getOrdinal();
if (ordinal != 0) { if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) {
BlockEntity tile = entry.getValue(); BlockEntity tile = entry.getValue();
if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) {
if (beacons == null) { if (beacons == null) {

View File

@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
} }
int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); int ordinal = set.getBlock(lx, ly, lz).getOrdinal();
if (ordinal != 0) { if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) {
BlockEntity tile = entry.getValue(); BlockEntity tile = entry.getValue();
if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) {
if (beacons == null) { if (beacons == null) {

View File

@ -406,7 +406,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
} }
int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); int ordinal = set.getBlock(lx, ly, lz).getOrdinal();
if (ordinal != 0) { if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) {
BlockEntity tile = entry.getValue(); BlockEntity tile = entry.getValue();
if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) {
if (beacons == null) { if (beacons == null) {

View File

@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
} }
int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); int ordinal = set.getBlock(lx, ly, lz).getOrdinal();
if (ordinal != 0) { if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) {
BlockEntity tile = entry.getValue(); BlockEntity tile = entry.getValue();
if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) {
if (beacons == null) { if (beacons == null) {

View File

@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
} }
int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); int ordinal = set.getBlock(lx, ly, lz).getOrdinal();
if (ordinal != 0) { if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) {
BlockEntity tile = entry.getValue(); BlockEntity tile = entry.getValue();
if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) {
if (beacons == null) { if (beacons == null) {

View File

@ -386,7 +386,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
} }
int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); int ordinal = set.getBlock(lx, ly, lz).getOrdinal();
if (ordinal != 0) { if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) {
BlockEntity tile = entry.getValue(); BlockEntity tile = entry.getValue();
if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) {
if (beacons == null) { if (beacons == null) {

View File

@ -50,7 +50,7 @@ public class SimpleChangeSetSummary implements ChangeSetSummary {
public Map<BlockState, Integer> getBlocks() { public Map<BlockState, Integer> getBlocks() {
HashMap<BlockState, Integer> map = new HashMap<>(); HashMap<BlockState, Integer> map = new HashMap<>();
for (int i = 0; i < blocks.length; i++) { for (int i = 0; i < blocks.length; i++) {
if (blocks[i] != 0) { if (blocks[i] != BlockTypesCache.ReservedIDs.__RESERVED__) {
BlockState state = BlockTypesCache.states[i]; BlockState state = BlockTypesCache.states[i];
map.put(state, blocks[i]); map.put(state, blocks[i]);
} }

View File

@ -122,7 +122,7 @@ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks {
@Override @Override
public CompoundTag getTile(int x, int y, int z) { public CompoundTag getTile(int x, int y, int z) {
return tiles.get(x, y, z); return tiles == null ? null : tiles.get(x, y, z);
} }
@Override @Override