getJson method
Implementation
@override
Map<String, dynamic> getJson() {
var ret = <String, dynamic>{
'condition': 'minecraft:location_check',
'predicate': predicate?.getJson() ?? {},
};
if (block != null) ret['predicate']['block'] = _convertBlock(block!);
if (fluid != null) ret['predicate']['fluid'] = _convertBlock(fluid!);
if (biome != null) ret['predicate']['biome'] = biome;
if (dimension != null) {
if (dimension is Dimension) {
ret['predicate']['dimension'] = dimension.name;
} else {
ret['predicate'] = dimension.toString();
}
}
if (feature != null) ret['predicate']['feature'] = feature;
if (light != null) {
ret['predicate']['light'] = {
'light': light is Range ? light.getJson() : light,
};
}
if (x != null || y != null || z != null) ret['predicate']['position'] = {};
if (x != null) {
ret['predicate']['position']['x'] = x is Range ? x.getJson() : x;
}
if (y != null) {
ret['predicate']['position']['y'] = y is Range ? y.getJson() : y;
}
if (z != null) {
ret['predicate']['position']['z'] = z is Range ? z.getJson() : z;
}
if (offset != null) {
if (offset!.x != 0) ret['predicate']['offsetX'] = offset!.x;
if (offset!.y != 0) ret['predicate']['offsetY'] = offset!.y;
if (offset!.z != 0) ret['predicate']['offsetZ'] = offset!.z;
}
return ret;
}