Fixed issues

This commit is contained in:
Ziver Koc 2020-03-15 03:56:01 +01:00
parent 4b4fbcf5b0
commit 4dd9985229
2 changed files with 7 additions and 7 deletions

View file

@ -46,8 +46,8 @@ public class Block {
}
public void setHeight(long x, long y, byte height) {
this.height[getLocalX(x)][getLocalY(y)] = height;
public void setHeight(long x, long y, int height) {
this.height[getLocalX(x)][getLocalY(y)] = (byte) height;
}
public int getHeight(long x, long y) {
return height[getLocalX(x)][getLocalY(y)];
@ -57,8 +57,8 @@ public class Block {
public void setGroundType(long x, long y, GroundType groundType) {
setGroundType(x, y, groundType.getId());
}
public void setGroundType(long x, long y, short groundTypeId) {
this.groundType[getLocalX(x)][getLocalY(y)] = groundTypeId;
public void setGroundType(long x, long y, int groundTypeId) {
this.groundType[getLocalX(x)][getLocalY(y)] = (short) groundTypeId;
}
public short getGroundType(long x, long y) {
return groundType[getLocalX(x)][getLocalY(y)];

View file

@ -24,7 +24,7 @@ public class GroundTypeManager {
// Variables
public static Map<Integer, GroundType> groundTypes = new HashMap<>();
public static Map<Short, GroundType> groundTypes = new HashMap<>();
public static void initialize() throws IOException {
@ -35,7 +35,7 @@ public class GroundTypeManager {
for (Iterator<String> keys=json.keyIterator(); keys.hasNext();) {
int id = Integer.parseInt(keys.next());
short id = Short.parseShort(keys.next());
DataNode groundJson = json.get(id);
registerGroundType(new GroundType(
@ -53,6 +53,6 @@ public class GroundTypeManager {
public static GroundType get(int id) {
if (0 > id || id > groundTypes.size())
throw new InvalidParameterException("Provided id " + id + " is not associated with a ground type.");
return groundTypes.get(id);
return groundTypes.get((short) id);
}
}