diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2021-01-16 01:12:04 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2021-01-16 01:12:04 -0500 |
commit | e0a6cfb0aba631d3a1cd27971f87b0d4a677f294 (patch) | |
tree | c87a18f10a1cb7b0cab4b278a4b6b424cefcebc7 /src/main/java/net/cshift/transit/basic/AbstractTwoWayNode.java | |
parent | bfe0005433f5fd84d47a310578e6d4da4cfcc43d (diff) |
Update include paths
Diffstat (limited to 'src/main/java/net/cshift/transit/basic/AbstractTwoWayNode.java')
-rw-r--r-- | src/main/java/net/cshift/transit/basic/AbstractTwoWayNode.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/main/java/net/cshift/transit/basic/AbstractTwoWayNode.java b/src/main/java/net/cshift/transit/basic/AbstractTwoWayNode.java new file mode 100644 index 0000000..cc06eeb --- /dev/null +++ b/src/main/java/net/cshift/transit/basic/AbstractTwoWayNode.java @@ -0,0 +1,47 @@ +package net.cshift.transit.basic; + +import net.cshift.transit.network.system.*; +import net.cshift.transit.network.system.swap.*; +import net.minecraft.block.entity.*; + +public abstract class AbstractTwoWayNode extends AbstractAcceptorNode implements IProviderNode { + + public AbstractTwoWayNode(BlockEntityType<?> type) { + super(type); + } + + @Override + public boolean linkAcceptor(IAcceptorNode requestor, String group) { + if(this.hasGroup(group)) + { + for (Connection c : connections) { + if(c.getNode() == requestor) + return false; + } + + connections.add(new Connection(requestor, (short) 1)); + + return true; + } + + return false; + } + + @Override + public boolean unlinkAcceptor(IAcceptorNode requestor) { + for (Connection c : connections) { + if(c.getNode() == requestor) + { + if(c.isProviding()) + c.setAccepting(false); + else + connections.remove(c); + + return true; + } + } + + return false; + } + +} |