Always assume your code is going to compile.

This commit is contained in:
Andrey Nikitin 2023-02-02 01:16:05 +03:00
parent ac2e1172fe
commit fa3a2c9414
2 changed files with 71 additions and 9 deletions

View file

@ -294,20 +294,19 @@ public class DigitalInterfacePeripheral implements IPeripheral {
@LuaFunction(mainThread = true)
public final ObjectLuaTable getTravelLocation() throws LuaException {
TardimData data = getTardimData();
if (data.getTravelLocation() != null) {
Location loc = data.getTravelLocation();
return new ObjectLuaTable(Map.of(
if (data.getTravelLocation() == null) {
data.setTravelLocation(data.getCurrentLocation());
}
Location loc = data.getTravelLocation();
return new ObjectLuaTable(Map.of(
"dimension", loc.getLevel().location().toString(),
"pos", new ObjectLuaTable(Map.of(
"x", loc.getPos().getX(),
"y", loc.getPos().getY(),
"z", loc.getPos().getZ()
)),
"facing", loc.getFacing().toString()
));
} else {
return null;
}
"facing", loc.getFacing().toString()
));
}
/**