Electric Pump and Fluidic Plenisher now have CC support for resetting their calculations
This commit is contained in:
parent
f2d9049a2e
commit
542b995b3b
2 changed files with 110 additions and 6 deletions
|
@ -15,9 +15,9 @@ import mekanism.api.EnumColor;
|
|||
import mekanism.api.IConfigurable;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedTank;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
|
@ -39,8 +39,15 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
|
||||
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable, IRedstoneControl, IUpgradeTile, ITankManager
|
||||
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable, IRedstoneControl, IUpgradeTile, ITankManager, IPeripheral
|
||||
{
|
||||
/** This pump's tank */
|
||||
public FluidTank fluidTank = new FluidTank(10000);
|
||||
|
@ -260,6 +267,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
|
|||
else {
|
||||
fluidTank.setFluid(null);
|
||||
}
|
||||
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
|
||||
|
@ -279,6 +287,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
|
|||
else {
|
||||
data.add(0);
|
||||
}
|
||||
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
return data;
|
||||
|
@ -519,4 +528,47 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
|
|||
{
|
||||
return new Object[] {fluidTank};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public String getType()
|
||||
{
|
||||
return getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
return new String[] {"reset"};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
|
||||
{
|
||||
switch(method)
|
||||
{
|
||||
case 0:
|
||||
recurringNodes.clear();
|
||||
return new Object[] {"Pump calculation reset."};
|
||||
default:
|
||||
return new Object[] {"Unknown command."};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
|
@ -15,7 +17,6 @@ import mekanism.common.util.ChargeUtils;
|
|||
import mekanism.common.util.FluidContainerUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.PipeUtils;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -30,10 +31,15 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implements IConfigurable, IFluidHandler, ISustainedTank
|
||||
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implements IPeripheral, IConfigurable, IFluidHandler, ISustainedTank
|
||||
{
|
||||
public Set<Coord4D> activeNodes = new HashSet<Coord4D>();
|
||||
public Set<Coord4D> usedNodes = new HashSet<Coord4D>();
|
||||
|
@ -508,4 +514,50 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public String getType()
|
||||
{
|
||||
return getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
return new String[] {"reset"};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
|
||||
{
|
||||
switch(method)
|
||||
{
|
||||
case 0:
|
||||
activeNodes.clear();
|
||||
usedNodes.clear();
|
||||
finishedCalc = false;
|
||||
|
||||
return new Object[] {"Plenisher calculation reset."};
|
||||
default:
|
||||
return new Object[] {"Unknown command."};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
@Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue