-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for project red bundled redwire, closes #2
- Loading branch information
Showing
10 changed files
with
191 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package mrtjp.projectred.api; | ||
|
||
/** | ||
* Implemented by entities that can emit bundled cable signals. If you are a | ||
* tile entity, see {@link IBundledTile} | ||
*/ | ||
public interface IBundledEmitter | ||
{ | ||
/** | ||
* Returns the current emitted bundled cable strength for each colour. The | ||
* bytes are treated as having unsigned values from 0 to 255 - when | ||
* extracting a value from the array, you need to convert it (value & 255). | ||
* | ||
* May return null, which is equivalent to returning an array with all | ||
* values 0. | ||
* | ||
* Array indices are the same as the corresponding wool damage values. | ||
* | ||
* For face parts, side is a rotation. For center parts or tile entities, it | ||
* is a forge direction. | ||
* | ||
* The return value will be used immediately, so the returned array may be | ||
* overwritten by the next call to getBundledSignal. | ||
*/ | ||
public byte[] getBundledSignal(int side); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package mrtjp.projectred.api; | ||
|
||
/** | ||
* Interface for tile entities that emit/receive bundled signal. | ||
*/ | ||
public interface IBundledTile extends IBundledEmitter | ||
{ | ||
/** | ||
* @param side The side of this tile for which connection is being tested (forge direction ordering) | ||
* @return True if a bundled cable of some form can connect to this side. | ||
*/ | ||
public boolean canConnectBundled(int side); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package mrtjp.projectred.api; | ||
|
||
/** | ||
* Interface implemented by face parts to connect to various types of wires. | ||
*/ | ||
public interface IConnectable | ||
{ | ||
/** | ||
* Called to check whether a wire/logic part can connect to this. If a part | ||
* returns true it is expected to immediately reflect the fact that it is | ||
* now connected to wire. | ||
* | ||
* @param part The part asking for connection. | ||
* @param r The clockwise rotation about the attached face to | ||
* @return True to allow the wire connection. | ||
*/ | ||
public boolean connectStraight(IConnectable part, int r); | ||
|
||
/** | ||
* Connect for internals. If r is -1 for a face part. Return true for a | ||
* connection to the center part of the block. | ||
*/ | ||
public boolean connectInternal(IConnectable part, int r); | ||
|
||
/** | ||
* Connect for corners | ||
*/ | ||
public boolean connectCorner(IConnectable part, int r); | ||
|
||
/** | ||
* @return True if this part can reach around a corner to another part. | ||
*/ | ||
public boolean canConnectCorner(int r); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package mrtjp.projectred.api; | ||
|
||
/** | ||
* Marker interface for a screwdriver. Things like gates check if the item used | ||
* to right-click is an instance of this. | ||
*/ | ||
public interface IScrewdriver | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package mrtjp.projectred.api; | ||
|
||
import java.util.List; | ||
|
||
import net.minecraft.tileentity.TileEntity; | ||
|
||
/** | ||
* Allows adding of special tile entities that point to other BasicPipeParts. | ||
* Used for allowing things such as TE Tesseracts to be used as via points for | ||
* Link-State path finding, which is used to establish a connection from one | ||
* routed pipe to another. This is registered through the ProjectRedAPI. | ||
*/ | ||
public interface ISpecialLinkState | ||
{ | ||
/** | ||
* This method should utilize the given tile to find all other tiles that | ||
* connects back and forth. For example, if we have TesseractA (param tile) | ||
* connected to TesseractB, which connects to a few pipes, this method | ||
* should return the tile of all pipes connected to TesseractB. | ||
* | ||
* The given tile is what the pipes found, the returned list is what the | ||
* pipe should consider as found. | ||
* | ||
* @param te The tile in question. | ||
* @return A list of all connected pipes (as tiles, should be | ||
* TileMultipart). This MUST be null if there are no connections of | ||
* this special type. | ||
*/ | ||
public List<TileEntity> getLinks(TileEntity te); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package mrtjp.projectred.api; | ||
|
||
import net.minecraft.world.World; | ||
|
||
public interface ITransmissionAPI | ||
{ | ||
/** | ||
* Queries the block on side of this block for the bundled signal being | ||
* emitted to this block. | ||
* | ||
* @param world The world containing the block | ||
* @param x The x coordinate of the block/tile querying signal | ||
* @param y The y coordinate of the block/tile querying signal | ||
* @param z The z coordinate of the block/tile querying signal | ||
* @param side The side of the block | ||
* @return A bundled signal {@link IBundledEmitter} | ||
*/ | ||
public byte[] getBundledInput(World world, int x, int y, int z, int side); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package mrtjp.projectred.api; | ||
|
||
public interface ITransportationAPI | ||
{ | ||
/** | ||
* Used to register a special link-state for routed pipes such as TE | ||
* Tesseracts. | ||
* | ||
* @param link | ||
*/ | ||
public void registerSpecialLinkState(ISpecialLinkState link); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package mrtjp.projectred.api; | ||
|
||
import net.minecraft.world.World; | ||
|
||
/** | ||
* Central API class for ProjectRed If ProjectRed is installed, the appropriate | ||
* field will contain an implementor of these methods. <br> | ||
* <br> | ||
* It is recommended that mods access this class within a soft dependency class. | ||
*/ | ||
public final class ProjectRedAPI | ||
{ | ||
public static ProjectRedAPI instance; | ||
|
||
/** | ||
* API used for interacting with wires | ||
*/ | ||
public static ITransmissionAPI transmissionAPI; | ||
|
||
/** | ||
* API used for interacting with pipes | ||
*/ | ||
public static ITransportationAPI transportationAPI; | ||
} |