-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaning up network a lot; fixed cc comps not being able to send wire…
…less messages via access points; started wireless api
- Loading branch information
Showing
18 changed files
with
353 additions
and
173 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,60 @@ | ||
package li.cil.oc.api.network; | ||
|
||
import net.minecraft.nbt.NBTTagCompound; | ||
|
||
/** | ||
* These packets represent messages sent using a network card or wireless | ||
* network card, and can be relayed by the switch and access point blocks. | ||
* <p/> | ||
* These will be sent as the payload of <tt>network.message</tt> messages. | ||
* <p/> | ||
* <em>Important</em>: do <em>not</em> implement this interface. Use the factory | ||
* methods in {@link li.cil.oc.api.Network} instead. | ||
*/ | ||
public interface Packet { | ||
/** | ||
* The address of the <em>original</em> sender of this packet. | ||
*/ | ||
String source(); | ||
|
||
/** | ||
* The address of the destination of the packet. This is <tt>null</tt> for | ||
* broadcast packets. | ||
*/ | ||
String destination(); | ||
|
||
/** | ||
* The port this packet is being sent to. | ||
*/ | ||
int port(); | ||
|
||
/** | ||
* The payload of the packet. This will usually only contain simple types, | ||
* to allow persisting the packet. | ||
*/ | ||
Object[] data(); | ||
|
||
/** | ||
* The remaining 'time to live' for this packet. When a packet with a TTL of | ||
* zero is received it will not be relayed by switches and access points. It | ||
* will however still be received by a network card. | ||
*/ | ||
int ttl(); | ||
|
||
/** | ||
* Generates a copy of the packet, with a reduced time to live. | ||
* <p/> | ||
* This is called by switches and access points to generate relayed packets. | ||
* | ||
* @return a copy of this packet with a reduced TTL. | ||
*/ | ||
Packet hop(); | ||
|
||
/** | ||
* Saves the packet's data to the specified compound tag. | ||
* <p/> | ||
* Restore a packet saved like this using the factory method in the | ||
* {@link li.cil.oc.api.Network} class. | ||
*/ | ||
void save(NBTTagCompound nbt); | ||
} |
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,38 @@ | ||
package li.cil.oc.api.network; | ||
|
||
import net.minecraft.world.World; | ||
|
||
/** | ||
* Interface for wireless endpoints that can be registered with the internal | ||
* wireless network registry. | ||
* <p/> | ||
*/ | ||
public interface WirelessEndpoint { | ||
/** | ||
* The X coordinate of the endpoint in the world, in block coordinates. | ||
*/ | ||
int x(); | ||
|
||
/** | ||
* The Y coordinate of the endpoint in the world, in block coordinates. | ||
*/ | ||
int y(); | ||
|
||
/** | ||
* The Z coordinate of the endpoint in the world, in block coordinates. | ||
*/ | ||
int z(); | ||
|
||
/** | ||
* The world this endpoint lives in. | ||
*/ | ||
World world(); | ||
|
||
/** | ||
* Makes the endpoint receive a single packet. | ||
* | ||
* @param packet the packet to receive. | ||
* @param distance the distance to the wireless endpoint that sent the packet. | ||
*/ | ||
void receivePacket(Packet packet, double distance); | ||
} |
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
3 changes: 2 additions & 1 deletion
3
src/main/scala/li/cil/oc/client/renderer/WirelessNetworkDebugRenderer.scala
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
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
Oops, something went wrong.