if (dir == 0) {
t.objectValue &= 0xfffe;
MutableTileValue t1 = new MutableTileValue(getTileValue(x, y - 1));
t1.objectValue &= 65535 - 4;
setTileValue(x, y - 1, t1.toTileValue());
} else if (dir == 1) {
t.objectValue &= 0xfffd;
MutableTileValue t1 = new MutableTileValue(getTileValue(x - 1, y));
t1.objectValue &= 65535 - 8;
setTileValue(x - 1, y, t1.toTileValue());