mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-28 07:25:35 -04:00
Refactor copied dependencies
This commit is contained in:
parent
b0b9f6dd89
commit
d3f628f60d
BIN
dependencies/redlogic-59.1.13.jar
vendored
Normal file
BIN
dependencies/redlogic-59.1.13.jar
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,15 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api;
|
|
||||||
|
|
||||||
import lordfokas.stargatetech2.api.bus.IBusDevice;
|
|
||||||
import lordfokas.stargatetech2.api.bus.IBusDriver;
|
|
||||||
import lordfokas.stargatetech2.api.bus.IBusInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A factory for private classes that implement
|
|
||||||
* interfaces from the public API.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public interface IFactory {
|
|
||||||
public IBusInterface getIBusInterface(IBusDevice device, IBusDriver driver);
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The way to get ItemStacks added to the game by StargateTech 2
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public interface IStackManager {
|
|
||||||
/**
|
|
||||||
* Used to fetch an ItemStack by it's name, with a default size of 1.
|
|
||||||
*
|
|
||||||
* @param stack The stack we want to fetch.
|
|
||||||
* @return The stack, or null if none was found.
|
|
||||||
*/
|
|
||||||
public ItemStack get(String stack);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to fetch an ItemStack by it's name with a given size.
|
|
||||||
*
|
|
||||||
* @param stack The stack we want to fetch.
|
|
||||||
* @param size The size the stack comes with. Must be in the range 1 - 64.
|
|
||||||
* @return The stack, or null if none was found.
|
|
||||||
*/
|
|
||||||
public ItemStack get(String stack, int size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return A list with the names of all the existing stacks.
|
|
||||||
*/
|
|
||||||
public Collection<String> getAllStacks();
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api;
|
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import lordfokas.stargatetech2.api.stargate.IStargateNetwork;
|
|
||||||
import lordfokas.stargatetech2.api.stargate.IStargatePlacer;
|
|
||||||
|
|
||||||
public interface IStargateTechAPI {
|
|
||||||
/**
|
|
||||||
* @return The Fluid instance corresponding to Ionized Particles.
|
|
||||||
*/
|
|
||||||
public Fluid getIonizedParticlesFluidInstance();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The creative inventory tab used by StargateTech 2.
|
|
||||||
*/
|
|
||||||
public CreativeTabs getStargateTab();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The IStargateNetwork singleton instance.
|
|
||||||
*/
|
|
||||||
public IStargateNetwork getStargateNetwork();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The IStargatePlacer singleton instance, a.k.a Seeding Ship for the fans.
|
|
||||||
*/
|
|
||||||
public IStargatePlacer getSeedingShip();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The current IFactory instance.
|
|
||||||
*/
|
|
||||||
public IFactory getFactory();
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implemented by blocks that run special actions when clicked with a TabletPC in hand.
|
|
||||||
* The default action in StargateTech2 is opening a special GUI.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public interface ITabletAccess {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make the block run a special action when activated with a TabletPC.
|
|
||||||
* This method is only called on the client side.
|
|
||||||
* Implementations requiring server side should use packets.
|
|
||||||
*
|
|
||||||
* @param player The player activating the block.
|
|
||||||
* @param world The world the block is in.
|
|
||||||
* @param x The block's X coordinate.
|
|
||||||
* @param y The block's Y coordinate.
|
|
||||||
* @param z The block's Z coordinate.
|
|
||||||
* @return True if a special action was executed, false otherwise.
|
|
||||||
*/
|
|
||||||
public boolean onTabletAccess(EntityPlayer player, World world, int x, int y, int z);
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api;
|
|
||||||
|
|
||||||
public abstract class StargateTechAPI implements IStargateTechAPI {
|
|
||||||
protected static IStargateTechAPI apiInstance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* StargateTech's API is abstract, and it's implementation is not visible in the API package.
|
|
||||||
* All available methods in IStargateTechAPI are implemented elsewhere.
|
|
||||||
* This method allows you to retrieve an instance of that implementation.
|
|
||||||
*
|
|
||||||
* @return a concrete implementation of IStargateTechAPI
|
|
||||||
*/
|
|
||||||
public static IStargateTechAPI api(){
|
|
||||||
return apiInstance;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.bus;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BusEvent extends Event{
|
|
||||||
public final World world;
|
|
||||||
public final int x, y, z;
|
|
||||||
|
|
||||||
protected BusEvent(World world, int x, int y, int z){
|
|
||||||
this.world = world;
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fire this event on Forge's BUS_EVENT to add the IBusDevice
|
|
||||||
* in this location to a bus network, if any is available.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public static final class AddToNetwork extends BusEvent{
|
|
||||||
public AddToNetwork(World world, int x, int y, int z) {
|
|
||||||
super(world, x, y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fire this event on Forge's BUS_EVENT to remove the IBusDevice
|
|
||||||
* in this location from any connected bus networks.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public static final class RemoveFromNetwork extends BusEvent{
|
|
||||||
public RemoveFromNetwork(World world, int x, int y, int z) {
|
|
||||||
super(world, x, y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.bus;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
public abstract class BusPacket<R>{
|
|
||||||
private LinkedList<R> responses;
|
|
||||||
private final short sender;
|
|
||||||
private final short target;
|
|
||||||
private final boolean hasLIP;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param sender The address of the Device that is sending this packet.
|
|
||||||
* @param target The address of the Device(s) that should receive this packet.
|
|
||||||
* @param hasLIP Whether or not this packet supports being converted to a plain text (LIP) format.
|
|
||||||
*/
|
|
||||||
protected BusPacket(short sender, short target, boolean hasLIP){
|
|
||||||
this.responses = new LinkedList();
|
|
||||||
this.sender = sender;
|
|
||||||
this.target = target;
|
|
||||||
this.hasLIP = hasLIP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The address of the device that sent this packet.
|
|
||||||
*/
|
|
||||||
public final short getSender(){
|
|
||||||
return sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The address of the device(s) that should receive this packet.
|
|
||||||
*/
|
|
||||||
public final short getTarget(){
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The ID of the protocol this packet corresponds to.
|
|
||||||
*/
|
|
||||||
public final int getProtocolID(){
|
|
||||||
return BusProtocols.getProtocolID(this.getClass());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return A plain text (LIP) version of this packet, if it has one.
|
|
||||||
*/
|
|
||||||
public final BusPacketLIP getPlainText(){
|
|
||||||
if(this instanceof BusPacketLIP){
|
|
||||||
return (BusPacketLIP) this;
|
|
||||||
}else if(hasLIP){
|
|
||||||
BusPacketLIP lip = new BusPacketLIP(sender, target);
|
|
||||||
fillPlainText(lip);
|
|
||||||
lip.finish();
|
|
||||||
return lip;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used by subclasses to convert themselves to plain text format.
|
|
||||||
*
|
|
||||||
* @param lip The Lazy Intercom Protocol (LIP) packet we're filling with our data.
|
|
||||||
*/
|
|
||||||
protected abstract void fillPlainText(BusPacketLIP lip);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Whether or not this packet supports conversion to the LIP format.
|
|
||||||
*/
|
|
||||||
public final boolean hasPlainText(){
|
|
||||||
return hasLIP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a response to this packet that to give the sender some feedback.
|
|
||||||
* The object type depends on the packet subclass.
|
|
||||||
*
|
|
||||||
* Note that clients converting the packet to LIP format
|
|
||||||
* lose the ability to send feedback.
|
|
||||||
*
|
|
||||||
* @param response The response to add.
|
|
||||||
*/
|
|
||||||
public final void addResponse(R response){
|
|
||||||
if(response == null) throw new IllegalArgumentException("A Response cannot be null!");
|
|
||||||
responses.add(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return All the responses other clients added to this packet.
|
|
||||||
*/
|
|
||||||
public final LinkedList<R> getResponses(){
|
|
||||||
return new LinkedList<R>(responses);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,112 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.bus;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Hashtable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LIP - Lazy Intercom Protocol<br>
|
|
||||||
* <br>
|
|
||||||
* Baptized by sciguyryan (often found in #ThermalExpansion and #StargateTech on esper.net's IRC),
|
|
||||||
* this is the universal plain text format used in the Abstract Bus.<br>
|
|
||||||
* <br>
|
|
||||||
* Any packet can choose to be convertible to this format, allowing for any class anywhere to
|
|
||||||
* read data from a packet which has an unknown and / or private class by asking it to convert to
|
|
||||||
* a text format. This removes all the problems with type casting and such.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public final class BusPacketLIP extends BusPacket<String> {
|
|
||||||
private boolean isEditable = true;
|
|
||||||
private LIPMetadata metadata = null;
|
|
||||||
private Hashtable<String, String> data = new Hashtable();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines optional metadata that helps sorting this packet out / figuring out what to do with this.
|
|
||||||
* The fact this is a plain text protocol makes the possibilities so vague it'd be impossible to
|
|
||||||
* guess what kind of data this packet carries.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public static final class LIPMetadata{
|
|
||||||
public final String modID;
|
|
||||||
public final String deviceName;
|
|
||||||
public final String playerName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example: new LIPMetadata("StargateTech2", "shieldEmitter", "LordFokas");
|
|
||||||
*
|
|
||||||
* @param modID The ID of the mod that generated this packet. PLEASE do fill this one.
|
|
||||||
* @param deviceName The name (or a unique identifier) of the type of machine that generated this.
|
|
||||||
* @param playerName The name of the player that made this packet be generated, if any.
|
|
||||||
*/
|
|
||||||
public LIPMetadata(String modID, String deviceName, String playerName){
|
|
||||||
this.modID = modID;
|
|
||||||
this.deviceName = deviceName;
|
|
||||||
this.playerName = playerName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BusPacketLIP(short sender, short target) {
|
|
||||||
super(sender, target, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param metadata The LIPMetadata object to set to this packet.
|
|
||||||
*/
|
|
||||||
public void setMetadata(LIPMetadata metadata){
|
|
||||||
if(isEditable && this.metadata == null){
|
|
||||||
this.metadata = metadata;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The LIPMetadata object on this object. May be null.
|
|
||||||
*/
|
|
||||||
public LIPMetadata getMetadata(){
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // We don't need this. At all.
|
|
||||||
protected void fillPlainText(BusPacketLIP lip){}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finish creating this packet.
|
|
||||||
* As soon as you call this, it can no longer be modified.
|
|
||||||
*/
|
|
||||||
public void finish(){
|
|
||||||
isEditable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return A list of all the keys for the data on this packet.
|
|
||||||
*/
|
|
||||||
public ArrayList<String> getEntryList(){
|
|
||||||
ArrayList<String> entries = new ArrayList();
|
|
||||||
entries.addAll(data.keySet());
|
|
||||||
return entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new entry to this packet.
|
|
||||||
* If the key already exists the entry is ignored.
|
|
||||||
*
|
|
||||||
* @param key The key under which to send the data.
|
|
||||||
* @param val The data to send.
|
|
||||||
*/
|
|
||||||
public void set(String key, String val){
|
|
||||||
if(isEditable && !data.containsKey(key)){
|
|
||||||
data.put(key.toLowerCase(), val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the value stored under that key, if any.
|
|
||||||
* Case Insensitive.
|
|
||||||
*
|
|
||||||
* @param key The key under which the data is stored.
|
|
||||||
* @return The data stored under that key, if any, null otherwise.
|
|
||||||
*/
|
|
||||||
public String get(String key){
|
|
||||||
return data.get(key.toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.bus;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
public final class BusPacketNetScan extends BusPacket<Void> {
|
|
||||||
private LinkedList<Device> devices = new LinkedList();
|
|
||||||
|
|
||||||
public BusPacketNetScan(short target) {
|
|
||||||
super((short)0xFFFF, target, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We're not using this
|
|
||||||
@Override protected void fillPlainText(BusPacketLIP lip){}
|
|
||||||
|
|
||||||
public void addDevice(Device device){
|
|
||||||
devices.add(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkedList<Device> getDevices(){
|
|
||||||
return new LinkedList<Device>(devices);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Device{
|
|
||||||
public final String description, name;
|
|
||||||
public final short address;
|
|
||||||
public final boolean enabled;
|
|
||||||
public final int x, y, z;
|
|
||||||
|
|
||||||
public Device(String desc, String name, short address, boolean enabled, int x, int y, int z){
|
|
||||||
this.description = desc;
|
|
||||||
this.name = name;
|
|
||||||
this.address = address;
|
|
||||||
this.enabled = enabled;
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.bus;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public final class BusProtocols {
|
|
||||||
private static final ArrayList<Class<? extends BusPacket>> protocols = new ArrayList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a protocol to the list, if it doesn't exist yet.
|
|
||||||
*
|
|
||||||
* @param packetClass the class of the packet corresponding to the protocol we're adding.
|
|
||||||
* @return the id of the protocol we just added.
|
|
||||||
*/
|
|
||||||
public static final int addProtocol(Class<? extends BusPacket> packetClass){
|
|
||||||
if(!protocols.contains(packetClass)){
|
|
||||||
protocols.add(packetClass);
|
|
||||||
}
|
|
||||||
return protocols.indexOf(packetClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gives you the id of the protocol correspondig to a given packet class.
|
|
||||||
*
|
|
||||||
* @param packetClass the class of the packet for which we want to know the protocol ID.
|
|
||||||
* @return the ID of the protocol corresponding to the packet class.
|
|
||||||
*/
|
|
||||||
public static final int getProtocolID(Class<? extends BusPacket> packetClass){
|
|
||||||
return protocols.indexOf(packetClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BusProtocols(){}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// A list of all the protocols implemented by StargateTech 2
|
|
||||||
public static final int PROTOCOL_LIP = addProtocol(BusPacketLIP.class);
|
|
||||||
public static final int PROTOCOL_NETSCAN = addProtocol(BusPacketNetScan.class);
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.bus;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To be implemented by Tile Entities that wish
|
|
||||||
* to access the Abstract Bus.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public interface IBusDevice {
|
|
||||||
/**
|
|
||||||
* Returns the IBusInterfaces that exist on that
|
|
||||||
* side of the Tile Entity. It may be multiple
|
|
||||||
* values or null.
|
|
||||||
*
|
|
||||||
* @param side The side of the block that is being queried.
|
|
||||||
* @return This side's IBusInterface, if any.
|
|
||||||
*/
|
|
||||||
public IBusInterface[] getInterfaces(int side);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return This device's worldObj.
|
|
||||||
*/
|
|
||||||
public World getWorld();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return This device's X Coordinate.
|
|
||||||
*/
|
|
||||||
public int getXCoord();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return This device's Y Coordinate.
|
|
||||||
*/
|
|
||||||
public int getYCoord();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return This device's Z Coordinate.
|
|
||||||
*/
|
|
||||||
public int getZCoord();
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.bus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This provides a level of abstraction over the IBusInterface.
|
|
||||||
* Implement to your own liking.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public interface IBusDriver {
|
|
||||||
/**
|
|
||||||
* Used to check if this device should receive a specific
|
|
||||||
* packet type from this sender. If true is returned,
|
|
||||||
* handlePacket() is called afterwards.
|
|
||||||
*
|
|
||||||
* @param sender The Bus address of the packet's sender.
|
|
||||||
* @param protocolID The unique ID of this packet type.
|
|
||||||
* @param hasLIP whether the packet can be converted to the LIP format or not.
|
|
||||||
* @return Whether the device will accept this packet or not.
|
|
||||||
*/
|
|
||||||
public boolean canHandlePacket(short sender, int protocolID, boolean hasLIP);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called by the network to have this device handle a packet.
|
|
||||||
*
|
|
||||||
* @param packet The packet to be handled.
|
|
||||||
*/
|
|
||||||
public void handlePacket(BusPacket packet);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to make the IBusDriver give all packets in its send
|
|
||||||
* queue, one by one, to the IBusInterface so that it can
|
|
||||||
* send them accross the network.
|
|
||||||
*
|
|
||||||
* @return The next BusPacket in the queue, if any, null otherise.
|
|
||||||
*/
|
|
||||||
public BusPacket getNextPacketToSend();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called by the hardware representation (IBusInterface)
|
|
||||||
* to check if it's active or not.
|
|
||||||
* Inactive interfaces cannot send or receive packets.
|
|
||||||
*
|
|
||||||
* @return Whether this interface is active or not.
|
|
||||||
*/
|
|
||||||
public boolean isInterfaceEnabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called by this Driver's Interface to check it's own address.
|
|
||||||
*
|
|
||||||
* @return The address of this IBusDriver's IBusInterface.
|
|
||||||
*/
|
|
||||||
public short getInterfaceAddress();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return this driver's short name.<br>
|
|
||||||
* Should be readable and indicate what kind of device it is.<br>
|
|
||||||
* <b>Example:</b> Shield Controller
|
|
||||||
*/
|
|
||||||
public String getShortName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return a short description of what this device is.
|
|
||||||
*/
|
|
||||||
public String getDescription();
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.bus;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>DO NOT IMPLEMENT THIS INTERFACE!</b> To get an instance use
|
|
||||||
* <i>StargateTechAPI.api().getFactory().getIBusInterface()</i>;
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public interface IBusInterface {
|
|
||||||
/**
|
|
||||||
* Makes the IBusInterface call its IBusDriver's
|
|
||||||
* getNextPacketToSend() method repeatedly until it returns
|
|
||||||
* null. Every packet returned by that method will be sent
|
|
||||||
* across the network.
|
|
||||||
*/
|
|
||||||
public void sendAllPackets();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize this object.
|
|
||||||
*
|
|
||||||
* @param nbt The tag compound where this object's data is.
|
|
||||||
* @param tag The name of the tag under which this object's data is stored.
|
|
||||||
*/
|
|
||||||
public void writeToNBT(NBTTagCompound nbt, String tag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unserialize this object.
|
|
||||||
*
|
|
||||||
* @param nbt The tag compound where this object's data is.
|
|
||||||
* @param tag The name of the tag under which this object's data is stored.
|
|
||||||
*/
|
|
||||||
public void readFromNBT(NBTTagCompound nbt, String tag);
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
public class Address {
|
|
||||||
private Symbol[] symbols;
|
|
||||||
|
|
||||||
public static Address create(Symbol[] symbols){
|
|
||||||
try{
|
|
||||||
boolean used[] = new boolean[40];
|
|
||||||
if(symbols.length < 7) throw new Exception("Address too short: " + symbols.length);
|
|
||||||
if(symbols.length > 9) throw new Exception("Address too long: " + symbols.length);
|
|
||||||
for(int i = 0; i < used.length; i++){
|
|
||||||
used[i] = (i == 0);
|
|
||||||
}
|
|
||||||
for(Symbol symbol : symbols){
|
|
||||||
if(symbol == null || symbol == Symbol.VOID){
|
|
||||||
throw new Exception("Invalid Symbol.");
|
|
||||||
}
|
|
||||||
if(used[symbol.ordinal()]){
|
|
||||||
throw new Exception("Repeated Symbol.");
|
|
||||||
}
|
|
||||||
used[symbol.ordinal()] = true;
|
|
||||||
}
|
|
||||||
return new Address(symbols);
|
|
||||||
}catch(Exception e){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Address(Symbol[] symbols){
|
|
||||||
this.symbols = symbols;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int length(){
|
|
||||||
return symbols.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Symbol getSymbol(int symbol){
|
|
||||||
if(symbol >= 0 && symbol < length()){
|
|
||||||
return symbols[symbol];
|
|
||||||
}else{
|
|
||||||
return Symbol.VOID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString(){
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(getSymbol(0).toString());
|
|
||||||
sb.append(getSymbol(1).toString().toLowerCase());
|
|
||||||
sb.append(getSymbol(2).toString().toLowerCase());
|
|
||||||
sb.append(" ");
|
|
||||||
sb.append(getSymbol(3).toString());
|
|
||||||
sb.append(getSymbol(4).toString().toLowerCase());
|
|
||||||
sb.append(getSymbol(5).toString().toLowerCase());
|
|
||||||
sb.append(" ");
|
|
||||||
sb.append(getSymbol(6).toString());
|
|
||||||
sb.append(getSymbol(7).toString().toLowerCase());
|
|
||||||
sb.append(getSymbol(8).toString().toLowerCase());
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o){
|
|
||||||
if(o instanceof Address){
|
|
||||||
Address a = (Address) o;
|
|
||||||
if(a.length() == length()){
|
|
||||||
for(int i = 0; i < length(); i++){
|
|
||||||
if(symbols[i] != a.symbols[i]){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode(){
|
|
||||||
return length();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
public enum DialError{
|
|
||||||
// Dialing Errors
|
|
||||||
SOURCE_ADDRESS_NOT_FOUND,
|
|
||||||
TARGET_ADDRESS_NOT_FOUND,
|
|
||||||
SOURCE_WORLD_NOT_FOUND,
|
|
||||||
TARGET_WORLD_NOT_FOUND,
|
|
||||||
CANNOT_DIAL_SAME_WORLD,
|
|
||||||
FAILED_CHUNKLOADING_SOURCE,
|
|
||||||
FAILED_CHUNKLOADING_TARGET,
|
|
||||||
SOURCE_GATE_NOT_FOUND,
|
|
||||||
TARGET_GATE_NOT_FOUND,
|
|
||||||
NOT_ENOUGH_POWER,
|
|
||||||
TARGET_GATE_BUSY,
|
|
||||||
SOURCE_GATE_BUSY,
|
|
||||||
|
|
||||||
// Logic
|
|
||||||
DIALING_EVENT_CANCELED,
|
|
||||||
SUCCESSFULLY_DIALED,
|
|
||||||
UNKNOWN_LOGIC_ERROR;
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
|
||||||
|
|
||||||
public abstract class DialEvent extends StargateEvent {
|
|
||||||
public final Address sourceAddress;
|
|
||||||
public final Address destAddress;
|
|
||||||
public final int duration;
|
|
||||||
|
|
||||||
public DialEvent(Address src, Address dst, int dur) {
|
|
||||||
sourceAddress = src;
|
|
||||||
destAddress = dst;
|
|
||||||
duration = dur;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cancelable
|
|
||||||
public static class Pre extends DialEvent {
|
|
||||||
public Pre(Address src, Address dst, int dur) {
|
|
||||||
super(src, dst, dur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Success extends DialEvent {
|
|
||||||
public Success(Address src, Address dst, int dur) {
|
|
||||||
super(src, dst, dur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Error extends DialEvent {
|
|
||||||
public final DialError error;
|
|
||||||
|
|
||||||
public Error(Address src, Address dst, DialError error) {
|
|
||||||
super(src, dst, -1);
|
|
||||||
this.error = error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
|
|
||||||
public interface IDynamicWorldLoader {
|
|
||||||
/**
|
|
||||||
* @param address The address we're creating a new world for.
|
|
||||||
* @return Whether or not this loader will create a new world for this non-existing address.
|
|
||||||
*/
|
|
||||||
public boolean willCreateWorldFor(Address address);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Actually create a new world for this address.
|
|
||||||
* <b>This world must not exist already!</b>
|
|
||||||
* Do not forget to use the seedingShip to place a stargate on this world, or the pending
|
|
||||||
* wormhole will not connect.
|
|
||||||
*
|
|
||||||
* @param address The address we're creating a new world for.
|
|
||||||
* @param seedingShip The IStargatePlacer we'll use to place our stargate.
|
|
||||||
*/
|
|
||||||
public void loadWorldFor(Address address, IStargatePlacer seedingShip);
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IStargateNetwork {
|
|
||||||
/**
|
|
||||||
* @return Whether the Stargate Network is loaded (working) or not.
|
|
||||||
*/
|
|
||||||
public boolean isLoaded();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param address The string representation of an address. (e.g. "Proclarush Taonas At")
|
|
||||||
* @return an address object if the string is a valid address, null otherwise.
|
|
||||||
*/
|
|
||||||
public Address parseAddress(String address);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a given address exists in the network or not.
|
|
||||||
* (i.e., if this address maps to a physical Stargate)
|
|
||||||
*
|
|
||||||
* @param address the address we want to check.
|
|
||||||
* @return whether the address exists or not.
|
|
||||||
*/
|
|
||||||
public boolean addressExists(Address address);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the address of the Stargate in a specific location if it exists or null otherwise.
|
|
||||||
*
|
|
||||||
* @param world The world the target Stargate is in.
|
|
||||||
* @param x The target Stargate's X coordinate.
|
|
||||||
* @param y The target Stargate's Y coordinate.
|
|
||||||
* @param z The target Stargate's Z coordinate.
|
|
||||||
* @return The Stargate's address, or null if the location doesn't contain a Stargate.
|
|
||||||
*/
|
|
||||||
public Address getAddressOf(World world, int x, int y, int z);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the address of the Stargate nearest to the specified location, or null if there is no gate within the specified radius
|
|
||||||
* @param world The world the target Stargate is in.
|
|
||||||
* @param x The target Stargate's X coordinate.
|
|
||||||
* @param y The target Stargate's Y coordinate.
|
|
||||||
* @param z The target Stargate's Z coordinate.
|
|
||||||
* @param radius The maximum radius to look for a Stargate. Use -1 to search the whole world.
|
|
||||||
* @return The Stargate's address, or null if no Stargate was found
|
|
||||||
*/
|
|
||||||
public Address findNearestStargate(World world, int x, int y, int z, int radius);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new IDynamicWorldLoader.
|
|
||||||
*
|
|
||||||
* @param dwl The IDynamicWorldLoader to register.
|
|
||||||
*/
|
|
||||||
public void registerDynamicWorldLoader(IDynamicWorldLoader dwl);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unregister a known IDynamicWorldLoader.
|
|
||||||
*
|
|
||||||
* @param dwl The IDynamicWorldLoader to unregister.
|
|
||||||
*/
|
|
||||||
public void unregisterDynamicWorldLoader(IDynamicWorldLoader dwl);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reserve an address prefix for your DWL.
|
|
||||||
* If a Stargate attempts to dial a world with that prefix,
|
|
||||||
* your DWL is given exclusivity in generating that world.
|
|
||||||
*
|
|
||||||
* @param dwl Your IDynamicWorldLoader
|
|
||||||
* @param prefix And array of exactly 3 non-null and non-void symbols representing a dimension.
|
|
||||||
* @return whether or not the prefix has been successfully reserved.
|
|
||||||
*/
|
|
||||||
public boolean reserveDimensionPrefix(IDynamicWorldLoader dwl, Symbol[] prefix);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the specified prefix is associated with a dimension or reserved by a {@link IDynamicWorldLoader}.
|
|
||||||
*
|
|
||||||
* @param prefix An array of exactly 3 non-null and non-void symbols representing a dimension.
|
|
||||||
* @return Whether or not the prefix is either used or reserved.
|
|
||||||
*/
|
|
||||||
public boolean prefixExists(Symbol[] prefix);
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IStargatePlacer {
|
|
||||||
/**
|
|
||||||
* Attempts to place a Stargate in the givel location.
|
|
||||||
*
|
|
||||||
* @param w Our world.
|
|
||||||
* @param x The stargate base's (bottom center block) X coord.
|
|
||||||
* @param y The stargate base's (bottom center block) Y coord.
|
|
||||||
* @param z The stargate base's (bottom center block) Z coord.
|
|
||||||
* @param facing The direction the stargate should be facing. Should be a value in [0 - 3].
|
|
||||||
* @return Whether the Stargate was placed or not.
|
|
||||||
*/
|
|
||||||
public boolean placeStargate(World w, int x, int y, int z, int facing);
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a Stargate ring.
|
|
||||||
* Stargate "base" blocks contain the ring, so they implement this as well.
|
|
||||||
*
|
|
||||||
* All you can get from the Stargate ring is the address.
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public interface ITileStargate {
|
|
||||||
/**
|
|
||||||
* @return This Stargate's address. null values are possible on the client side.
|
|
||||||
*/
|
|
||||||
public Address getAddress();
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a Stargate base block (the block that supports the stargate).
|
|
||||||
*
|
|
||||||
* It contains all the important logic in the Stargate,
|
|
||||||
* like dialing, Iris control and power usage.
|
|
||||||
*
|
|
||||||
* Because the ring is inside the block that supports it, it is possible to
|
|
||||||
* call the same methods you can call on a ring.
|
|
||||||
*
|
|
||||||
* @see ITileStargate
|
|
||||||
*
|
|
||||||
* @author LordFokas
|
|
||||||
*/
|
|
||||||
public interface ITileStargateBase extends ITileStargate{
|
|
||||||
public enum DialMethod{
|
|
||||||
MANUAL, // Dialing Computers
|
|
||||||
AUTO // DHDs
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to try making the Stargate dial an address.
|
|
||||||
*
|
|
||||||
* @param address The address this Stargate should dial.
|
|
||||||
* @param timeout How many seconds the connection will last. (1 - 38; default: 38);
|
|
||||||
* @return whether the dialing sequence started (true) or failed (false).
|
|
||||||
*/
|
|
||||||
public DialError dial(Address address, int timeout, DialMethod method);
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public abstract class StargateEvent extends Event {
|
|
||||||
|
|
||||||
private static abstract class PhysicalGateEvent extends StargateEvent {
|
|
||||||
public final Address address;
|
|
||||||
public final World world;
|
|
||||||
public final int xCoord;
|
|
||||||
public final int yCoord;
|
|
||||||
public final int zCoord;
|
|
||||||
|
|
||||||
public PhysicalGateEvent(Address addr, World world, int x, int y, int z) {
|
|
||||||
this.xCoord = x;
|
|
||||||
this.yCoord = y;
|
|
||||||
this.zCoord = z;
|
|
||||||
this.world = world;
|
|
||||||
this.address = addr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cancelable
|
|
||||||
public static class StargateWrenched extends PhysicalGateEvent {
|
|
||||||
public StargateWrenched(Address addr, World world, int x, int y, int z) {
|
|
||||||
super(addr, world, x, y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class StargateDestroyed extends PhysicalGateEvent {
|
|
||||||
public StargateDestroyed(Address addr, World world, int x, int y, int z) {
|
|
||||||
super(addr, world, x, y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.stargate;
|
|
||||||
|
|
||||||
public enum Symbol {
|
|
||||||
VOID(""),
|
|
||||||
AT ("At"), // 1
|
|
||||||
AL ("Al"), // 2
|
|
||||||
CLA ("Cla"), // 3
|
|
||||||
UR ("Ur"), // 4
|
|
||||||
ON ("On"), // 5
|
|
||||||
DEH ("Deh"), // 6
|
|
||||||
EC ("Ec"), // 7
|
|
||||||
MIG ("Mig"), // 8
|
|
||||||
AM ("Am"), // 9
|
|
||||||
RUM ("Rum"), // 10
|
|
||||||
AR ("Ar"), // 11
|
|
||||||
VA ("Va"), // 12
|
|
||||||
COR ("Cor"), // 13
|
|
||||||
PRA ("Pra"), // 14
|
|
||||||
OM ("Om"), // 15
|
|
||||||
ET ("Et"), // 16
|
|
||||||
AS ("As"), // 17
|
|
||||||
US ("Us"), // 18
|
|
||||||
GON ("Gon"), // 19
|
|
||||||
ORM ("Orm"), // 20
|
|
||||||
EM ("Em"), // 21
|
|
||||||
AC ("Ac"), // 22
|
|
||||||
OTH ("Oth"), // 23
|
|
||||||
LOS ("Los"), // 24
|
|
||||||
LAN ("Lan"), // 25
|
|
||||||
EST ("Est"), // 26
|
|
||||||
CRO ("Cro"), // 27
|
|
||||||
SIL ("Sil"), // 28
|
|
||||||
TA ("Ta"), // 29
|
|
||||||
BREI("Brei"), // 30
|
|
||||||
RUSH("Rush"), // 31
|
|
||||||
ERP ("Erp"), // 32
|
|
||||||
SET ("Set"), // 33
|
|
||||||
ULF ("Ulf"), // 34
|
|
||||||
PRO ("Pro"), // 35
|
|
||||||
SAL ("Sal"), // 36
|
|
||||||
TIS ("Tis"), // 37
|
|
||||||
MAC ("Mac"), // 38
|
|
||||||
IRT ("Irt"); // 39
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private Symbol(String name){
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Symbol get(int s){
|
|
||||||
if(s >= 0 && s <= 39){
|
|
||||||
return values()[s];
|
|
||||||
}else{
|
|
||||||
return VOID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString(){
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package lordfokas.stargatetech2.api.world;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
|
||||||
import cpw.mods.fml.common.eventhandler.Event.HasResult;
|
|
||||||
|
|
||||||
@HasResult
|
|
||||||
public class EventWorldGen extends Event {
|
|
||||||
|
|
||||||
public final World world;
|
|
||||||
public final int chunkX;
|
|
||||||
public final int chunkZ;
|
|
||||||
public final GenType type;
|
|
||||||
|
|
||||||
public EventWorldGen(World world, int cX, int cZ, GenType type) {
|
|
||||||
this.world = world;
|
|
||||||
this.chunkX = cX;
|
|
||||||
this.chunkZ = cZ;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static enum GenType {
|
|
||||||
STARGATE,
|
|
||||||
LOOT_POD,
|
|
||||||
VEIN_NAQUADAH;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
Subproject commit ced30ed35097d53cdb2a843d705477e52896e54b
|
|
Loading…
x
Reference in New Issue
Block a user