mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Updated SGT2 API.
This commit is contained in:
parent
f123a41d2d
commit
d55343116a
@ -3,6 +3,7 @@ package stargatetech2.api;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import stargatetech2.api.stargate.IStargateNetwork;
|
||||
import stargatetech2.api.stargate.IStargatePlacer;
|
||||
|
||||
public interface IStargateTechAPI {
|
||||
/**
|
||||
@ -20,6 +21,11 @@ public interface IStargateTechAPI {
|
||||
*/
|
||||
public IStargateNetwork getStargateNetwork();
|
||||
|
||||
/**
|
||||
* @return The IStargatePlacer singleton instance, a.k.a Seeding Ship for the fans.
|
||||
*/
|
||||
public IStargatePlacer getSeedingShip();
|
||||
|
||||
/**
|
||||
* @return The current IFactory instance.
|
||||
*/
|
||||
|
@ -1,6 +1,9 @@
|
||||
package stargatetech2.api.bus;
|
||||
|
||||
public abstract class BusPacket {
|
||||
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;
|
||||
@ -11,6 +14,7 @@ public abstract class BusPacket {
|
||||
* @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;
|
||||
@ -65,4 +69,25 @@ public abstract class BusPacket {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ import java.util.Hashtable;
|
||||
*
|
||||
* @author LordFokas
|
||||
*/
|
||||
public final class BusPacketLIP extends BusPacket {
|
||||
public static final int PROTOCOL_ID = BusProtocols.addProtocol(BusPacketLIP.class);
|
||||
public final class BusPacketLIP extends BusPacket<String> {
|
||||
private boolean isEditable = true;
|
||||
private LIPMetadata metadata = null;
|
||||
private Hashtable<String, String> data = new Hashtable();
|
||||
|
39
src/api/java/stargatetech2/api/bus/BusPacketNetScan.java
Normal file
39
src/api/java/stargatetech2/api/bus/BusPacketNetScan.java
Normal file
@ -0,0 +1,39 @@
|
||||
package 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package stargatetech2.api.bus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class BusProtocols {
|
||||
public final class BusProtocols {
|
||||
private static final ArrayList<Class<? extends BusPacket>> protocols = new ArrayList();
|
||||
|
||||
/**
|
||||
@ -29,4 +29,10 @@ public final class BusProtocols {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -50,4 +50,16 @@ public interface IBusDriver {
|
||||
* @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,37 +0,0 @@
|
||||
package stargatetech2.api.shields;
|
||||
|
||||
/**
|
||||
* Implemented by the Shield Controller TileEntities.
|
||||
*
|
||||
* @author LordFokas
|
||||
*/
|
||||
public interface IShieldController {
|
||||
/**
|
||||
* Given the way shield emitters work together, you cannot
|
||||
* directly access their ShieldPermissions object.
|
||||
* This means you cannot use this method to change
|
||||
* permissions on a shield.
|
||||
*
|
||||
* @return A deep clone of the ShieldPermissions object that
|
||||
* defines this controller's shield behavior.
|
||||
*/
|
||||
public ShieldPermissions getPermissions();
|
||||
|
||||
/**
|
||||
* @return True if the shield is activated, false otherwise.
|
||||
*/
|
||||
public boolean isShieldOn();
|
||||
|
||||
/**
|
||||
* @return The name of the player who owns this Shield Controller.
|
||||
*/
|
||||
public String getOwner();
|
||||
|
||||
/**
|
||||
* Checks if a player can access this device.
|
||||
*
|
||||
* @param player The player's name.
|
||||
* @return Whether or not this player can access this device.
|
||||
*/
|
||||
public boolean hasAccess(String player);
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package stargatetech2.api.shields;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Used by shield emitters to make shieldable blocks in their way raise and lower their shields.
|
||||
*
|
||||
* @author LordFokas
|
||||
*/
|
||||
public interface IShieldable {
|
||||
/**
|
||||
* Called by shield emitters to make blocks raise their shields.
|
||||
* The block on {px, py, pz} contains an IShieldController from
|
||||
* which you can get the current ShieldPermissions object.
|
||||
*
|
||||
* @param world The world this IShieldable is on.
|
||||
* @param x This IShieldable's X Coordinate.
|
||||
* @param y This IShieldable's Y Coordinate.
|
||||
* @param z This IShieldable's Z Coordinate.
|
||||
* @param px The X Coordinate of the shield controller in charge of the shield on this block.
|
||||
* @param py The Y Coordinate of the shield controller in charge of the shield on this block.
|
||||
* @param pz The Z Coordinate of the shield controller in charge of the shield on this block.
|
||||
*/
|
||||
public void onShield(World world, int x, int y, int z, int px, int py, int pz);
|
||||
|
||||
/**
|
||||
* Called by shield emitters to make blocks lower their shields.
|
||||
*
|
||||
* @param world The world this IShieldable is on.
|
||||
* @param x This IShieldable's X Coordinate.
|
||||
* @param y This IShieldable's Y Coordinate.
|
||||
* @param z This IShieldable's Z Coordinate.
|
||||
*/
|
||||
public void onUnshield(World world, int x, int y, int z);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package stargatetech2.api.shields;
|
||||
|
||||
/**
|
||||
* Implemented by the shield emitter TileEntities.
|
||||
*
|
||||
* @author LordFokas
|
||||
*/
|
||||
public interface ITileShieldEmitter {
|
||||
/**
|
||||
* Given the way shield emitters work together, you cannot
|
||||
* directly access their ShieldPermissions object.
|
||||
* This means you cannot use this method to change
|
||||
* permissions on a shield.
|
||||
*
|
||||
* @return A deep clone of theShieldPermissions object that
|
||||
* defines this emitter's shield behavior.
|
||||
*/
|
||||
public ShieldPermissions getPermissions();
|
||||
|
||||
/**
|
||||
* @return True if the shield is activated, false otherwise.
|
||||
*/
|
||||
public boolean isShieldOn();
|
||||
|
||||
/**
|
||||
* Update the permissions on this emitter.
|
||||
* It will propagate to the whole shield.
|
||||
*
|
||||
* @param isAllow true if allowing this flag, false if disallowing.
|
||||
* @param flag The flag we're (dis)allowing.
|
||||
* @see stargatetech2.api.ShieldPermissions
|
||||
*/
|
||||
public void updatePermissions(boolean isAllow, int flag);
|
||||
|
||||
/**
|
||||
* Update the exceptions on this emitter.
|
||||
* It will propagate to the whole shield.
|
||||
*
|
||||
* @param isAdding true if we're adding a player to the exceptions, false if removing.
|
||||
* @param player The name of the player we're adding / removing.
|
||||
* @see stargatetech2.api.ShieldPermissions
|
||||
*/
|
||||
public void updateExceptions(boolean isAdding, String player);
|
||||
|
||||
/**
|
||||
* Sets the owner of this Shield Emitter.
|
||||
* An owner has previleges no other players have.
|
||||
*
|
||||
* @param owner The owner's player name.
|
||||
*/
|
||||
public void setOwner(String owner);
|
||||
|
||||
/**
|
||||
* @return The player name of this machine's owner.
|
||||
*/
|
||||
public String getOwner();
|
||||
|
||||
/**
|
||||
* Checks if a player can access this device.
|
||||
*
|
||||
* @param player The player's name.
|
||||
* @return Whether or not this player can access this device.
|
||||
*/
|
||||
public boolean canAccess(String player);
|
||||
}
|
@ -1,165 +0,0 @@
|
||||
package stargatetech2.api.shields;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
public class ShieldPermissions {
|
||||
// Permission Flags
|
||||
public static final int PERM_FRIEND = 0x01;
|
||||
public static final int PERM_PLAYER = 0x02;
|
||||
public static final int PERM_VILLAGER = 0x04;
|
||||
public static final int PERM_ANIMAL = 0x08;
|
||||
public static final int PERM_MONSTER = 0x10;
|
||||
public static final int PERM_VESSEL = 0x20;
|
||||
|
||||
private int permValue = 0;
|
||||
private LinkedList<String> playerExceptions = new LinkedList<String>();
|
||||
|
||||
/**
|
||||
* @return A default ShieldPermissions object.
|
||||
*/
|
||||
public static ShieldPermissions getDefault(){
|
||||
ShieldPermissions perm = new ShieldPermissions();
|
||||
perm.allow(PERM_FRIEND | PERM_PLAYER);
|
||||
return perm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param perm Make shields allow this PERM_* flag.
|
||||
* Combinations (binary or) are allowed.
|
||||
*/
|
||||
public void allow(int perm){
|
||||
permValue |= perm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param perm Make shields disallow this PERM_* flag.
|
||||
* Combinations (binary or) are allowed.
|
||||
*/
|
||||
public void disallow(int perm){
|
||||
permValue &= ~perm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an exception to the current player permission setting.
|
||||
* @param player The name of the player to add to the exceptions.
|
||||
*/
|
||||
public void setPlayerException(String player){
|
||||
if(!playerExceptions.contains(player))
|
||||
playerExceptions.add(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an exception from the current player permission setting.
|
||||
* @param player The name of the player to remove from the exceptions.
|
||||
*/
|
||||
public void removePlayerException(String player){
|
||||
playerExceptions.remove(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A list of strings containing the names of all the players
|
||||
* who currently are exceptions to the player permission setting.
|
||||
*/
|
||||
public List<String> getExceptionList(){
|
||||
return playerExceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this entity is allowed to go through the shields.
|
||||
*
|
||||
* @param entity The entity to be checked.
|
||||
* @param doDismount If set to true, when an allowed entity is being ridden
|
||||
* by a disallowed one, it's rider will be dismounted so this entity can pass.
|
||||
* @return Whether this entity can go through or not.
|
||||
*/
|
||||
public boolean isEntityAllowed(Entity entity, boolean doDismount){
|
||||
boolean allow = false;
|
||||
if(entity instanceof EntityPlayer){
|
||||
if(hasBit(PERM_PLAYER)){
|
||||
allow = true;
|
||||
}
|
||||
if(playerExceptions.contains(entity.getEntityName())){
|
||||
allow = !allow;
|
||||
}
|
||||
}else if(entity instanceof EntityVillager){
|
||||
allow = hasBit(PERM_VILLAGER);
|
||||
}else if(entity instanceof EntityAnimal){
|
||||
allow = hasBit(PERM_ANIMAL);
|
||||
}else if(entity instanceof EntityMob){
|
||||
allow = hasBit(PERM_MONSTER);
|
||||
}else if(entity instanceof EntityMinecart){
|
||||
allow = hasBit(PERM_VESSEL);
|
||||
}
|
||||
if(allow && entity.riddenByEntity != null && doDismount && entity.worldObj.isRemote == false){
|
||||
if(!isEntityAllowed(entity.riddenByEntity, true)){
|
||||
Entity rider = entity.riddenByEntity;
|
||||
if(rider instanceof EntityPlayer){
|
||||
rider.mountEntity(null);
|
||||
}else{
|
||||
rider.ridingEntity = null;
|
||||
rider.prevPosY += 1;
|
||||
rider.posY += 1;
|
||||
entity.riddenByEntity = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return allow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bit A binary flag to check against these permissions.
|
||||
* While usually this is a PERM_* flag, any combination of bits is allowed.
|
||||
* @return Whether this flag exists in these permissions or not.
|
||||
*/
|
||||
public boolean hasBit(int bit){
|
||||
return (permValue & bit) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A deep clone of this object.
|
||||
*/
|
||||
public ShieldPermissions deepClone(){
|
||||
ShieldPermissions clone = new ShieldPermissions();
|
||||
clone.permValue = this.permValue;
|
||||
for(String player : playerExceptions){
|
||||
clone.playerExceptions.add(player);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
// This really doesn't need an explanation...
|
||||
public static ShieldPermissions readFromNBT(NBTTagCompound nbt){
|
||||
ShieldPermissions permissions = getDefault();
|
||||
if(nbt != null){
|
||||
int exceptions = nbt.getInteger("exceptions");
|
||||
permissions.permValue = nbt.getInteger("permValue");
|
||||
permissions.playerExceptions = new LinkedList<String>();
|
||||
for(int i = 0; i < exceptions; i++){
|
||||
permissions.setPlayerException(nbt.getString("pex" + i));
|
||||
}
|
||||
}
|
||||
return permissions;
|
||||
}
|
||||
|
||||
// ... does it?
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
int exceptions = playerExceptions.size();
|
||||
nbt.setInteger("permValue", permValue);
|
||||
nbt.setInteger("exceptions", exceptions);
|
||||
for(int i = 0; i < exceptions; i++){
|
||||
nbt.setString("pex" + i, playerExceptions.get(i));
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
}
|
22
src/api/java/stargatetech2/api/stargate/DialError.java
Normal file
22
src/api/java/stargatetech2/api/stargate/DialError.java
Normal file
@ -0,0 +1,22 @@
|
||||
package 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;
|
||||
}
|
38
src/api/java/stargatetech2/api/stargate/DialEvent.java
Normal file
38
src/api/java/stargatetech2/api/stargate/DialEvent.java
Normal file
@ -0,0 +1,38 @@
|
||||
package stargatetech2.api.stargate;
|
||||
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public abstract class DialEvent extends Event {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package 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);
|
||||
}
|
@ -33,4 +33,48 @@ public interface IStargateNetwork {
|
||||
* @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);
|
||||
}
|
17
src/api/java/stargatetech2/api/stargate/IStargatePlacer.java
Normal file
17
src/api/java/stargatetech2/api/stargate/IStargatePlacer.java
Normal file
@ -0,0 +1,17 @@
|
||||
package 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);
|
||||
}
|
@ -14,6 +14,10 @@ package stargatetech2.api.stargate;
|
||||
* @author LordFokas
|
||||
*/
|
||||
public interface ITileStargateBase extends ITileStargate{
|
||||
public enum DialMethod{
|
||||
MANUAL, // Dialing Computers
|
||||
AUTO // DHDs
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to try making the Stargate dial an address.
|
||||
@ -22,5 +26,5 @@ public interface ITileStargateBase extends ITileStargate{
|
||||
* @param timeout How many seconds the connection will last. (1 - 38; default: 38);
|
||||
* @return whether the dialing sequence started (true) or failed (false).
|
||||
*/
|
||||
public boolean dial(Address address, int timeout);
|
||||
public DialError dial(Address address, int timeout, DialMethod method);
|
||||
}
|
28
src/api/java/stargatetech2/api/world/EventWorldGen.java
Normal file
28
src/api/java/stargatetech2/api/world/EventWorldGen.java
Normal file
@ -0,0 +1,28 @@
|
||||
package stargatetech2.api.world;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Event;
|
||||
import net.minecraftforge.event.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;
|
||||
}
|
||||
|
||||
}
|
@ -27,9 +27,13 @@ class AbstractBus(val device: IBusDevice) extends component.ManagedComponent wit
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def getShortName = "Computer"
|
||||
|
||||
override def getDescription = "An OpenComputers computer or server."
|
||||
|
||||
override def canHandlePacket(sender: Short, protocolID: Int, hasLIP: Boolean) = hasLIP
|
||||
|
||||
override def handlePacket(packet: BusPacket) {
|
||||
override def handlePacket(packet: BusPacket[_]) {
|
||||
val lip = packet.getPlainText
|
||||
val data = Map(lip.getEntryList.map(key => (key, lip.get(key))): _*)
|
||||
val metadata = Map("mod" -> lip.getMetadata.modID, "device" -> lip.getMetadata.deviceName, "player" -> lip.getMetadata.playerName)
|
||||
|
@ -27,7 +27,7 @@ object Mods {
|
||||
val PortalGun = new SimpleMod("PortalGun")
|
||||
val ProjectRed = new SimpleMod("ProjRed|Transmission")
|
||||
val RedLogic = new SimpleMod("RedLogic")
|
||||
val StargateTech2 = new SimpleMod("StargateTech2@[0.6.0,)")
|
||||
val StargateTech2 = new SimpleMod("StargateTech2@[0.7.0,)")
|
||||
val ThermalExpansion = new SimpleMod("ThermalExpansion")
|
||||
val TinkersConstruct = new SimpleMod("TConstruct")
|
||||
val UniversalElectricity = new SimpleMod("UniversalElectricity@[3.1,)")
|
||||
|
Loading…
x
Reference in New Issue
Block a user