Skip to content

Commit 8492e03

Browse files
committed
Checkstyle[#766] Return nil instead of teleporting to 0,0,0 when a warp point does not exist in a end automata turtle
1 parent 365c291 commit 8492e03

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/de/srendi/advancedperipherals/common/addons/computercraft/peripheral/plugins/AutomataWarpingPlugin.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,13 @@ public final MethodResult warpToPoint(String name) throws LuaException {
115115
if (pairData.leftPresent())
116116
return pairData.getLeft();
117117

118+
CompoundTag data = pairData.getRight();
119+
120+
if (!data.contains(name))
121+
return MethodResult.of(null, "Cannot find point to teleport");
122+
118123
TurtlePeripheralOwner owner = automataCore.getPeripheralOwner();
119124
Level level = owner.getLevel();
120-
CompoundTag data = pairData.getRight();
121125
BlockPos newPosition = NBTUtil.blockPosFromNBT(data.getCompound(name));
122126
return automataCore.withOperation(WARP, automataCore.toDistance(newPosition), context -> {
123127
boolean result = owner.move(level, newPosition);

0 commit comments

Comments
 (0)