Moved capability package up.
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
package li.cil.oc2.api.bus.device.capabilities;
|
||||
|
||||
import li.cil.oc2.api.bus.device.ItemDevice;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* This interface provides interaction with the network bus.
|
||||
* <p>
|
||||
* Network connectors will check for this capability on blocks they are placed on.
|
||||
* If found, they will actively poll frames via {@link #readEthernetFrame()} and push
|
||||
* forwarded frames via {@link #writeEthernetFrame(NetworkInterface, byte[], int)}.
|
||||
* <p>
|
||||
* As with all capabilities, this capability can be provided by {@link ItemDevice}s.
|
||||
*/
|
||||
public interface NetworkInterface {
|
||||
/**
|
||||
* Tries to read an ethernet frame from this network interface.
|
||||
* <p>
|
||||
* The frame <em>should</em> be a Layer 2 Ethernet frame.
|
||||
* <p>
|
||||
* When no data is available, {@code null} should be returned.
|
||||
*
|
||||
* @return a pending frame or {@code null}.
|
||||
*/
|
||||
@Nullable
|
||||
byte[] readEthernetFrame();
|
||||
|
||||
/**
|
||||
* Tries to write an ethernet frame to this network interface.
|
||||
* <p>
|
||||
* The frame <em>should</em> be a Layer 2 Ethernet frame, but this is
|
||||
* not guaranteed. Implementations should not rely on this, and if relying
|
||||
* on this at least add appropriate validation and discard the frame otherwise.
|
||||
* <p>
|
||||
* If the device is not ready to receive data, it may ignore the call.
|
||||
* <p>
|
||||
* The {@code timeToLive} parameter is not to be confused with the IP protocol's
|
||||
* TTL field. This parameter is used when pushing frames through the network bus
|
||||
* to prevent infinite loops in case of cycles. Pure consumers can ignore this
|
||||
* argument. Any implementation forwarding directly (by pushing it to some other
|
||||
* {@link NetworkInterface} implementation) should call {@code writeEthernetFrame}
|
||||
* with the time to live reduced by some value, usually by one.
|
||||
*
|
||||
* @param source the device that last forwarded the frame.
|
||||
* @param frame the frame offered to the network interface.
|
||||
* @param timeToLive the number of hops remaining before the frame should be discarded.
|
||||
*/
|
||||
void writeEthernetFrame(NetworkInterface source, byte[] frame, final int timeToLive);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package li.cil.oc2.api.bus.device.capabilities;
|
||||
|
||||
/**
|
||||
* This interface may be provided as a capability by item components to signal
|
||||
* to the containing {@link net.minecraft.tileentity.TileEntity} that they wish
|
||||
* to emit a redstone signal. This is used by the built-in redstone interface
|
||||
* card, for example.
|
||||
*/
|
||||
public interface RedstoneEmitter {
|
||||
/**
|
||||
* Returns the redstone output level for the side this interface was returned for.
|
||||
*
|
||||
* @return the redstone output level.
|
||||
*/
|
||||
int getRedstoneOutput();
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package li.cil.oc2.api.bus.device.capabilities;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -1,6 +1,6 @@
|
||||
package li.cil.oc2.common.block;
|
||||
|
||||
import li.cil.oc2.api.bus.device.capabilities.RedstoneEmitter;
|
||||
import li.cil.oc2.api.capabilities.RedstoneEmitter;
|
||||
import li.cil.oc2.client.gui.TerminalScreen;
|
||||
import li.cil.oc2.common.capabilities.Capabilities;
|
||||
import li.cil.oc2.common.container.ComputerContainer;
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import li.cil.oc2.common.vm.fs.LayeredFileSystem;
|
||||
import li.cil.oc2.common.vm.fs.ResourceFileSystem;
|
||||
import li.cil.sedna.fs.*;
|
||||
import li.cil.sedna.fs.FileSystem;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -13,7 +13,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
|
||||
public final class FileSystems {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package li.cil.oc2.common.bus.device.item;
|
||||
|
||||
import li.cil.oc2.api.bus.device.ItemDevice;
|
||||
import li.cil.oc2.api.bus.device.capabilities.NetworkInterface;
|
||||
import li.cil.oc2.api.bus.device.vm.*;
|
||||
import li.cil.oc2.api.capabilities.NetworkInterface;
|
||||
import li.cil.oc2.common.bus.device.util.IdentityProxy;
|
||||
import li.cil.oc2.common.bus.device.util.OptionalAddress;
|
||||
import li.cil.oc2.common.bus.device.util.OptionalInterrupt;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package li.cil.oc2.common.bus.device.item;
|
||||
|
||||
import li.cil.oc2.api.bus.device.ItemDevice;
|
||||
import li.cil.oc2.api.bus.device.capabilities.RedstoneEmitter;
|
||||
import li.cil.oc2.api.bus.device.object.Callback;
|
||||
import li.cil.oc2.api.bus.device.object.DocumentedDevice;
|
||||
import li.cil.oc2.api.bus.device.object.ObjectDevice;
|
||||
import li.cil.oc2.api.bus.device.object.Parameter;
|
||||
import li.cil.oc2.api.bus.device.rpc.RPCDevice;
|
||||
import li.cil.oc2.api.bus.device.rpc.RPCMethod;
|
||||
import li.cil.oc2.api.capabilities.RedstoneEmitter;
|
||||
import li.cil.oc2.common.bus.device.util.IdentityProxy;
|
||||
import li.cil.oc2.common.capabilities.Capabilities;
|
||||
import li.cil.oc2.common.util.HorizontalBlockUtils;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package li.cil.oc2.common.capabilities;
|
||||
|
||||
import li.cil.oc2.api.bus.DeviceBusElement;
|
||||
import li.cil.oc2.api.bus.device.capabilities.NetworkInterface;
|
||||
import li.cil.oc2.api.bus.device.capabilities.RedstoneEmitter;
|
||||
import li.cil.oc2.api.capabilities.NetworkInterface;
|
||||
import li.cil.oc2.api.capabilities.RedstoneEmitter;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package li.cil.oc2.common.tileentity;
|
||||
|
||||
import li.cil.oc2.api.bus.device.capabilities.NetworkInterface;
|
||||
import li.cil.oc2.api.capabilities.NetworkInterface;
|
||||
import li.cil.oc2.client.renderer.NetworkCableRenderer;
|
||||
import li.cil.oc2.common.Constants;
|
||||
import li.cil.oc2.common.block.NetworkConnectorBlock;
|
||||
|
||||
Reference in New Issue
Block a user