Optimized fields
This commit is contained in:
parent
f8353d4354
commit
4b4fbcf5b0
2 changed files with 8 additions and 8 deletions
|
|
@ -17,8 +17,8 @@ public class Block {
|
|||
|
||||
private long offset_x = 0;
|
||||
private long offset_y = 0;
|
||||
private int[][] height = new int[BLOCK_SIZE][BLOCK_SIZE];
|
||||
private int[][] groundType = new int[BLOCK_SIZE][BLOCK_SIZE];
|
||||
private byte[][] height = new byte[BLOCK_SIZE][BLOCK_SIZE];
|
||||
private short[][] groundType = new short[BLOCK_SIZE][BLOCK_SIZE];
|
||||
|
||||
public Block(long x, long y) {
|
||||
offset_x = x;
|
||||
|
|
@ -46,7 +46,7 @@ public class Block {
|
|||
}
|
||||
|
||||
|
||||
public void setHeight(long x, long y, int height) {
|
||||
public void setHeight(long x, long y, byte height) {
|
||||
this.height[getLocalX(x)][getLocalY(y)] = height;
|
||||
}
|
||||
public int getHeight(long x, long y) {
|
||||
|
|
@ -57,10 +57,10 @@ public class Block {
|
|||
public void setGroundType(long x, long y, GroundType groundType) {
|
||||
setGroundType(x, y, groundType.getId());
|
||||
}
|
||||
public void setGroundType(long x, long y, int groundTypeId) {
|
||||
public void setGroundType(long x, long y, short groundTypeId) {
|
||||
this.groundType[getLocalX(x)][getLocalY(y)] = groundTypeId;
|
||||
}
|
||||
public int getGroundType(long x, long y) {
|
||||
public short getGroundType(long x, long y) {
|
||||
return groundType[getLocalX(x)][getLocalY(y)];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@ package se.cookery.world;
|
|||
public final class GroundType {
|
||||
// Variables
|
||||
|
||||
private final int id;
|
||||
private final short id;
|
||||
private final String name;
|
||||
|
||||
|
||||
protected GroundType(int id, String name) {
|
||||
protected GroundType(short id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public short getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue