Merge remote-tracking branch 'origin/master' into TDK
This commit is contained in:
commit
4f35ce0331
13 changed files with 112 additions and 85 deletions
|
@ -54,7 +54,20 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
|
|||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.2.7.0",
|
||||
dependencies = "required-after:IC2; after:ComputerCraft; after:OpenComputer; after:CCTurtle; after:gregtech_addon; required-after:AppliedEnergistics; after:AdvancedSolarPanel; after:AtomicScience; after:ICBM|Explosion; after:MFFS; after:GraviSuite; after:UndergroundBiomes; after:NetherOres")
|
||||
dependencies = "required-after:IC2;"
|
||||
+ " required-after:CoFHCore;"
|
||||
+ " after:ComputerCraft;"
|
||||
+ " after:OpenComputer;"
|
||||
+ " after:CCTurtle;"
|
||||
+ " after:gregtech_addon;"
|
||||
+ " required-after:AppliedEnergistics;"
|
||||
+ " after:AdvancedSolarPanel;"
|
||||
+ " after:AtomicScience;"
|
||||
+ " after:ICBM|Explosion;"
|
||||
+ " after:MFFS;"
|
||||
+ " after:GraviSuite;"
|
||||
+ " after:UndergroundBiomes;"
|
||||
+ " after:NetherOres")
|
||||
@NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = {
|
||||
"WarpDriveBeam",
|
||||
"WarpDriveFreq",
|
||||
|
@ -126,7 +139,7 @@ public class WarpDrive implements LoadingCallback {
|
|||
public int overlayType = 0;
|
||||
public String debugMessage = "";
|
||||
|
||||
public static WarpDrivePeripheralHandler peripheralHandler = new WarpDrivePeripheralHandler();
|
||||
public static WarpDrivePeripheralHandler peripheralHandler = null;
|
||||
|
||||
public static String defHelpStr = "help(\"functionName\"): returns help for the function specified";
|
||||
public static String defEnergyStr = "getEnergyLevel(): returns currently contained energy, max contained energy";
|
||||
|
@ -346,13 +359,16 @@ public class WarpDrive implements LoadingCallback {
|
|||
registerHyperSpaceDimension();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
|
||||
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
warpdriveTab.setBackgroundImageName("items.png");
|
||||
MinecraftForge.EVENT_BUS.register(new CameraOverlay(Minecraft.getMinecraft()));
|
||||
}
|
||||
|
||||
ComputerCraftAPI.registerPeripheralProvider(peripheralHandler);
|
||||
if (WarpDriveConfig.isCCLoaded) {
|
||||
peripheralHandler = new WarpDrivePeripheralHandler();
|
||||
ComputerCraftAPI.registerPeripheralProvider(peripheralHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -562,7 +578,7 @@ public class WarpDrive implements LoadingCallback {
|
|||
|
||||
// top = advancedCircuit, floppy, advancedCircuit
|
||||
// middle = advancedCircuit, advancedMachine, advancedCircuit
|
||||
// bottom = advancedCircuit, flux crystal, advancedCircuit
|
||||
// bottom = advancedCircuit, fluix crystal, advancedCircuit
|
||||
GameRegistry.addRecipe(new ItemStack(protocolBlock), "coc", "cmc", "cfc",
|
||||
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
|
||||
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
|
||||
|
|
|
@ -10,7 +10,7 @@ public class WarpDrivePeripheralHandler implements IPeripheralProvider {
|
|||
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
|
||||
// WarpDrive.debugPrint("Checking Peripheral at " + x + ", " + y + ", " + z);
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
if(te instanceof IPeripheral) {
|
||||
if (te instanceof IPeripheral && ((IPeripheral) te).getType() != null) {
|
||||
return (IPeripheral)te;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -62,7 +62,7 @@ public class WarpCoresRegistry {
|
|||
ArrayList<TileEntityReactor> res = new ArrayList<TileEntityReactor>(registry.size());
|
||||
removeDeadCores();
|
||||
|
||||
printRegistry();
|
||||
// printRegistry();
|
||||
int radius2 = radius * radius;
|
||||
for (TileEntityReactor core : registry) {
|
||||
double dX = core.xCoord - x;
|
||||
|
|
|
@ -28,6 +28,7 @@ public class TileEntityCamera extends WarpInterfacedTE {
|
|||
private int packetSendTicks = 20;
|
||||
|
||||
public TileEntityCamera() {
|
||||
super();
|
||||
peripheralName = "camera";
|
||||
methodsArray = new String[] {
|
||||
"freq"
|
||||
|
|
|
@ -45,6 +45,7 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
|
|||
private int soundTicks = 0;
|
||||
|
||||
public TileEntityCloakingDeviceCore() {
|
||||
super();
|
||||
peripheralName = "cloakingdevicecore";
|
||||
methodsArray = new String[] {
|
||||
"tier", // set field tier to 1 or 2, return field tier
|
||||
|
|
|
@ -61,6 +61,7 @@ public class TileEntityLaser extends WarpInterfacedTE {
|
|||
private int packetSendTicks = 20;
|
||||
|
||||
public TileEntityLaser() {
|
||||
super();
|
||||
peripheralName = "laser";
|
||||
methodsArray = new String[] {
|
||||
"emitBeam", // 0
|
||||
|
|
|
@ -32,6 +32,7 @@ public class TileEntityLift extends WarpEnergyTE {
|
|||
private int tickCount = 0;
|
||||
|
||||
public TileEntityLift() {
|
||||
super();
|
||||
peripheralName = "warpdriveLaserLift";
|
||||
methodsArray = new String[] {
|
||||
"getEnergyLevel",
|
||||
|
@ -219,22 +220,22 @@ public class TileEntityLift extends WarpEnergyTE {
|
|||
// ComputerCraft IPeripheral methods implementation
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] args) throws Exception {
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
|
||||
String methodName = methodsArray[method];
|
||||
if (methodName.equals("getEnergyLevel")) {
|
||||
return getEnergyLevel();
|
||||
|
||||
} else if (methodName.equals("mode")) {
|
||||
return mode(args);
|
||||
return mode(arguments);
|
||||
|
||||
} else if (methodName.equals("active")) {
|
||||
if (args.length == 1) {
|
||||
computerEnabled = toBool(args[0]);
|
||||
if (arguments.length == 1) {
|
||||
computerEnabled = toBool(arguments);
|
||||
}
|
||||
return new Object[] { computerEnabled ? false : isEnabled };
|
||||
|
||||
} else if (methodName.equals("help")) {
|
||||
return new Object[] { helpStr(args) };
|
||||
return new Object[] { helpStr(arguments) };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -65,14 +65,15 @@ public class TileEntityMiningLaser extends WarpInterfacedTE implements IGridMach
|
|||
private int layerOffset = 1;
|
||||
|
||||
public TileEntityMiningLaser() {
|
||||
super();
|
||||
peripheralName = "mininglaser";
|
||||
methodsArray = new String[] {
|
||||
"mine", //0
|
||||
"stop", //1
|
||||
"isMining", //2
|
||||
"quarry", //3
|
||||
"state", //4
|
||||
"offset" //5
|
||||
"mine",
|
||||
"stop",
|
||||
"isMining",
|
||||
"quarry",
|
||||
"state",
|
||||
"offset"
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -744,6 +745,7 @@ public class TileEntityMiningLaser extends WarpInterfacedTE implements IGridMach
|
|||
|
||||
// ComputerCraft IPeripheral methods implementation
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
super.attach(computer);
|
||||
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
|
||||
|
|
|
@ -25,6 +25,7 @@ public class TileEntityMonitor extends WarpInterfacedTE {
|
|||
private int packetSendTicks = 20;
|
||||
|
||||
public TileEntityMonitor() {
|
||||
super();
|
||||
peripheralName = "monitor";
|
||||
methodsArray = new String[] {
|
||||
"freq"
|
||||
|
|
|
@ -52,7 +52,8 @@ public class TileEntityProtocol extends WarpInterfacedTE {
|
|||
private TileEntityReactor core = null;
|
||||
|
||||
public TileEntityProtocol() {
|
||||
peripheralName = "warpcore";
|
||||
super();
|
||||
peripheralName = "warpcore";
|
||||
methodsArray = new String[] {
|
||||
"dim_positive",
|
||||
"dim_negative",
|
||||
|
|
|
@ -22,6 +22,7 @@ public class TileEntityRadar extends WarpEnergyTE {
|
|||
private int cooldownTime = 0;
|
||||
|
||||
public TileEntityRadar() {
|
||||
super();
|
||||
peripheralName = "radar";
|
||||
methodsArray = new String[] {
|
||||
"scanRadius",
|
||||
|
@ -43,9 +44,8 @@ public class TileEntityRadar extends WarpEnergyTE {
|
|||
if (getBlockMetadata() == 2) {
|
||||
cooldownTime++;
|
||||
if (cooldownTime > (20 * ((scanRadius / 1000) + 1))) {
|
||||
WarpDrive.debugPrint("" + this + " Scanning over " + scanRadius + " radius...");
|
||||
results = WarpDrive.warpCores.searchWarpCoresInRadius(xCoord, yCoord, zCoord, scanRadius);
|
||||
WarpDrive.debugPrint("" + this + " Scan found " + results.size() + " results");
|
||||
// WarpDrive.debugPrint("" + this + " Scan found " + results.size() + " results in " + scanRadius + " radius...");
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 + 2);
|
||||
cooldownTime = 0;
|
||||
}
|
||||
|
@ -145,6 +145,7 @@ public class TileEntityRadar extends WarpEnergyTE {
|
|||
|
||||
// ComputerCraft IPeripheral methods implementation
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
super.attach(computer);
|
||||
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
|
||||
|
@ -161,6 +162,7 @@ public class TileEntityRadar extends WarpEnergyTE {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
super.detach(computer);
|
||||
// worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 1 + 2);
|
||||
|
|
|
@ -48,6 +48,7 @@ public class TileEntityShipScanner extends WarpEnergyTE {
|
|||
private int targetX, targetY, targetZ;
|
||||
|
||||
public TileEntityShipScanner() {
|
||||
super();
|
||||
peripheralName = "shipscanner";
|
||||
methodsArray = new String[] {
|
||||
"scan",
|
||||
|
|
|
@ -34,15 +34,15 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
|
|||
}
|
||||
|
||||
// Common computer properties
|
||||
protected String peripheralName = "notImplemented";
|
||||
protected String peripheralName = null;
|
||||
protected String[] methodsArray = {};
|
||||
|
||||
// OpenComputer specific properties
|
||||
protected Node OC_node = null;
|
||||
protected boolean OC_addedToNetwork = false;
|
||||
|
||||
// ComputerCraft specific properties
|
||||
protected HashMap<Integer,IComputerAccess> connectedComputers = new HashMap<Integer,IComputerAccess>();
|
||||
protected Node OC_node = null;
|
||||
protected boolean OC_addedToNetwork = false;
|
||||
|
||||
// ComputerCraft specific properties
|
||||
protected HashMap<Integer, IComputerAccess> connectedComputers = new HashMap<Integer, IComputerAccess>();
|
||||
|
||||
// TileEntity overrides, notably for OpenComputer
|
||||
@Override
|
||||
|
@ -56,56 +56,56 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
if (OC_node != null) {
|
||||
OC_node.remove();
|
||||
OC_node = null;
|
||||
}
|
||||
}
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
if (OC_node != null) {
|
||||
OC_node.remove();
|
||||
OC_node = null;
|
||||
}
|
||||
}
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
if (OC_node != null && OC_node.host() == this) {
|
||||
OC_node.load(tag.getCompoundTag("oc:node"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
if (OC_node != null && OC_node.host() == this) {
|
||||
final NBTTagCompound nodeNbt = new NBTTagCompound();
|
||||
OC_node.save(nodeNbt);
|
||||
tag.setTag("oc:node", nodeNbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
if (OC_node != null) {
|
||||
OC_node.remove();
|
||||
OC_node = null;
|
||||
}
|
||||
}
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
if (OC_node != null) {
|
||||
OC_node.remove();
|
||||
OC_node = null;
|
||||
}
|
||||
}
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
if (OC_node != null && OC_node.host() == this) {
|
||||
OC_node.load(tag.getCompoundTag("oc:node"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
if (OC_node != null && OC_node.host() == this) {
|
||||
final NBTTagCompound nodeNbt = new NBTTagCompound();
|
||||
OC_node.save(nodeNbt);
|
||||
tag.setTag("oc:node", nodeNbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (((((super.hashCode() + worldObj.provider.dimensionId << 4) + xCoord) << 4) + yCoord) << 4) + zCoord;
|
||||
}
|
||||
|
||||
// Dirty cheap conversion methods
|
||||
// Dirty cheap conversion methods
|
||||
protected Object[] argumentsOCtoCC(Arguments args) {
|
||||
Object[] arguments = new Object[args.count()];
|
||||
int index = 0;
|
||||
|
@ -115,26 +115,26 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
|
|||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
// ComputerCraft methods
|
||||
|
||||
// ComputerCraft methods
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public String getType() {
|
||||
public String getType() {
|
||||
return peripheralName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public String[] getMethodNames() {
|
||||
return methodsArray;
|
||||
}
|
||||
|
||||
public String[] getMethodNames() {
|
||||
return methodsArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
|
||||
// empty stub
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
|
||||
// empty stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
|
@ -158,7 +158,7 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
|
|||
// WarpDrive.debugPrint("WarpInterfacedTE.equals");
|
||||
return other.hashCode() == hashCode();
|
||||
}
|
||||
|
||||
|
||||
// Computer abstraction methods
|
||||
protected void sendEvent(String eventName, Object[] arguments) {
|
||||
// WarpDrive.debugPrint("" + this + " Sending event '" + eventName + "'");
|
||||
|
|
Loading…
Reference in a new issue