Converted plasma heater to scala, and fixed compile errors

This commit is contained in:
Robert S 2014-09-27 22:45:49 -04:00
parent 6c07d98cf4
commit 9b74eeae49
12 changed files with 330 additions and 374 deletions

View file

@ -18,14 +18,14 @@ object TileFilterable
final val BATERY_DRAIN_SLOT: Int = 1 final val BATERY_DRAIN_SLOT: Int = 1
} }
abstract class TileFilterable extends TileInventory(Material.wood) with IRotatable with IFilterable abstract class TileFilterable(material: Material) extends TileInventory(material: Material) with IRotatable with IFilterable
{ {
private var filterItem: ItemStack = null private var filterItem: ItemStack = null
private var inverted: Boolean = false private var inverted: Boolean = false
def this(material: Material) def this()
{ {
this(material) this(Material.wood)
this.setSizeInventory(2) this.setSizeInventory(2)
} }

View file

@ -16,6 +16,7 @@ import universalelectricity.core.transform.vector.VectorWorld
object PathfinderCrate object PathfinderCrate
{ {
abstract trait IPathCallBack abstract trait IPathCallBack
{ {
/** /**
@ -39,9 +40,19 @@ object PathfinderCrate
class PathfinderCrate class PathfinderCrate
{ {
def this() /**
{ * A pathfinding call back interface used to call back on paths.
this() */
var callBackCheck: PathfinderCrate.IPathCallBack = null
/**
* A list of nodes that the pathfinder went through.
*/
var iteratedNodes: List[TileEntity] = null
/**
* The results and findings found by the pathfinder.
*/
var results: List[Any] = null
this.callBackCheck = new PathfinderCrate.IPathCallBack this.callBackCheck = new PathfinderCrate.IPathCallBack
{ {
def isValidNode(finder: PathfinderCrate, direction: ForgeDirection, provider: TileEntity, node: TileEntity): Boolean = def isValidNode(finder: PathfinderCrate, direction: ForgeDirection, provider: TileEntity, node: TileEntity): Boolean =
@ -55,7 +66,6 @@ class PathfinderCrate
} }
} }
this.clear this.clear
}
def findNodes(provider: TileEntity): Boolean = def findNodes(provider: TileEntity): Boolean =
{ {
@ -98,20 +108,9 @@ class PathfinderCrate
def clear: PathfinderCrate = def clear: PathfinderCrate =
{ {
this.iteratedNodes = new ArrayList[TileEntity] this.iteratedNodes = new ArrayList[TileEntity]
this.results = new ArrayList[_] this.results = new ArrayList[Any]
return this return this
} }
/**
* A pathfinding call back interface used to call back on paths.
*/
var callBackCheck: PathfinderCrate.IPathCallBack = null
/**
* A list of nodes that the pathfinder went through.
*/
var iteratedNodes: List[TileEntity] = null
/**
* The results and findings found by the pathfinder.
*/
var results: List[_] = null
} }

View file

@ -27,8 +27,8 @@ class ItemAntimatter extends ItemCell
@SideOnly(Side.CLIENT) override def registerIcons(iconRegister: IIconRegister) @SideOnly(Side.CLIENT) override def registerIcons(iconRegister: IIconRegister)
{ {
this.itemIcon = iconRegister.registerIcon(this.getUnlocalizedName.replace("item.", "") + "_milligram") this.itemIcon = iconRegister.registerIcon(Reference.prefix + "antimatter_milligram")
this.iconGram = iconRegister.registerIcon(this.getUnlocalizedName.replace("item.", "") + "_gram") this.iconGram = iconRegister.registerIcon(Reference.prefix + "antimatter_gram")
} }
override def getIconFromDamage(metadata: Int): IIcon = override def getIconFromDamage(metadata: Int): IIcon =

View file

@ -22,11 +22,11 @@ class ItemCell extends ItemTooltip
override def getUnlocalizedName(itemstack: ItemStack): String = override def getUnlocalizedName(itemstack: ItemStack): String =
{ {
val localized: String = LanguageUtility.getLocal(getUnlocalizedName + "." + itemstack.getItemDamage + ".name") val localized: String = LanguageUtility.getLocal(getUnlocalizedName() + "." + itemstack.getItemDamage + ".name")
if (localized != null && !localized.isEmpty) if (localized != null && !localized.isEmpty)
{ {
return getUnlocalizedName + "." + itemstack.getItemDamage return getUnlocalizedName() + "." + itemstack.getItemDamage
} }
return getUnlocalizedName return getUnlocalizedName()
} }
} }

View file

@ -24,7 +24,7 @@ class ItemHazmat(slot: Int) extends ItemArmor(ItemHazmat.hazmatArmorMaterial, At
{ {
def this(name: String, slot: Int) def this(name: String, slot: Int)
{ {
this(ItemHazmat.hazmatArmorMaterial, Atomic.proxy.getArmorIndex("hazmat"), slot) this(slot)
this.setUnlocalizedName(Reference.prefix + name) this.setUnlocalizedName(Reference.prefix + name)
this.setCreativeTab(ResonantTab.tab) this.setCreativeTab(ResonantTab.tab)
this.setMaxDamage(200000) this.setMaxDamage(200000)

View file

@ -35,9 +35,9 @@ class ItemUranium extends ItemRadioactive
} }
} }
override def getUnlocalizedName(itemStack: ItemStack): String = override def getUnlocalizedName(itemStack: ItemStack): java.lang.String =
{ {
return this.getUnlocalizedName + "." + itemStack.getItemDamage return super.getUnlocalizedName() + "." + itemStack.getItemDamage
} }
override def getSubItems(item: Item, par2CreativeTabs: CreativeTabs, list: List[_]) override def getSubItems(item: Item, par2CreativeTabs: CreativeTabs, list: List[_])

View file

@ -32,7 +32,7 @@ public class RenderPlasmaHeater extends RenderTaggedTile
bindTexture(TEXTURE); bindTexture(TEXTURE);
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glRotated(Math.toDegrees(tileEntity.rotation), 0, 1, 0); GL11.glRotated(Math.toDegrees(tileEntity.rotation()), 0, 1, 0);
MODEL.renderOnly("rrot", "srot"); MODEL.renderOnly("rrot", "srot");
GL11.glPopMatrix(); GL11.glPopMatrix();

View file

@ -1,106 +0,0 @@
package resonantinduction.atomic.machine.plasma;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import resonant.api.event.PlasmaEvent.SpawnPlasmaEvent;
import resonant.content.prefab.java.TileAdvanced;
import resonant.engine.grid.thermal.ThermalGrid;
import resonant.lib.config.Config;
import universalelectricity.core.transform.vector.Vector3;
import universalelectricity.core.transform.vector.VectorWorld;
import java.util.ArrayList;
public class TilePlasma extends TileAdvanced
{
@Config
public static int plasmaMaxTemperature = 1000000;
private float temperature = plasmaMaxTemperature;
public TilePlasma()
{
super(Material.lava);
textureName_$eq("plasma");
isOpaqueCube(false);
}
@Override
public int getLightValue(IBlockAccess access)
{
return 7;
}
@Override
public boolean isSolid(IBlockAccess access, int side)
{
return false;
}
@Override
public ArrayList<ItemStack> getDrops(int metadata, int fortune)
{
return new ArrayList<ItemStack>();
}
@Override
public int getRenderBlockPass()
{
return 1;
}
@Override
public void collide(Entity entity)
{
entity.attackEntityFrom(DamageSource.inFire, 100);
}
@Override
public void update()
{
super.update();
ThermalGrid.addTemperature(new VectorWorld(this), (temperature - ThermalGrid.getTemperature(new VectorWorld(this))) * 0.1f);
if (ticks() % 20 == 0)
{
temperature /= 1.5;
if (temperature <= plasmaMaxTemperature / 10)
{
worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.fire, 0, 3);
return;
}
for (int i = 0; i < 6; i++)
{
// Randomize spread direction.
if (worldObj.rand.nextFloat() > 0.4)
{
continue;
}
Vector3 diDian = new Vector3(this);
diDian.add(ForgeDirection.getOrientation(i));
TileEntity tileEntity = diDian.getTileEntity(worldObj);
if (!(tileEntity instanceof TilePlasma))
{
MinecraftForge.EVENT_BUS.post(new SpawnPlasmaEvent(worldObj, diDian.xi(), diDian.yi(), diDian.zi(), (int) temperature));
}
}
}
}
public void setTemperature(int newTemperature)
{
temperature = newTemperature;
}
}

View file

@ -0,0 +1,91 @@
package resonantinduction.atomic.machine.plasma
import java.util.ArrayList
import net.minecraft.block.material.Material
import net.minecraft.entity.Entity
import net.minecraft.init.Blocks
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.DamageSource
import net.minecraft.world.IBlockAccess
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.common.util.ForgeDirection
import resonant.api.event.PlasmaEvent
import resonant.content.prefab.java.TileAdvanced
import resonant.engine.grid.thermal.ThermalGrid
import resonant.lib.config.Config
import universalelectricity.core.transform.vector.{Vector3, VectorWorld}
object TilePlasma
{
@Config var plasmaMaxTemperature: Int = 1000000
}
class TilePlasma extends TileAdvanced(Material.lava)
{
private var temperature: Double = TilePlasma.plasmaMaxTemperature
//Constructor
textureName_$eq("plasma")
isOpaqueCube(false)
override def getLightValue(access: IBlockAccess): Int =
{
return 7
}
override def isSolid(access: IBlockAccess, side: Int): Boolean =
{
return false
}
override def getDrops(metadata: Int, fortune: Int): ArrayList[ItemStack] =
{
return new ArrayList[ItemStack]
}
override def getRenderBlockPass: Int =
{
return 1
}
override def collide(entity: Entity)
{
entity.attackEntityFrom(DamageSource.inFire, 100)
}
override def update
{
super.update
ThermalGrid.addTemperature(new VectorWorld(this), ((temperature - ThermalGrid.getTemperature(new VectorWorld(this))) * 0.1f).asInstanceOf[Float])
if (ticks % 20 == 0)
{
temperature /= 1.5
if (temperature <= TilePlasma.plasmaMaxTemperature / 10)
{
worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.fire, 0, 3)
return
}
for (i <- 0 to 6)
{
if (worldObj.rand.nextFloat < 0.4)
{
val diDian: Vector3 = new Vector3(this)
diDian.add(ForgeDirection.getOrientation(i))
val tileEntity: TileEntity = diDian.getTileEntity(worldObj)
if (!(tileEntity.isInstanceOf[TilePlasma]))
{
MinecraftForge.EVENT_BUS.post(new PlasmaEvent.SpawnPlasmaEvent(worldObj, diDian.xi, diDian.yi, diDian.zi, temperature.asInstanceOf[Int]))
}
}
}
}
}
def setTemperature(newTemperature: Int)
{
temperature = newTemperature
}
}

View file

@ -1,221 +0,0 @@
package resonantinduction.atomic.machine.plasma;
import cpw.mods.fml.common.network.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*;
import resonant.api.ITagRender;
import resonant.engine.ResonantEngine;
import resonant.lib.config.Config;
import resonant.lib.content.prefab.java.TileElectric;
import resonant.lib.network.discriminator.PacketTile;
import resonant.lib.network.discriminator.PacketType;
import resonant.lib.network.handle.IPacketReceiver;
import resonant.lib.utility.FluidUtility;
import resonant.lib.utility.LanguageUtility;
import resonantinduction.atomic.AtomicContent;
import universalelectricity.api.UnitDisplay;
import universalelectricity.core.transform.vector.Vector3;
import java.util.HashMap;
public class TilePlasmaHeater extends TileElectric implements IPacketReceiver, ITagRender, IFluidHandler
{
public static long joules = 10000000000L;
@Config
public static int plasmaHeatAmount = 100;
public final FluidTank tankInputDeuterium = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10);
public final FluidTank tankInputTritium = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10);
public final FluidTank tankOutput = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10);
public float rotation = 0;
public TilePlasmaHeater()
{
super(Material.iron);
energy().setCapacity(joules);
energy().setMaxTransfer(joules / 20);
normalRender(false);
isOpaqueCube(false);
}
@Override
public void update()
{
super.update();
rotation += energy().getEnergy() / 10000f;
if (!worldObj.isRemote)
{
if (energy().checkExtract())
{
// Creates plasma if there is enough Deuterium, Tritium AND Plasma output is not full.
if (tankInputDeuterium.getFluidAmount() >= plasmaHeatAmount &&
tankInputTritium.getFluidAmount() >= plasmaHeatAmount &&
tankOutput.getFluidAmount() < tankOutput.getCapacity())
{
tankInputDeuterium.drain(plasmaHeatAmount, true);
tankInputTritium.drain(plasmaHeatAmount, true);
tankOutput.fill(new FluidStack(AtomicContent.FLUID_PLASMA(), tankOutput.getCapacity()), true);
energy().extractEnergy();
}
}
}
if (ticks() % 80 == 0)
{
world().markBlockForUpdate(x(), y(), z());
//PacketHandler.sendPacketToClients(getDescriptionPacket(), worldObj, new Vector3(this), 25);
}
}
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(this, nbt));
}
@Override
public void read(ByteBuf data, EntityPlayer player, PacketType type)
{
try
{
readFromNBT(ByteBufUtils.readTag(data));
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Reads a tile entity from NBT.
*/
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
NBTTagCompound deuterium = nbt.getCompoundTag("tankInputDeuterium");
tankInputDeuterium.setFluid(FluidStack.loadFluidStackFromNBT(deuterium));
NBTTagCompound tritium = nbt.getCompoundTag("tankInputTritium");
tankInputTritium.setFluid(FluidStack.loadFluidStackFromNBT(tritium));
NBTTagCompound output = nbt.getCompoundTag("tankOutput");
tankOutput.setFluid(FluidStack.loadFluidStackFromNBT(output));
}
/**
* Writes a tile entity to NBT.
*/
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
if (tankInputDeuterium.getFluid() != null)
{
NBTTagCompound compound = new NBTTagCompound();
tankInputDeuterium.getFluid().writeToNBT(compound);
nbt.setTag("tankInputDeuterium", compound);
}
if (tankInputTritium.getFluid() != null)
{
NBTTagCompound compound = new NBTTagCompound();
tankInputTritium.getFluid().writeToNBT(compound);
nbt.setTag("tankInputTritium", compound);
}
if (tankOutput.getFluid() != null)
{
NBTTagCompound compound = new NBTTagCompound();
tankOutput.getFluid().writeToNBT(compound);
nbt.setTag("tankOutput", compound);
}
}
@Override
public float addInformation(HashMap<String, Integer> map, EntityPlayer player)
{
if (energy() != null)
{
map.put(LanguageUtility.getLocal("tooltip.energy") + ": " + new UnitDisplay(UnitDisplay.Unit.JOULES, energy().getEnergy()), 0xFFFFFF);
}
if (tankInputDeuterium.getFluidAmount() > 0)
{
map.put(LanguageUtility.getLocal("fluid.deuterium") + ": " + tankInputDeuterium.getFluidAmount() + " L", 0xFFFFFF);
}
if (tankInputTritium.getFluidAmount() > 0)
{
map.put(LanguageUtility.getLocal("fluid.tritium") + ": " + tankInputTritium.getFluidAmount() + " L", 0xFFFFFF);
}
if (tankOutput.getFluidAmount() > 0)
{
map.put(LanguageUtility.getLocal("fluid.plasma") + ": " + tankOutput.getFluidAmount() + " L", 0xFFFFFF);
}
return 1.5f;
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
if (resource.isFluidEqual(AtomicContent.FLUIDSTACK_DEUTERIUM()))
{
return tankInputDeuterium.fill(resource, doFill);
}
if (resource.isFluidEqual(AtomicContent.FLUIDSTACK_TRITIUM()))
{
return tankInputTritium.fill(resource, doFill);
}
return 0;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
return drain(from, resource.amount, doDrain);
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
return tankOutput.drain(maxDrain, doDrain);
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return fluid.getID() == AtomicContent.FLUID_DEUTERIUM().getID() || fluid.getID() == AtomicContent.FLUID_TRITIUM().getID();
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return fluid == AtomicContent.FLUID_PLASMA();
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
return new FluidTankInfo[]
{ tankInputDeuterium.getInfo(), tankInputTritium.getInfo(), tankOutput.getInfo() };
}
@Override
public boolean use(EntityPlayer player, int side, Vector3 hit)
{
return FluidUtility.playerActivatedFluidItem(world(), x(), y(), z(), player, side);
}
}

View file

@ -0,0 +1,192 @@
package resonantinduction.atomic.machine.plasma
import java.util.HashMap
import cpw.mods.fml.common.network.ByteBufUtils
import io.netty.buffer.ByteBuf
import net.minecraft.block.material.Material
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.network.Packet
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids._
import resonant.api.ITagRender
import resonant.engine.ResonantEngine
import resonant.lib.config.Config
import resonant.lib.content.prefab.java.TileElectric
import resonant.lib.network.discriminator.{PacketTile, PacketType}
import resonant.lib.network.handle.IPacketReceiver
import resonant.lib.utility.{FluidUtility, LanguageUtility}
import resonantinduction.atomic.AtomicContent
import universalelectricity.api.UnitDisplay
import universalelectricity.core.transform.vector.Vector3
object TilePlasmaHeater
{
var joules: Long = 10000000000L
@Config var plasmaHeatAmount: Int = 100
}
class TilePlasmaHeater(joules: Double) extends TileElectric(Material.iron) with IPacketReceiver with ITagRender with IFluidHandler
{
final val tankInputDeuterium: FluidTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10)
final val tankInputTritium: FluidTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10)
final val tankOutput: FluidTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 10)
var rotation: Float = 0
//Constructor
energy.setCapacity(joules)
energy.setMaxTransfer(joules / 20)
normalRender(false)
isOpaqueCube(false)
override def update
{
super.update
rotation = (rotation + energy.getEnergy / 10000f).asInstanceOf[Float]
if (!worldObj.isRemote)
{
if (energy.checkExtract)
{
if (tankInputDeuterium.getFluidAmount >= TilePlasmaHeater.plasmaHeatAmount && tankInputTritium.getFluidAmount >= TilePlasmaHeater.plasmaHeatAmount && tankOutput.getFluidAmount < tankOutput.getCapacity)
{
tankInputDeuterium.drain(TilePlasmaHeater.plasmaHeatAmount, true)
tankInputTritium.drain(TilePlasmaHeater.plasmaHeatAmount, true)
tankOutput.fill(new FluidStack(AtomicContent.FLUID_PLASMA, tankOutput.getCapacity), true)
energy.extractEnergy
}
}
}
if (ticks % 80 == 0)
{
world.markBlockForUpdate(x, y, z)
}
}
override def getDescriptionPacket: Packet =
{
val nbt: NBTTagCompound = new NBTTagCompound
writeToNBT(nbt)
return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(this, nbt))
}
def read(data: ByteBuf, player: EntityPlayer, `type`: PacketType)
{
try
{
readFromNBT(ByteBufUtils.readTag(data))
}
catch
{
case e: Exception =>
{
e.printStackTrace
}
}
}
/**
* Reads a tile entity from NBT.
*/
override def readFromNBT(nbt: NBTTagCompound)
{
super.readFromNBT(nbt)
val deuterium: NBTTagCompound = nbt.getCompoundTag("tankInputDeuterium")
tankInputDeuterium.setFluid(FluidStack.loadFluidStackFromNBT(deuterium))
val tritium: NBTTagCompound = nbt.getCompoundTag("tankInputTritium")
tankInputTritium.setFluid(FluidStack.loadFluidStackFromNBT(tritium))
val output: NBTTagCompound = nbt.getCompoundTag("tankOutput")
tankOutput.setFluid(FluidStack.loadFluidStackFromNBT(output))
}
/**
* Writes a tile entity to NBT.
*/
override def writeToNBT(nbt: NBTTagCompound)
{
super.writeToNBT(nbt)
if (tankInputDeuterium.getFluid != null)
{
val compound: NBTTagCompound = new NBTTagCompound
tankInputDeuterium.getFluid.writeToNBT(compound)
nbt.setTag("tankInputDeuterium", compound)
}
if (tankInputTritium.getFluid != null)
{
val compound: NBTTagCompound = new NBTTagCompound
tankInputTritium.getFluid.writeToNBT(compound)
nbt.setTag("tankInputTritium", compound)
}
if (tankOutput.getFluid != null)
{
val compound: NBTTagCompound = new NBTTagCompound
tankOutput.getFluid.writeToNBT(compound)
nbt.setTag("tankOutput", compound)
}
}
def addInformation(map: HashMap[String, Integer], player: EntityPlayer): Float =
{
if (energy != null)
{
map.put(LanguageUtility.getLocal("tooltip.energy") + ": " + new UnitDisplay(UnitDisplay.Unit.JOULES, energy.getEnergy), 0xFFFFFF)
}
if (tankInputDeuterium.getFluidAmount > 0)
{
map.put(LanguageUtility.getLocal("fluid.deuterium") + ": " + tankInputDeuterium.getFluidAmount + " L", 0xFFFFFF)
}
if (tankInputTritium.getFluidAmount > 0)
{
map.put(LanguageUtility.getLocal("fluid.tritium") + ": " + tankInputTritium.getFluidAmount + " L", 0xFFFFFF)
}
if (tankOutput.getFluidAmount > 0)
{
map.put(LanguageUtility.getLocal("fluid.plasma") + ": " + tankOutput.getFluidAmount + " L", 0xFFFFFF)
}
return 1.5f
}
def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean): Int =
{
if (resource.isFluidEqual(AtomicContent.FLUIDSTACK_DEUTERIUM))
{
return tankInputDeuterium.fill(resource, doFill)
}
if (resource.isFluidEqual(AtomicContent.FLUIDSTACK_TRITIUM))
{
return tankInputTritium.fill(resource, doFill)
}
return 0
}
def drain(from: ForgeDirection, resource: FluidStack, doDrain: Boolean): FluidStack =
{
return drain(from, resource.amount, doDrain)
}
def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack =
{
return tankOutput.drain(maxDrain, doDrain)
}
def canFill(from: ForgeDirection, fluid: Fluid): Boolean =
{
return fluid.getID == AtomicContent.FLUID_DEUTERIUM.getID || fluid.getID == AtomicContent.FLUID_TRITIUM.getID
}
def canDrain(from: ForgeDirection, fluid: Fluid): Boolean =
{
return fluid eq AtomicContent.FLUID_PLASMA
}
def getTankInfo(from: ForgeDirection): Array[FluidTankInfo] =
{
return Array[FluidTankInfo](tankInputDeuterium.getInfo, tankInputTritium.getInfo, tankOutput.getInfo)
}
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
{
return FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side)
}
}

View file

@ -186,25 +186,26 @@ class TileThermometer extends TileAdvanced(Material.piston) with SimpleComponent
} }
@Callback @Callback
@Optional.Method(modid = "OpenComputers") def getTemperature(context: Context, args: Arguments): Array[AnyRef] = @Optional.Method(modid = "OpenComputers")
def getTemperature(context: Context, args: Arguments): Array[Any] =
{ {
return Array[AnyRef](this.detectedTemperature) return Array[Any](this.detectedTemperature)
} }
@Callback @Callback
@Optional.Method(modid = "OpenComputers") def getWarningTemperature(context: Context, args: Arguments): Array[AnyRef] = @Optional.Method(modid = "OpenComputers") def getWarningTemperature(context: Context, args: Arguments): Array[Any] =
{ {
return Array[AnyRef](this.getThershold) return Array[Any](this.getThershold)
} }
@Callback @Callback
@Optional.Method(modid = "OpenComputers") def isAboveWarningTemperature(context: Context, args: Arguments): Array[AnyRef] = @Optional.Method(modid = "OpenComputers") def isAboveWarningTemperature(context: Context, args: Arguments): Array[Any] =
{ {
return Array[AnyRef](this.isOverThreshold) return Array[Any](this.isOverThreshold)
} }
@Callback @Callback
@Optional.Method(modid = "OpenComputers") def setWarningTemperature(context: Context, args: Arguments): Array[AnyRef] = @Optional.Method(modid = "OpenComputers") def setWarningTemperature(context: Context, args: Arguments): Array[Any] =
{ {
if (args.count <= 0) if (args.count <= 0)
{ {
@ -222,7 +223,7 @@ class TileThermometer extends TileAdvanced(Material.piston) with SimpleComponent
{ {
this.setThreshold(args.checkInteger(0)) this.setThreshold(args.checkInteger(0))
} }
return Array[AnyRef](this.threshold == args.checkInteger(0)) return Array[Any](this.threshold == args.checkInteger(0))
} }
def getComponentName: String = def getComponentName: String =