summaryrefslogtreecommitdiff
path: root/src/main/java/net/transit
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/transit')
-rw-r--r--src/main/java/net/transit/InitTransit.java13
-rw-r--r--src/main/java/net/transit/network/packet/ArrayPacket.java52
-rw-r--r--src/main/java/net/transit/network/packet/IStaticPacket.java23
-rw-r--r--src/main/java/net/transit/network/packet/MetaPacket.java35
-rw-r--r--src/main/java/net/transit/network/packet/Packet.java23
-rw-r--r--src/main/java/net/transit/network/packet/StaticPacket.java36
-rw-r--r--src/main/java/net/transit/network/packet/dynamic/ArrayPacket.java74
-rw-r--r--src/main/java/net/transit/network/packet/dynamic/DynamicPacket.java43
-rw-r--r--src/main/java/net/transit/network/packet/dynamic/IDynamicPacket.java16
-rw-r--r--src/main/java/net/transit/network/packet/dynamic/MetaDynamicPacket.java44
-rw-r--r--src/main/java/net/transit/network/system/INode.java45
-rw-r--r--src/main/java/net/transit/network/system/ISystem.java17
-rw-r--r--src/main/java/net/transit/network/system/Node.java45
-rw-r--r--src/main/java/net/transit/network/system/System.java17
-rw-r--r--src/main/java/net/transit/network/system/swap/AcceptorNode.java39
-rw-r--r--src/main/java/net/transit/network/system/swap/ProviderNode.java29
-rw-r--r--src/main/java/net/transit/type/TFluid.java33
-rw-r--r--src/main/java/net/transit/type/TMana.java31
-rw-r--r--src/main/java/net/transit/type/Type.java60
-rw-r--r--src/main/java/net/transit/type/group/GroupRegistry.java49
-rw-r--r--src/main/java/net/transit/type/group/TypeGroup.java229
-rw-r--r--src/main/java/net/transit/type/group/simple/SimpleGroups.java33
-rw-r--r--src/main/java/net/transit/type/simple/SimpleTypes.java22
23 files changed, 0 insertions, 1008 deletions
diff --git a/src/main/java/net/transit/InitTransit.java b/src/main/java/net/transit/InitTransit.java
deleted file mode 100644
index a137040..0000000
--- a/src/main/java/net/transit/InitTransit.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package net.transit;
-
-import net.fabricmc.api.ModInitializer;
-import net.transit.type.group.simple.SimpleGroups;
-
-public class InitTransit implements ModInitializer {
-
- @Override
- public void onInitialize() {
- SimpleGroups.init();
- }
-
-}
diff --git a/src/main/java/net/transit/network/packet/ArrayPacket.java b/src/main/java/net/transit/network/packet/ArrayPacket.java
deleted file mode 100644
index fbea811..0000000
--- a/src/main/java/net/transit/network/packet/ArrayPacket.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package net.transit.network.packet;
-
-import java.util.ArrayList;
-
-import net.transit.type.Type;
-
-public class ArrayPacket<D> implements Packet<D>
-{
- private ArrayList<D> arrayData;
- private Type<D> type;
-
- public ArrayPacket(D startValue, Type<D> t)
- {
- arrayData = new ArrayList<D>(0);
- arrayData.add(startValue);
- type = t;
- }
-
- @Override
- public D getData()
- {
- if(arrayData.size() > 0) return arrayData.get(0);
- return null;
- }
-
- public void addData(D data)
- {
- arrayData.add(data);
- }
-
- public int dataStored()
- {
- return arrayData.size();
- }
-
- public D popAndShift()
- {
- D temp = null;
-
- if(arrayData.size() > 0)
- {
- temp = arrayData.remove(0);
- }
-
- return temp;
- }
-
- @Override
- public Type<D> getType() {
- return type;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/IStaticPacket.java b/src/main/java/net/transit/network/packet/IStaticPacket.java
deleted file mode 100644
index 01073d3..0000000
--- a/src/main/java/net/transit/network/packet/IStaticPacket.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.transit.network.packet;
-
-import net.transit.type.Type;
-
-/** Interface describing an unchanging packet.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers.
- */
-public interface IStaticPacket<D>
-{
- /**Get the packet's data.
- *
- * @return <D> The packet's data
- */
- public D getData();
-
- /**Get the packet's type.
- *
- * @return IType<<D>> The type of the packet
- */
- public Type<D> getType();
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/MetaPacket.java b/src/main/java/net/transit/network/packet/MetaPacket.java
deleted file mode 100644
index 7e49318..0000000
--- a/src/main/java/net/transit/network/packet/MetaPacket.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package net.transit.network.packet;
-
-import net.transit.type.Type;
-
-/** Static packet with extra data attached.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- * @param <M> The type of metadata
-*/
-public class MetaPacket<D, M> extends StaticPacket<D>
-{
- private M metaData;
-
- /** Constructor
- *
- * @param dat The data to store
- * @param t The Type of the data
- * @param meta The metadata to store
- */
- public MetaPacket(D dat, Type<D> t, M meta)
- {
- super(dat, t);
- metaData = meta;
- }
-
- /** Get the metadata of the packet.
- *
- * @return The packet's metadata
- */
- public M getMetaData()
- {
- return metaData;
- }
-}
diff --git a/src/main/java/net/transit/network/packet/Packet.java b/src/main/java/net/transit/network/packet/Packet.java
deleted file mode 100644
index 0b7c832..0000000
--- a/src/main/java/net/transit/network/packet/Packet.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.transit.network.packet;
-
-import net.transit.type.Type;
-
-/**
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers.
- */
-public interface Packet<D>
-{
- /**Get the packet's data
- *
- * @return <D> The packet's data
- */
- public D getData();
-
- /**Get the packet's type
- *
- * @return IType<<D>> The type of the packet
- */
- public Type<D> getType();
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/StaticPacket.java b/src/main/java/net/transit/network/packet/StaticPacket.java
deleted file mode 100644
index eeeae3f..0000000
--- a/src/main/java/net/transit/network/packet/StaticPacket.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package net.transit.network.packet;
-
-import net.transit.type.Type;
-
-/** Simple packet which stores an unchanging value.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers.
- */
-public class StaticPacket<D> implements IStaticPacket<D>
-{
- private D data;
- private Type<D> type;
-
- /** Constructor. Stores the given data and uses the given type.
- *
- * @param dat The packet's data
- * @param t The packet's type
- */
- public StaticPacket(D dat, Type<D> t)
- {
- data = dat;
- type = t;
- }
-
- @Override
- public D getData()
- {
- return data;
- }
-
- @Override
- public Type<D> getType() {
- return type;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/dynamic/ArrayPacket.java b/src/main/java/net/transit/network/packet/dynamic/ArrayPacket.java
deleted file mode 100644
index 0c27c80..0000000
--- a/src/main/java/net/transit/network/packet/dynamic/ArrayPacket.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package net.transit.network.packet.dynamic;
-
-import java.util.ArrayList;
-
-import net.transit.type.Type;
-
-/** A packet type which stores multiple values which can be accessed. When getting data, pop and shift from the array.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- */
-public class ArrayPacket<D> implements IDynamicPacket<D>
-{
- private ArrayList<D> arrayData;
- private Type<D> type;
-
- /** Constructor
- * Create an array packet. Adds the starting value.
- * @param startValue The starting value
- * @param t The type of the packet
- */
- public ArrayPacket(D startValue, Type<D> t)
- {
- arrayData = new ArrayList<D>(0);
- arrayData.add(startValue);
- type = t;
- }
-
- /**
- * Create an empty array packet of the desired type.
- * @param t The type of the packet
- */
- public ArrayPacket(Type<D> t)
- {
- arrayData = new ArrayList<D>(0);
- type = t;
- }
-
- /** Pop and shift data from the array.
- */
- @Override
- public D getData()
- {
- D temp = null;
-
- if(arrayData.size() > 0)
- {
- temp = arrayData.remove(0);
- }
-
- return temp;
- }
-
- /** Add data to the array.
- * @param data The data to push
- */
- public void setData(D data)
- {
- arrayData.add(data);
- }
-
- /**
- * @return The ammount of data the packet holds
- */
- public int dataStored()
- {
- return arrayData.size();
- }
-
- @Override
- public Type<D> getType() {
- return type;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/dynamic/DynamicPacket.java b/src/main/java/net/transit/network/packet/dynamic/DynamicPacket.java
deleted file mode 100644
index 0860487..0000000
--- a/src/main/java/net/transit/network/packet/dynamic/DynamicPacket.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.transit.network.packet.dynamic;
-
-import net.transit.type.Type;
-
-/**
- * Simple packet which stores a fluid value.
- *
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- */
-public class DynamicPacket<D> implements IDynamicPacket<D> {
- private D data;
- private Type<D> type;
-
- /** Constructor. Stores the given data and uses the given type.
- *
- * @param dat The packet's data
- * @param t The packet's type
- */
- public DynamicPacket(D dat, Type<D> t)
- {
- data = dat;
- type = t;
- }
-
- @Override
- public D getData()
- {
- return data;
- }
-
- @Override
- public void setData(D dat)
- {
- data = dat;
- }
-
- @Override
- public Type<D> getType() {
- return type;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/dynamic/IDynamicPacket.java b/src/main/java/net/transit/network/packet/dynamic/IDynamicPacket.java
deleted file mode 100644
index 51b3c13..0000000
--- a/src/main/java/net/transit/network/packet/dynamic/IDynamicPacket.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.transit.network.packet.dynamic;
-
-import net.transit.network.packet.IStaticPacket;
-
-/** Interface describing a fluid packet.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- */
-public interface IDynamicPacket<D> extends IStaticPacket<D>{
- /**Set the packet's data.
- *
- * @return <D> The packet's data
- */
- public void setData(D dat);
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/dynamic/MetaDynamicPacket.java b/src/main/java/net/transit/network/packet/dynamic/MetaDynamicPacket.java
deleted file mode 100644
index b6a3ec6..0000000
--- a/src/main/java/net/transit/network/packet/dynamic/MetaDynamicPacket.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package net.transit.network.packet.dynamic;
-
-import net.transit.type.Type;
-
-/** Static packet with extra data attached.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- * @param <M> The type of metadata
-*/
-public class MetaDynamicPacket<D, M> extends DynamicPacket<D>
-{
- private M metaData;
-
- /** Constructor
- *
- * @param dat The data to store
- * @param t The Type of the data
- * @param meta The metadata to store
- */
- public MetaDynamicPacket(D dat, Type<D> t, M meta)
- {
- super(dat, t);
- metaData = meta;
- }
-
- /** Get the metadata of the packet.
- *
- * @return The packet's metadata
- */
- public M getMetaData()
- {
- return metaData;
- }
-
- /** Set the metadata of the packet.
- *
- * @param meta The packet's new metadata
- */
- public void setMetaData(M meta)
- {
- metaData = meta;
- }
-}
diff --git a/src/main/java/net/transit/network/system/INode.java b/src/main/java/net/transit/network/system/INode.java
deleted file mode 100644
index 9c42bf1..0000000
--- a/src/main/java/net/transit/network/system/INode.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package net.transit.network.system;
-
-/**
- * @author Kyle Gunger
- * @apiNote A node inside or outside a system. Provides acceptors and providers to other nodes.
- */
-public interface INode
-{
-
- /**Returns the groupIDs of groups the node interacts with
- *
- * @return String[]
- */
- public String[] groupsProvided();
-
-
- /**Get the system managing the node or {@code null} if there isn't one
- *
- * @return System
- */
- public System getSystem();
-
-
- /** Get the data of one of the TypeGroups the Node supports
- *
- * @param groupID
- * @return
- */
- public Object getData(String groupID);
-
-
- /** Set the group data for the node
- *
- * @param dat
- * @param groupID
- */
- public void setData(Object dat, String groupID);
-
-
- /** Get the nodes that this node is connected to
- *
- * @return Node[]
- */
- public INode[] getConnections();
-}
diff --git a/src/main/java/net/transit/network/system/ISystem.java b/src/main/java/net/transit/network/system/ISystem.java
deleted file mode 100644
index fd2fa51..0000000
--- a/src/main/java/net/transit/network/system/ISystem.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package net.transit.network.system;
-
-
-/**ISystem - a group of nodes optimized for performance
- *
- * A node can exist without a system, but a system can not exist without at least one root node.
- *
- * @param T The object type stored in the system.
- */
-public interface ISystem
-{
- /**The nodes stored by the system
- *
- * @return INode[]
- */
- public INode[] getNodes();
-}
diff --git a/src/main/java/net/transit/network/system/Node.java b/src/main/java/net/transit/network/system/Node.java
deleted file mode 100644
index 6a661f3..0000000
--- a/src/main/java/net/transit/network/system/Node.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package net.transit.network.system;
-
-/**
- * @author Kyle Gunger
- * @apiNote A node inside or outside a system. Provides acceptors and providers to other nodes.
- */
-public interface Node
-{
-
- /**Returns the groupIDs of groups the node interacts with
- *
- * @return String[]
- */
- public String[] groupsProvided();
-
-
- /**Get the system managing the node or {@code null} if there isn't one
- *
- * @return System
- */
- public System getSystem();
-
-
- /** Get the data of one of the TypeGroups the Node supports
- *
- * @param groupID
- * @return
- */
- public Object getData(String groupID);
-
-
- /** Set the group data for the node
- *
- * @param dat
- * @param groupID
- */
- public void setData(Object dat, String groupID);
-
-
- /** Get the nodes that this node is connected to
- *
- * @return Node[]
- */
- public Node[] getConnections();
-}
diff --git a/src/main/java/net/transit/network/system/System.java b/src/main/java/net/transit/network/system/System.java
deleted file mode 100644
index c70292a..0000000
--- a/src/main/java/net/transit/network/system/System.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package net.transit.network.system;
-
-
-/**ISystem - a group of nodes optimized for performance
- *
- * A node can exist without a system, but a system can not exist without at least one root node.
- *
- * @param T The object type stored in the system.
- */
-public interface System
-{
- /**The nodes stored by the system
- *
- * @return INode[]
- */
- public Node[] getNodes();
-}
diff --git a/src/main/java/net/transit/network/system/swap/AcceptorNode.java b/src/main/java/net/transit/network/system/swap/AcceptorNode.java
deleted file mode 100644
index 14c672d..0000000
--- a/src/main/java/net/transit/network/system/swap/AcceptorNode.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.transit.network.system.swap;
-
-import net.transit.network.packet.IStaticPacket;
-import net.transit.network.system.INode;
-
-public interface AcceptorNode extends INode
-{
-
- /** Link another node as a provider
- *
- * @param requester The object to be a provider
- * @param group
- * @return
- */
- public boolean linkProvider(INode requester, String group);
-
-
- /** Unlink a provider from the acceptor
- *
- * @param toUnlink
- * @return
- */
- public boolean unlinkProvider(INode toUnlink);
-
-
- /**
- * @return Node[]
- */
- public INode[] getProviders();
-
-
- /** Accept a packet from a provider
- *
- * @param packet
- * @param group
- * @return
- */
- public boolean accept(IStaticPacket<?> packet, String group);
-}
diff --git a/src/main/java/net/transit/network/system/swap/ProviderNode.java b/src/main/java/net/transit/network/system/swap/ProviderNode.java
deleted file mode 100644
index 831c87f..0000000
--- a/src/main/java/net/transit/network/system/swap/ProviderNode.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package net.transit.network.system.swap;
-
-import net.transit.network.system.INode;
-
-public interface ProviderNode extends INode{
-
- /** Link another node as an acceptor
- *
- * @param requester The object requesting the Acceptor
- * @param group
- * @return boolean
- */
- public boolean linkAcceptor(INode requester, String group);
-
-
- /** Unlink a provider from the acceptor
- *
- * @param toUnlink
- * @return
- */
- public boolean unlinkAcceptor(INode toUnlink);
-
-
- /**
- * @return Node[]
- */
- public INode[] getAcceptors();
-
-}
diff --git a/src/main/java/net/transit/type/TFluid.java b/src/main/java/net/transit/type/TFluid.java
deleted file mode 100644
index fbceb0e..0000000
--- a/src/main/java/net/transit/type/TFluid.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.transit.type;
-
-import net.minecraft.fluid.Fluid;
-
-/** Units of fluid.
- * @author Kyle Gunger
- */
-public class TFluid {
- private Fluid fluid;
- private Number millibuckets;
-
- /** Constructor
- *
- * @param f Fluid stored (Water/Lava/etc.)
- * @param ct Count of fluid (mB)
- */
- public TFluid(Fluid f, Number mb) {
- fluid = f;
- millibuckets = mb;
- }
-
- /** Get the fluid stored.
- */
- public Fluid getFluid() {
- return fluid;
- }
-
- /** Get the millibuckets stored.
- */
- public Number getMilliBuckets() {
- return millibuckets;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/type/TMana.java b/src/main/java/net/transit/type/TMana.java
deleted file mode 100644
index 3a60d52..0000000
--- a/src/main/java/net/transit/type/TMana.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.transit.type;
-
-/** Units of mana.
- * @author Kyle Gunger
- */
-public class TMana {
- private String type;
- private Number count;
-
- /** Constructor
- *
- * @param t Type of mana (Fire/Water/Dark/Light/etc.)
- * @param ct Count of mana
- */
- public TMana(String t, Number ct) {
- type = t;
- count = ct;
- }
-
- /** Get the mana type.
- */
- public String getType() {
- return type;
- }
-
- /** Get the mana stored.
- */
- public Number getCount() {
- return count;
- }
-}
diff --git a/src/main/java/net/transit/type/Type.java b/src/main/java/net/transit/type/Type.java
deleted file mode 100644
index 2dcf81b..0000000
--- a/src/main/java/net/transit/type/Type.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package net.transit.type;
-
-import net.transit.network.packet.IStaticPacket;
-import net.transit.network.packet.StaticPacket;
-
-/**@author Kyle Gunger
- *
- * @param <T> The type of object transfered by packets of this type
- */
-public class Type<T>
-{
- protected String typeID;
- protected String groupID;
-
- public Type(String tID, String gID)
- {
- typeID = tID;
- groupID = gID;
- }
-
- /** Return the packet's data formatted in the group's base type.
- *
- * @param packet The packet (of this type)
- * @param group The group asking for the conversion
- * @return <T> The packet's data in the default type
- */
- public T toBase(IStaticPacket<T> packet, String group)
- {
- return packet.getData();
- }
-
- /** Create a packet which has the current type from the data in the base type.
- *
- * @param base The base data
- * @param group The group that the data comes from
- * @return IPacket<<T>> The packet
- */
- public IStaticPacket<T> fromBase(T base, String group)
- {
- return new StaticPacket<T>(base, this);
- }
-
- /** The type identifier. Must be overridden for any class implementing IType.
- *
- * @return String
- */
- public final String getType()
- {
- return typeID;
- }
-
- /** The group identifier. Gives the normal group identity of the type.
- *
- * @return String
- */
- public final String getGroup()
- {
- return groupID;
- }
-}
diff --git a/src/main/java/net/transit/type/group/GroupRegistry.java b/src/main/java/net/transit/type/group/GroupRegistry.java
deleted file mode 100644
index 12ffffc..0000000
--- a/src/main/java/net/transit/type/group/GroupRegistry.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package net.transit.type.group;
-
-import java.util.ArrayList;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import net.transit.type.Type;
-
-public class GroupRegistry {
- private static final ArrayList<TypeGroup<?>> GROUPS = new ArrayList<TypeGroup<?>>(0);
-
- private static final Logger LOG = LogManager.getFormatterLogger("Transit|GroupRegistry");
-
- private GroupRegistry() {}
-
- public static final boolean addGroup(TypeGroup<?> group)
- {
- for(TypeGroup<?> g : GROUPS)
- {
- if(g.getGroup().equals(group.getGroup()))
- {
- LOG.warn("Failed to add group " + group.getGroup() + " to the registry. Did another mod add a group with the same name?");
- return false;
- }
- }
-
- GROUPS.add(group);
- LOG.info("Successfully added group " + group.getGroup() + " to the registry.");
- return true;
- }
-
- public static final TypeGroup<?> groupByID(String groupID)
- {
- for(TypeGroup<?> g : GROUPS)
- {
- if(g.getGroup().equals(groupID)) return g;
- }
-
- return null;
-
- }
-
- public static final Type<?> typeByIdentity(String groupID, String typeID)
- {
- return groupByID(groupID).getType(typeID);
- }
-
-}
diff --git a/src/main/java/net/transit/type/group/TypeGroup.java b/src/main/java/net/transit/type/group/TypeGroup.java
deleted file mode 100644
index a3ab622..0000000
--- a/src/main/java/net/transit/type/group/TypeGroup.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package net.transit.type.group;
-
-import java.util.ArrayList;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import net.transit.network.packet.*;
-import net.transit.type.Type;
-
-/**
- * @author Kyle Gunger
- * @param <B> The base object which all grouped Types should convert between.
- */
-public class TypeGroup<B>
-{
- // The base Type (provides the group's identifier)
- private Type<B> baseType;
-
- // The list of types.
- private final ArrayList<Type<B>> TYPES = new ArrayList<Type<B>>(0);
-
- // Logger for events in the TypeGroup.
- private static final Logger LOG = LogManager.getFormatterLogger("Transit|Group");
-
-
- public TypeGroup(Type<B> base)
- {
- baseType = base;
- addType(base);
- }
-
-
- // Type management
-
- /** Add a Type to the TypeGroup.
- * The Type must have a group-type combo not already found in this TypeGroup.
- * Returns {@code true} if the group was added.
- *
- * @param type The Type to add
- * @return
- */
- public boolean addType(Type<B> type)
- {
- if(!isInGroup(type.getGroup(), type.getType()))
- {
- TYPES.add(type);
- LOG.info("Added type " + type.getType() + ":" + type.getGroup() + " to group " + getGroup());
- return true;
- }
-
- LOG.info("Failed to add type " + type.getType() + ":" + type.getGroup() + " to group " + getGroup() + ". Was the type already added?");
- return false;
- }
-
- /** Remove a Type from the TypeGroup.
- *
- * @param type The Type to remove
- * @return
- */
- public boolean removeType(Type<B> type)
- {
- if(type.equals(baseType)) {
- LOG.warn("[WARN] Failed to remove type " + type.getGroup() + ":" + type.getType() + " from group " + getGroup() + ". This is the base type and can not be removed.");
- return false;
- }
-
- if(TYPES.indexOf(type) != -1)
- {
- LOG.info("Removed type " + TYPES.remove(TYPES.indexOf(type)).getType() + " from group " + getGroup());
- return true;
- }
-
- LOG.warn("[WARN] Failed to remove type " + type.getGroup() + ":" + type.getType() + " from group " + getGroup() + ". Are we sure that the type was added to the group first?");
- return false;
- }
-
- /** Remove a type from the group based on it's group-type identifier.
- *
- * @param type
- * @return
- */
- public boolean removeType(String groupID, String typeID)
- {
-
- for(Type<?> type : TYPES)
- {
- if(type.getGroup().equals(groupID) && type.getType().equals(typeID))
- {
- LOG.info("Removed type " + TYPES.remove(TYPES.indexOf(type)).getType() + " from group " + getGroup());
- return true;
- }
- }
-
- LOG.warn("[WARN] Failed to remove type " + groupID + ":" + typeID + " from group " + getGroup() + ". Are we sure that the type was added to the group first?");
- return false;
- }
-
- /** Remove a type from the group based on it's group-type identifier.
- *
- * @param type
- * @return
- */
- public boolean removeType(String typeID)
- {
-
- return removeType(getGroup(), typeID);
- }
-
-
- // Check if a type is in the group
-
- /**Check if the type is in the group
- *
- * @param type
- * @return boolean
- */
- public boolean isInGroup(Type<B> type)
- {
- for(Type<B> t : TYPES)
- {
- if(t.equals(type)) return true;
- }
- return false;
- }
-
- /**Check if the type is in the group
- *
- * @param groupID
- * @param typeID
- * @return boolean
- */
- public boolean isInGroup(String groupID, String typeID)
- {
- for(Type<B> t : TYPES)
- {
- if(t.getGroup().equals(groupID) && t.getType().equals(typeID)) return true;
- }
- return false;
- }
-
- /**Check if the type is in the group
- *
- * @param typeID
- * @return boolean
- */
- public boolean isInGroup(String typeID)
- {
- return isInGroup(getGroup(), typeID);
- }
-
- // Get a type in the group
-
- /**Get the type from the group
- *
- * @param type
- * @return Type
- */
- public Type<B> getType(String groupID, String typeID)
- {
- for(Type<B> t : TYPES)
- {
- if(t.getGroup().equals(groupID) && t.getType().equals(typeID)) return t;
- }
-
- return null;
- }
-
- public Type<B> getType(String typeID)
- {
- return getType(getGroup(), typeID);
- }
-
-
- // Type conversion
-
- /** Actually convert the packet
- *
- * @param packet
- * @param type
- * @return
- */
- protected IStaticPacket<B> convertPacketRaw(IStaticPacket<B> packet, Type<B> type)
- {
- return type.fromBase(packet.getType().toBase(packet, getGroup()), getGroup());
- }
-
- /**Convert a packet to a new type
- *
- * @param packet The packet to convert
- * @param type The type to convert to
- * @return Packet
- */
- public IStaticPacket<B> convertPacket(IStaticPacket<B> packet, Type<B> type)
- {
- if(isInGroup(packet.getType()) && isInGroup(type))
- {
- return convertPacketRaw(packet, type);
- }
-
- return null;
- }
-
- /**Convert a packet to a new type
- *
- * @param packet The packet to convert
- * @param groupID The groupID of the Type to convert to
- * @param typeID The typeID of the Type to convert to
- * @return Packet
- */
- public IStaticPacket<B> convertPacket(IStaticPacket<B> packet, String groupID, String typeID)
- {
- Type<B> toType = getType(groupID, typeID);
- if(toType != null)
- {
- return convertPacketRaw(packet, toType);
- }
-
- return null;
- }
-
- /** The group identifier. Given by the Base Group
- * @return String
- */
- public final String getGroup()
- {
- return baseType.getGroup();
- }
-}
diff --git a/src/main/java/net/transit/type/group/simple/SimpleGroups.java b/src/main/java/net/transit/type/group/simple/SimpleGroups.java
deleted file mode 100644
index f3e2ad2..0000000
--- a/src/main/java/net/transit/type/group/simple/SimpleGroups.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.transit.type.group.simple;
-
-import net.minecraft.item.ItemStack;
-import net.transit.type.group.GroupRegistry;
-import net.transit.type.group.TypeGroup;
-import net.transit.type.simple.SimpleTypes;
-import net.transit.type.*;
-
-public final class SimpleGroups {
- /** Transfers energy. Basic unit is TJoule (Transit Joule).
- */
- public static final TypeGroup<Number> ENERGY_GROUP = new TypeGroup<Number>(SimpleTypes.TransitJoule);
-
- /** Transfers mana. Basic unit is TMana (Transit Mana).
- */
- public static final TypeGroup<TMana> MANA_GROUP = new TypeGroup<TMana>(SimpleTypes.TransitMana);
-
- /** Transfers items. Basic type is ItemStack.
- */
- public static final TypeGroup<ItemStack> ITEM_GROUP = new TypeGroup<ItemStack>(SimpleTypes.Item);
-
- /** Transfers fluids. Basic unit is TFluid.
- */
- public static final TypeGroup<TFluid> FLUID_GROUP = new TypeGroup<TFluid>(SimpleTypes.Fluid);
-
- public static final void init()
- {
- GroupRegistry.addGroup(ENERGY_GROUP);
- GroupRegistry.addGroup(MANA_GROUP);
- GroupRegistry.addGroup(ITEM_GROUP);
- GroupRegistry.addGroup(FLUID_GROUP);
- }
-}
diff --git a/src/main/java/net/transit/type/simple/SimpleTypes.java b/src/main/java/net/transit/type/simple/SimpleTypes.java
deleted file mode 100644
index cae234f..0000000
--- a/src/main/java/net/transit/type/simple/SimpleTypes.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.transit.type.simple;
-
-import net.minecraft.item.ItemStack;
-import net.transit.type.*;
-
-public final class SimpleTypes {
- /** Transfers energy. Energy is stored as a numeric, base value is TJoule (TransitJoule)
- */
- public static final Type<Number> TransitJoule = new Type<Number>("TJoule", "ENERGY");
-
- /** Transfers mana. TMana stores mana count and type.
- */
- public static final Type<TMana> TransitMana = new Type<TMana>("TMana", "MANA");
-
- /** Transfers items in a itemstack.
- */
- public static final Type<ItemStack> Item = new Type<ItemStack>("Item", "ITEM");
-
- /** Transfers fluid. TFluid stores fluid and mB.
- */
- public static final Type<TFluid> Fluid = new Type<TFluid>("Fluid", "FLUID");
-}