Cleanup, added Redstone Logic Adapter OC support
This commit is contained in:
parent
fbd692b4e0
commit
a4ab830e79
5 changed files with 34 additions and 98 deletions
|
@ -160,7 +160,7 @@ public abstract class BoilerTank implements IFluidTank
|
||||||
getFluid().amount -= used;
|
getFluid().amount -= used;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidStack drained = new FluidStack(getFluid().getFluidID(), used);
|
FluidStack drained = new FluidStack(getFluid(), used);
|
||||||
|
|
||||||
if(getFluid().amount <= 0)
|
if(getFluid().amount <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -240,7 +240,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
|
||||||
|
|
||||||
if(dataStream.readInt() == 1)
|
if(dataStream.readInt() == 1)
|
||||||
{
|
{
|
||||||
fluidTank.setFluid(new FluidStack(dataStream.readInt(), dataStream.readInt()));
|
fluidTank.setFluid(new FluidStack(FluidRegistry.getFluid(dataStream.readInt()), dataStream.readInt()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fluidTank.setFluid(null);
|
fluidTank.setFluid(null);
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package mekanism.common.tile;
|
package mekanism.common.tile;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.IConfigurable;
|
import mekanism.api.IConfigurable;
|
||||||
import mekanism.api.MekanismConfig.general;
|
import mekanism.api.MekanismConfig.general;
|
||||||
|
@ -11,9 +8,9 @@ import mekanism.api.Range4D;
|
||||||
import mekanism.api.gas.IGasItem;
|
import mekanism.api.gas.IGasItem;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
import mekanism.common.base.IActiveState;
|
import mekanism.common.base.IActiveState;
|
||||||
import mekanism.common.base.ITankManager;
|
|
||||||
import mekanism.common.base.IFluidContainerManager;
|
import mekanism.common.base.IFluidContainerManager;
|
||||||
import mekanism.common.base.ISustainedTank;
|
import mekanism.common.base.ISustainedTank;
|
||||||
|
import mekanism.common.base.ITankManager;
|
||||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||||
import mekanism.common.util.FluidContainerUtils;
|
import mekanism.common.util.FluidContainerUtils;
|
||||||
import mekanism.common.util.FluidContainerUtils.ContainerEditMode;
|
import mekanism.common.util.FluidContainerUtils.ContainerEditMode;
|
||||||
|
@ -24,14 +21,9 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.*;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import java.util.ArrayList;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
|
||||||
import net.minecraftforge.fluids.FluidTankInfo;
|
|
||||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
|
||||||
|
|
||||||
public class TileEntityPortableTank extends TileEntityContainerBlock implements IActiveState, IConfigurable, IFluidHandler, ISustainedTank, IFluidContainerManager, ITankManager
|
public class TileEntityPortableTank extends TileEntityContainerBlock implements IActiveState, IConfigurable, IFluidHandler, ISustainedTank, IFluidContainerManager, ITankManager
|
||||||
{
|
{
|
||||||
|
@ -389,7 +381,7 @@ public class TileEntityPortableTank extends TileEntityContainerBlock implements
|
||||||
|
|
||||||
if(dataStream.readInt() == 1)
|
if(dataStream.readInt() == 1)
|
||||||
{
|
{
|
||||||
fluidTank.setFluid(new FluidStack(dataStream.readInt(), dataStream.readInt()));
|
fluidTank.setFluid(new FluidStack(FluidRegistry.getFluid(dataStream.readInt()), dataStream.readInt()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fluidTank.setFluid(null);
|
fluidTank.setFluid(null);
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
package mekanism.common.util;
|
package mekanism.common.util;
|
||||||
|
|
||||||
|
import buildcraft.api.tools.IToolWrench;
|
||||||
|
import cofh.api.item.IToolHammer;
|
||||||
|
import cpw.mods.fml.common.ModContainer;
|
||||||
|
import cpw.mods.fml.common.registry.GameData;
|
||||||
import ic2.api.energy.EnergyNet;
|
import ic2.api.energy.EnergyNet;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import mekanism.api.Chunk3D;
|
import mekanism.api.Chunk3D;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
|
@ -28,24 +17,10 @@ import mekanism.api.transmitters.TransmissionType;
|
||||||
import mekanism.api.util.UnitDisplayUtils;
|
import mekanism.api.util.UnitDisplayUtils;
|
||||||
import mekanism.api.util.UnitDisplayUtils.ElectricUnit;
|
import mekanism.api.util.UnitDisplayUtils.ElectricUnit;
|
||||||
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
|
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.*;
|
||||||
import mekanism.common.MekanismBlocks;
|
import mekanism.common.Tier.*;
|
||||||
import mekanism.common.MekanismItems;
|
import mekanism.common.base.*;
|
||||||
import mekanism.common.OreDictCache;
|
|
||||||
import mekanism.common.Tier.BaseTier;
|
|
||||||
import mekanism.common.Tier.EnergyCubeTier;
|
|
||||||
import mekanism.common.Tier.FactoryTier;
|
|
||||||
import mekanism.common.Tier.InductionCellTier;
|
|
||||||
import mekanism.common.Tier.InductionProviderTier;
|
|
||||||
import mekanism.common.Upgrade;
|
|
||||||
import mekanism.common.Version;
|
|
||||||
import mekanism.common.base.IActiveState;
|
|
||||||
import mekanism.common.base.IFactory;
|
|
||||||
import mekanism.common.base.IFactory.RecipeType;
|
import mekanism.common.base.IFactory.RecipeType;
|
||||||
import mekanism.common.base.IModule;
|
|
||||||
import mekanism.common.base.IRedstoneControl;
|
|
||||||
import mekanism.common.base.ISideConfiguration;
|
|
||||||
import mekanism.common.base.IUpgradeTile;
|
|
||||||
import mekanism.common.inventory.container.ContainerElectricChest;
|
import mekanism.common.inventory.container.ContainerElectricChest;
|
||||||
import mekanism.common.item.ItemBlockBasic;
|
import mekanism.common.item.ItemBlockBasic;
|
||||||
import mekanism.common.item.ItemBlockEnergyCube;
|
import mekanism.common.item.ItemBlockEnergyCube;
|
||||||
|
@ -74,17 +49,18 @@ import net.minecraft.world.EnumSkyBlock;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.*;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.IFluidBlock;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import buildcraft.api.tools.IToolWrench;
|
|
||||||
import cofh.api.item.IToolHammer;
|
import java.io.BufferedReader;
|
||||||
import cpw.mods.fml.common.ModContainer;
|
import java.io.IOException;
|
||||||
import cpw.mods.fml.common.registry.GameData;
|
import java.io.InputStreamReader;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities used by Mekanism. All miscellaneous methods are located here.
|
* Utilities used by Mekanism. All miscellaneous methods are located here.
|
||||||
|
@ -1426,14 +1402,11 @@ public final class MekanismUtils
|
||||||
{
|
{
|
||||||
theClass = classesFound.get(className);
|
theClass = classesFound.get(className);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
theClass = Class.forName(className);
|
theClass = Class.forName(className);
|
||||||
classesFound.put(className, theClass);
|
classesFound.put(className, theClass);
|
||||||
} catch(ClassNotFoundException e)
|
} catch(ClassNotFoundException e) {
|
||||||
{
|
|
||||||
classesFound.put(className, null);
|
classesFound.put(className, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
package mekanism.generators.common.tile.reactor;
|
package mekanism.generators.common.tile.reactor;
|
||||||
|
|
||||||
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.lua.LuaException;
|
||||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.integration.IComputerIntegration;
|
||||||
import mekanism.common.util.LangUtils;
|
import mekanism.common.util.LangUtils;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -15,8 +10,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implements IComputerIntegration
|
||||||
public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implements IPeripheral
|
|
||||||
{
|
{
|
||||||
public ReactorLogic logicType = ReactorLogic.DISABLED;
|
public ReactorLogic logicType = ReactorLogic.DISABLED;
|
||||||
|
|
||||||
|
@ -138,38 +132,16 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String[] methods = new String[] {"isIgnited", "canIgnite", "getPlasmaHeat", "getMaxPlasmaHeat", "getCaseHeat", "getMaxCaseHeat", "getInjectionRate", "setInjectionRate", "hasFuel"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Method(modid = "ComputerCraft")
|
public String[] getMethods()
|
||||||
public String getType()
|
|
||||||
{
|
{
|
||||||
return getInventoryName();
|
return methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Method(modid = "ComputerCraft")
|
public Object[] invoke(int method, Object[] arguments) throws LuaException, InterruptedException
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String[] getMethodNames()
|
|
||||||
{
|
|
||||||
return new String[] {"isIgnited", "canIgnite", "getPlasmaHeat", "getMaxPlasmaHeat", "getCaseHeat", "getMaxCaseHeat", "getInjectionRate", "setInjectionRate", "hasFuel"};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
|
|
||||||
{
|
{
|
||||||
if(getReactor() == null || !getReactor().isFormed())
|
if(getReactor() == null || !getReactor().isFormed())
|
||||||
{
|
{
|
||||||
|
@ -205,7 +177,6 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem
|
||||||
return new Object[] {(getReactor().getDeuteriumTank().getStored() >= getReactor().getInjectionRate()/2) &&
|
return new Object[] {(getReactor().getDeuteriumTank().getStored() >= getReactor().getInjectionRate()/2) &&
|
||||||
(getReactor().getTritiumTank().getStored() >= getReactor().getInjectionRate()/2)};
|
(getReactor().getTritiumTank().getStored() >= getReactor().getInjectionRate()/2)};
|
||||||
default:
|
default:
|
||||||
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
|
|
||||||
return new Object[] {"Unknown command."};
|
return new Object[] {"Unknown command."};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue