From 914bde6c19f50350153ab4080f2af4d127a1783a Mon Sep 17 00:00:00 2001 From: Andrey Nikitin Date: Wed, 1 Feb 2023 17:37:01 +0300 Subject: [PATCH] Docs! --- examples/.vscode/settings.json | 3 ++ examples/nav_dash.lua | 29 ++++++++++++ .../tardim_ic/DigitalInterfacePeripheral.java | 44 ++++++++++++++++--- 3 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 examples/.vscode/settings.json create mode 100644 examples/nav_dash.lua diff --git a/examples/.vscode/settings.json b/examples/.vscode/settings.json new file mode 100644 index 0000000..93e0e54 --- /dev/null +++ b/examples/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "Lua.runtime.version": "Lua 5.4" +} \ No newline at end of file diff --git a/examples/nav_dash.lua b/examples/nav_dash.lua new file mode 100644 index 0000000..8ebe729 --- /dev/null +++ b/examples/nav_dash.lua @@ -0,0 +1,29 @@ +local tardim = peripheral.find("digital_tardim_interface") +local screen = peripheral.find("monitor") + +screen.clear() +screen.setCursorBlink(false) +screen.setTextScale(0.5) + +-- 15x24 +--[[ +~ Current pos + X + Y + Z + Dimension + Facing +~ Destination + X + Y + Z + Dimension + Facing +~Fuel + Remaining + Required + + +TARDIM NAV| 11 + +]] \ No newline at end of file diff --git a/src/main/java/su/a71/tardim_ic/tardim_ic/DigitalInterfacePeripheral.java b/src/main/java/su/a71/tardim_ic/tardim_ic/DigitalInterfacePeripheral.java index 061917c..8f6fce4 100644 --- a/src/main/java/su/a71/tardim_ic/tardim_ic/DigitalInterfacePeripheral.java +++ b/src/main/java/su/a71/tardim_ic/tardim_ic/DigitalInterfacePeripheral.java @@ -51,26 +51,48 @@ public class DigitalInterfacePeripheral implements IPeripheral { /** * @param tileEntity the tile entity of this peripheral + * @hidden */ public DigitalInterfacePeripheral(DigitalInterfaceTileEntity tileEntity) { this.tileEntity = tileEntity; } - // Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n" + /** Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n" + * @hidden + */ @Nonnull @Override public String getType() { return "digital_tardim_interface"; } - // Apparently CC uses this to check if the peripheral in front of a modem is this one + /** Apparently CC uses this to check if the peripheral in front of a modem is this one + * @hidden + * @param iPeripheral The peripheral to compare against. This may be {@code null}. + * @return {@code true} if the peripheral is the same as this one. + */ @Override public boolean equals(@Nullable IPeripheral iPeripheral) { return this == iPeripheral; } - // Called when a computer connects/disconnects from the peripheral + /** Called when a computer disconnects from the peripheral + * @hidden + * @param computer The interface to the computer that is being detached. Remember that multiple computers can be + * attached to a peripheral at once. + */ @Override public void detach(@Nonnull IComputerAccess computer) { connectedComputers.remove(computer); } + + /** Called when a computer connects to the peripheral + * @hidden + * @param computer The interface to the computer that is being attached. Remember that multiple computers can be + * attached to a peripheral at once. + */ @Override public void attach(@Nonnull IComputerAccess computer) { connectedComputers.add(computer); } + /** + * I *think* I use this to get peripheral's world position + * @hidden + * @return + */ public DigitalInterfaceTileEntity getTileEntity() { return tileEntity; } @@ -90,7 +112,8 @@ public class DigitalInterfacePeripheral implements IPeripheral { * * @return TardimData of the TARDIM that the peripheral is in * @throws LuaException if the peripheral is not in a TARDIM - * */ + * @hidden + */ public TardimData getTardimData() throws LuaException { int X = getTileEntity().getPos().getX(), Z = getTileEntity().getPos().getZ(); @@ -672,6 +695,16 @@ public class DigitalInterfacePeripheral implements IPeripheral { } } + /** + * Helper method to find a biome + * @param level ServerLevel to search + * @param biome Biome to find + * @param pos BlockPos to start from + * @param i Idk what this is, likely a radius + * @param j No idea about this either + * @return BlockPos of the biome + * @hidden + */ public BlockPos findNearestBiome(ServerLevel level, Biome biome, BlockPos pos, int i, int j) { Pair> bb = level.getChunkSource() .getGenerator() @@ -689,7 +722,4 @@ public class DigitalInterfacePeripheral implements IPeripheral { ); return bb != null && bb.getFirst() != null ? (BlockPos)bb.getFirst() : null; } - - // I would love to add this, but the methods are very hard so I will slowly remove the backlog - // TODO: demat, remat }