Better OpenComputers compat.

This commit is contained in:
marcin212 committed 2017-03-30 15:43:36 +02:00
1 parent 2b02042f4c
commit 3eba40c870
2 files changed
+30 -2

No files matched your search

@@ -24,6 +24,7 @@ import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.ISideConfiguration;
import mekanism.common.base.ITierUpgradeable;
import mekanism.common.capabilities.Capabilities;
import mekanism.common.integration.IComputerIntegration;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.security.ISecurityTile;
import mekanism.common.tile.component.TileComponentConfig;
@@ -41,7 +42,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fml.common.FMLCommonHandler;
public class TileEntityGasTank extends TileEntityContainerBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, ISecurityTile, ITierUpgradeable
public class TileEntityGasTank extends TileEntityContainerBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, ISecurityTile, ITierUpgradeable, IComputerIntegration
{
public enum GasMode
{
@@ -67,6 +68,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
public TileComponentEjector ejectorComponent;
public TileComponentConfig configComponent;
public TileComponentSecurity securityComponent;
private static final String[] methods = new String[] {"getMaxGas", "getStoredGas", "getGas"};
public TileEntityGasTank()
{
@@ -421,4 +423,26 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
{
return securityComponent;
}
@Override
public String[] getMethods()
{
return methods;
}
@Override
public Object[] invoke(int method, Object[] arguments) throws Exception
{
switch(method)
{
case 0:
return new Object[] {gasTank.getMaxGas()};
case 1:
return new Object[] {gasTank.getStored()};
case 2:
return new Object[] {gasTank.getGas()};
default:
throw new NoSuchMethodException();
}
}
}
@@ -140,7 +140,7 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem
}
private static final String[] methods = new String[] {"isIgnited", "canIgnite", "getPlasmaHeat", "getMaxPlasmaHeat", "getCaseHeat", "getMaxCaseHeat", "getInjectionRate", "setInjectionRate", "hasFuel", "getProducing", "getIgnitionTemp",
"getEnergy", "getMaxEnergy", "getWater", "getSteam", "getFuel"};
"getEnergy", "getMaxEnergy", "getWater", "getSteam", "getFuel", "getDeuterium", "getTritium"};
@Override
public String[] getMethods()
@@ -198,6 +198,10 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem
return new Object[] {getReactor().getSteamTank().getFluidAmount()};
case 15:
return new Object[] {getReactor().getFuelTank().getStored()};
case 16:
return new Object[] {getReactor().getDeuteriumTank().getStored()};
case 17:
return new Object[] {getReactor().getTritiumTank().getStored()};
default:
return new Object[] {"Unknown command."};
}