From 4dd998522904822bb8e97d8f29c8c5f7d02de61d Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Sun, 15 Mar 2020 03:56:01 +0100 Subject: [PATCH] Fixed issues --- core/src/se/cookery/world/Block.java | 8 ++++---- core/src/se/cookery/world/GroundTypeManager.java | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/se/cookery/world/Block.java b/core/src/se/cookery/world/Block.java index ff99aa6..407df51 100644 --- a/core/src/se/cookery/world/Block.java +++ b/core/src/se/cookery/world/Block.java @@ -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)]; diff --git a/core/src/se/cookery/world/GroundTypeManager.java b/core/src/se/cookery/world/GroundTypeManager.java index 02bb8aa..f83c656 100644 --- a/core/src/se/cookery/world/GroundTypeManager.java +++ b/core/src/se/cookery/world/GroundTypeManager.java @@ -24,7 +24,7 @@ public class GroundTypeManager { // Variables - public static Map groundTypes = new HashMap<>(); + public static Map groundTypes = new HashMap<>(); public static void initialize() throws IOException { @@ -35,7 +35,7 @@ public class GroundTypeManager { for (Iterator 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); } }