Fixed LUA logs duplication spam for CC
Improved context in LUA logs for OC and CC
This commit is contained in:
parent
e0bb581ca3
commit
cc725cfd99
24 changed files with 83 additions and 146 deletions
|
@ -4,8 +4,6 @@ import cr0s.warpdrive.api.WarpDriveText;
|
|||
import cr0s.warpdrive.api.computer.ISecurityStation;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractMachine;
|
||||
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -157,14 +155,12 @@ public class TileEntitySecurityStation extends TileEntityAbstractMachine impleme
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "getAttachedPlayers":
|
||||
return getAttachedPlayers();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,7 @@ import cr0s.warpdrive.api.WarpDriveText;
|
|||
import cr0s.warpdrive.api.computer.IEnergyBase;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.EnergyWrapper;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -114,9 +113,7 @@ public abstract class TileEntityAbstractEnergyBase extends TileEntityAbstractMac
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "energyDisplayUnits":
|
||||
return energyDisplayUnits(arguments);
|
||||
|
@ -125,6 +122,6 @@ public abstract class TileEntityAbstractEnergyBase extends TileEntityAbstractMac
|
|||
return getEnergyStatus();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
|
@ -2,8 +2,7 @@ package cr0s.warpdrive.block;
|
|||
|
||||
import cr0s.warpdrive.Commons;
|
||||
import cr0s.warpdrive.api.computer.IEnergyConsumer;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -44,15 +43,13 @@ public abstract class TileEntityAbstractEnergyConsumer extends TileEntityAbstrac
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "getEnergyRequired":
|
||||
return getEnergyRequired();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,7 @@ import cr0s.warpdrive.config.WarpDriveConfig;
|
|||
import cr0s.warpdrive.data.EnumComponentType;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.data.VectorI;
|
||||
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.filesystem.IMount;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
|
@ -250,9 +251,9 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
|
|||
}
|
||||
if (WarpDriveConfig.LOGGING_LUA) {
|
||||
final String methodName = Commons.getMethodName(1);
|
||||
WarpDrive.logger.info(String.format("LUA call %s to %s(%s).%s(%s)",
|
||||
Commons.format(world, pos),
|
||||
peripheralName, context, methodName, Commons.format(arguments)));
|
||||
WarpDrive.logger.info(String.format("[OC] LUA call from %s %s to %s.%s(%s)",
|
||||
context.node().address(), Commons.format(world, pos),
|
||||
peripheralName, methodName, Commons.format(arguments)));
|
||||
}
|
||||
if (!isInterfaceEnabled()) {
|
||||
throw new RuntimeException("Missing Computer interface upgrade.");
|
||||
|
@ -261,11 +262,11 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
|
|||
}
|
||||
|
||||
@Optional.Method(modid = "computercraft")
|
||||
protected String CC_getMethodNameAndLogCall(final int methodIndex, @Nonnull final Object[] arguments) {
|
||||
private String CC_getMethodNameAndLogCall(@Nonnull final IComputerAccess computerAccess, final int methodIndex, @Nonnull final Object[] arguments) {
|
||||
final String methodName = methodsArray[methodIndex];
|
||||
if (WarpDriveConfig.LOGGING_LUA) {
|
||||
WarpDrive.logger.info(String.format("LUA call %s to %s.%s(%s)",
|
||||
Commons.format(world, pos),
|
||||
WarpDrive.logger.info(String.format("[CC] LUA call from %d:%s %s to %s.%s(%s)",
|
||||
computerAccess.getID(), computerAccess.getAttachmentName(), Commons.format(world, pos),
|
||||
peripheralName, methodName, Commons.format(arguments)));
|
||||
}
|
||||
if (!isInterfaceEnabled() && !methodName.equals("isInterfaced")) {
|
||||
|
@ -413,9 +414,17 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
|
|||
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
final public Object[] callMethod(@Nonnull final IComputerAccess computerAccess, @Nonnull final ILuaContext context,
|
||||
final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(computerAccess, method, arguments);
|
||||
|
||||
// we separate the proxy from the logs so childs can override the proxy without having to handle the logs themselves
|
||||
return CC_callMethod(methodName, arguments);
|
||||
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "computercraft")
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "isInterfaced":
|
||||
return isInterfaced();
|
||||
|
|
|
@ -5,8 +5,7 @@ import cr0s.warpdrive.api.computer.IAbstractLaser;
|
|||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.EnergyWrapper;
|
||||
import cr0s.warpdrive.data.EnumTier;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -266,9 +265,7 @@ public abstract class TileEntityAbstractLaser extends TileEntityAbstractEnergyBa
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "laserMediumDirection":
|
||||
return laserMediumDirection();
|
||||
|
@ -277,6 +274,6 @@ public abstract class TileEntityAbstractLaser extends TileEntityAbstractEnergyBa
|
|||
return laserMediumCount();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,7 @@ import cr0s.warpdrive.Commons;
|
|||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.api.computer.IMachine;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -164,9 +163,7 @@ public abstract class TileEntityAbstractMachine extends TileEntityAbstractInterf
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "name":
|
||||
return name(arguments);
|
||||
|
@ -178,7 +175,7 @@ public abstract class TileEntityAbstractMachine extends TileEntityAbstractInterf
|
|||
return isAssemblyValid();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,8 +5,7 @@ import cr0s.warpdrive.config.WarpDriveConfig;
|
|||
import cr0s.warpdrive.data.BlockProperties;
|
||||
import cr0s.warpdrive.data.EnergyWrapper;
|
||||
import cr0s.warpdrive.data.EnumComponentType;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -218,9 +217,7 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading {
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "bounds":
|
||||
return bounds(arguments);
|
||||
|
@ -229,6 +226,6 @@ public class TileEntityChunkLoader extends TileEntityAbstractChunkLoading {
|
|||
return radius(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ import cr0s.warpdrive.data.ForceFieldSetup;
|
|||
import cr0s.warpdrive.data.SoundEvents;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -815,9 +814,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "beamFrequency":
|
||||
return beamFrequency(arguments);
|
||||
|
@ -829,7 +826,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
|
|||
return getScanResult();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,8 +7,7 @@ import cr0s.warpdrive.api.WarpDriveText;
|
|||
import cr0s.warpdrive.block.TileEntityAbstractMachine;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.BlockProperties;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -177,9 +176,7 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractMachine
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "controlChannel":
|
||||
return controlChannel(arguments);
|
||||
|
@ -188,6 +185,6 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractMachine
|
|||
return state();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ import cr0s.warpdrive.data.Vector3;
|
|||
import cr0s.warpdrive.event.DeploySequencer;
|
||||
import cr0s.warpdrive.item.ItemShipToken;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -732,9 +731,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "scan":
|
||||
return scan();
|
||||
|
@ -749,7 +746,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
|
|||
return state();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
private static final int SHIP_TOKEN_UPDATE_PERIOD_TICKS = 20;
|
||||
|
|
|
@ -9,8 +9,7 @@ import cr0s.warpdrive.data.EnumLaserTreeFarmMode;
|
|||
import cr0s.warpdrive.data.SoundEvents;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -742,9 +741,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "start":
|
||||
return start();
|
||||
|
@ -769,7 +766,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
|||
return tapTrees(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,8 +10,7 @@ import cr0s.warpdrive.data.EnumMiningLaserMode;
|
|||
import cr0s.warpdrive.data.SoundEvents;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -531,9 +530,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner {
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "start":
|
||||
return start();
|
||||
|
@ -555,7 +552,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner {
|
|||
return silktouch(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,8 +7,7 @@ import cr0s.warpdrive.block.TileEntityAbstractMachine;
|
|||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.EnumCameraType;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -153,15 +152,13 @@ public class TileEntityCamera extends TileEntityAbstractMachine implements IVide
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "videoChannel":
|
||||
return videoChannel(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,8 +6,7 @@ import cr0s.warpdrive.api.IVideoChannel;
|
|||
import cr0s.warpdrive.block.TileEntityAbstractMachine;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -114,15 +113,13 @@ public class TileEntityMonitor extends TileEntityAbstractMachine implements IVid
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "videoChannel":
|
||||
return videoChannel(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,8 +11,7 @@ import cr0s.warpdrive.data.RadarEcho;
|
|||
import cr0s.warpdrive.data.StarMapRegistry;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.data.EnumRadarMode;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -313,9 +312,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergyConsumer {
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "getGlobalPosition":
|
||||
return getGlobalPosition();
|
||||
|
@ -339,7 +336,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergyConsumer {
|
|||
return getResult(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,8 +3,6 @@ package cr0s.warpdrive.block.energy;
|
|||
import cr0s.warpdrive.api.computer.IEnanReactorController;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergyCoreOrController;
|
||||
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -201,9 +199,7 @@ public class TileEntityEnanReactorController extends TileEntityAbstractEnergyCor
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "getInstabilities":
|
||||
return getInstabilities();
|
||||
|
@ -221,6 +217,6 @@ public class TileEntityEnanReactorController extends TileEntityAbstractEnergyCor
|
|||
return state();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@ import cr0s.warpdrive.data.BlockProperties;
|
|||
import cr0s.warpdrive.data.EnumReactorFace;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -271,9 +270,7 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser implemen
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "stabilize":
|
||||
return stabilize(arguments);
|
||||
|
@ -282,6 +279,6 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser implemen
|
|||
return side();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
|
@ -7,8 +7,7 @@ import cr0s.warpdrive.block.TileEntityAbstractEnergyConsumer;
|
|||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.ForceFieldRegistry;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -163,15 +162,13 @@ public abstract class TileEntityAbstractForceField extends TileEntityAbstractEne
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "beamFrequency":
|
||||
return beamFrequency(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,8 +16,7 @@ import cr0s.warpdrive.data.SoundEvents;
|
|||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.data.VectorI;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -1273,9 +1272,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "min":
|
||||
return min(arguments);
|
||||
|
@ -1293,7 +1290,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
|
|||
return translation(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
private class ThreadCalculation extends Thread {
|
||||
|
|
|
@ -10,8 +10,6 @@ import cr0s.warpdrive.config.WarpDriveConfig;
|
|||
import cr0s.warpdrive.data.EnumShipCommand;
|
||||
import cr0s.warpdrive.data.VectorI;
|
||||
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -446,9 +444,7 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "getOrientation":
|
||||
return getOrientation();
|
||||
|
@ -484,6 +480,6 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
|
|||
return targetName(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@ import cr0s.warpdrive.data.EnumLiftMode;
|
|||
import cr0s.warpdrive.data.SoundEvents;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -276,9 +275,7 @@ public class TileEntityLift extends TileEntityAbstractEnergyConsumer implements
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "mode":
|
||||
return mode(arguments);
|
||||
|
@ -287,6 +284,6 @@ public class TileEntityLift extends TileEntityAbstractEnergyConsumer implements
|
|||
return state();
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ import cr0s.warpdrive.data.BlockProperties;
|
|||
import cr0s.warpdrive.data.EnergyWrapper;
|
||||
import cr0s.warpdrive.data.StarMapRegistryItem;
|
||||
import cr0s.warpdrive.data.EnumStarMapEntryType;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -174,15 +173,13 @@ public class TileEntityTransporterBeacon extends TileEntityAbstractEnergyConsume
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "isActive":
|
||||
return isActive(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
// TileEntityAbstractBase overrides
|
||||
|
|
|
@ -28,8 +28,7 @@ import cr0s.warpdrive.data.EnumStarMapEntryType;
|
|||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.data.VectorI;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -1740,9 +1739,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyConsumer
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "beamFrequency":
|
||||
return beamFrequency(arguments);
|
||||
|
@ -1766,7 +1763,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyConsumer
|
|||
return energize(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,8 +7,7 @@ import cr0s.warpdrive.block.TileEntityLaser;
|
|||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.EnumCameraType;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
|
@ -143,15 +142,13 @@ public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChan
|
|||
// ComputerCraft IPeripheral methods
|
||||
@Override
|
||||
@Optional.Method(modid = "computercraft")
|
||||
public Object[] callMethod(@Nonnull final IComputerAccess computer, @Nonnull final ILuaContext context, final int method, @Nonnull final Object[] arguments) {
|
||||
final String methodName = CC_getMethodNameAndLogCall(method, arguments);
|
||||
|
||||
protected Object[] CC_callMethod(@Nonnull final String methodName, @Nonnull final Object[] arguments) {
|
||||
switch (methodName) {
|
||||
case "videoChannel":
|
||||
return videoChannel(arguments);
|
||||
}
|
||||
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
return super.CC_callMethod(methodName, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue