From e0a6cfb0aba631d3a1cd27971f87b0d4a677f294 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 16 Jan 2021 01:12:04 -0500 Subject: Update include paths --- .../cshift/transit/basic/AbstractProviderNode.java | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main/java/net/cshift/transit/basic/AbstractProviderNode.java (limited to 'src/main/java/net/cshift/transit/basic/AbstractProviderNode.java') diff --git a/src/main/java/net/cshift/transit/basic/AbstractProviderNode.java b/src/main/java/net/cshift/transit/basic/AbstractProviderNode.java new file mode 100644 index 0000000..cc81544 --- /dev/null +++ b/src/main/java/net/cshift/transit/basic/AbstractProviderNode.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 AbstractProviderNode extends AbstractNode implements IProviderNode { + + public AbstractProviderNode(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; + } + +} -- cgit v1.2.3