Skip to content

Commit 8f49fae

Browse files
committed
Basic tunnel structure re-add
1 parent 52b9c4d commit 8f49fae

18 files changed

+162
-138
lines changed

src/api/java/dev/compactmods/machines/api/tunnels/EnumTunnelSide.java

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/api/java/dev/compactmods/machines/api/tunnels/ICapableTunnel.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/api/java/dev/compactmods/machines/api/tunnels/IItemTunnel.java

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package dev.compactmods.machines.api.tunnels;
2+
3+
import javax.annotation.Nonnull;
4+
import java.util.Optional;
5+
import dev.compactmods.machines.api.teleportation.IDimensionalPosition;
6+
import net.minecraft.core.Direction;
7+
import net.minecraft.world.level.LevelReader;
8+
import net.minecraft.world.level.block.state.BlockState;
9+
10+
/**
11+
* Provides information on positions and states a tunnel is connected to.
12+
* Accessed via a sided capability lookup on either the tunnel block or a machine block.
13+
*/
14+
public interface ITunnelConnection {
15+
16+
@Nonnull
17+
IDimensionalPosition getConnectedPosition();
18+
19+
@Nonnull
20+
BlockState getConnectedState();
21+
22+
Optional<? extends LevelReader> getConnectedWorld();
23+
24+
/**
25+
* Gets the connection information for sidedness.
26+
*
27+
* From a machine block, gets the direction of the block adjacent to the tunnel.
28+
* From a tunnel block, gets the side of the machine the tunnel is bound to.
29+
*/
30+
Direction getConnectedSide();
31+
}

src/api/java/dev/compactmods/machines/api/tunnels/ITunnelConnectionInfo.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/api/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ public abstract class TunnelDefinition extends ForgeRegistryEntry<TunnelDefiniti
1111
*/
1212
public static final int NO_INDICATOR_COLOR = 3751749;
1313

14-
public abstract int getTunnelRingColor();
14+
public static final int IMPORT_COLOR = 0xff2462cd;
15+
public static final int EXPORT_COLOR = 0xffe6a709;
1516

17+
public abstract int getTunnelRingColor();
1618
/**
1719
* Gets the color for the indicator at the top-right of the block texture.
1820
*
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package dev.compactmods.machines.api.tunnels.item;
2+
3+
/**
4+
* Interface that allows for items to push into a machine's item buffer.
5+
*/
6+
public interface IItemExportTunnel extends IItemTunnel {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package dev.compactmods.machines.api.tunnels.item;
2+
3+
/**
4+
* Interface that allows for items to pull from a machine's item buffer.
5+
*/
6+
public interface IItemImportTunnel extends IItemTunnel {
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package dev.compactmods.machines.api.tunnels.item;
2+
3+
/**
4+
* Marker interface that specifies that one of the tunnel sides supports movement of items.
5+
*/
6+
public interface IItemTunnel {
7+
8+
}

src/api/java/dev/compactmods/machines/api/tunnels/redstone/IRedstoneReaderTunnel.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package dev.compactmods.machines.api.tunnels.redstone;
22

3-
import dev.compactmods.machines.api.tunnels.ITunnelConnectionInfo;
3+
import dev.compactmods.machines.api.tunnels.ITunnelConnection;
44

55
/**
66
* A redstone reader reads a redstone value from outside the machine (from a given side).
@@ -13,7 +13,7 @@ public interface IRedstoneReaderTunnel extends IRedstoneTunnel {
1313
* @param connectionInfo
1414
* @return
1515
*/
16-
default int getPowerLevel(ITunnelConnectionInfo connectionInfo) {
16+
default int getPowerLevel(ITunnelConnection connectionInfo) {
1717
return 0;
1818
}
1919

@@ -25,9 +25,9 @@ default int getPowerLevel(ITunnelConnectionInfo connectionInfo) {
2525
* @param connectionInfo Connection information for the tunnel instance.
2626
* @return
2727
*/
28-
default boolean canConnectRedstone(ITunnelConnectionInfo connectionInfo) {
28+
default boolean canConnectRedstone(ITunnelConnection connectionInfo) {
2929
return true;
3030
}
3131

32-
default void onPowerChanged(ITunnelConnectionInfo connectionInfo, int latestPower) {}
32+
default void onPowerChanged(ITunnelConnection connectionInfo, int latestPower) {}
3333
}

0 commit comments

Comments
 (0)