mirror of
https://github.com/GTNewHorizons/gendustry.git
synced 2026-11-24 22:14:22 +00:00
Added liquifier and extractor
This commit is contained in:
1 parent
b84f8849ef
commit
04dc8dd8aa
20 files changed
+459
No files matched your search
@@ -114,6 +114,29 @@ cfg Machines {
|
||||
|
||||
BaseMjPerTick = 2 // Base run cost in MJ/t, before any modifiers
|
||||
}
|
||||
|
||||
cfg Extractor {
|
||||
Enabled = Yes
|
||||
MaxReceivedEnergy = 500
|
||||
PowerUseRate = 0.001
|
||||
MjPerItem = 80000
|
||||
MaxStoredEnergy = 400000
|
||||
ActivationEnergy = 40
|
||||
|
||||
TankSize = 5000 // Output tank size in milibuckets
|
||||
LabwareConsumeChance = 10 // Chance that the Genetic Labware will be consumed, 0-100
|
||||
}
|
||||
|
||||
cfg Liquifier {
|
||||
Enabled = Yes
|
||||
MaxReceivedEnergy = 500
|
||||
PowerUseRate = 0.002
|
||||
MjPerItem = 20000
|
||||
MaxStoredEnergy = 100000
|
||||
ActivationEnergy = 20
|
||||
|
||||
TankSize = 5000 // Output tank size in milibuckets
|
||||
}
|
||||
}
|
||||
|
||||
cfg Items {
|
||||
|
||||
@@ -6,6 +6,8 @@ tile.gendustry.mutatron.adv.name=Advanced Mutatron
|
||||
tile.gendustry.apiary.name=Industrial Apiary
|
||||
tile.gendustry.imprinter.name=Genetic Imprinter
|
||||
tile.gendustry.sampler.name=Genetic Sampler
|
||||
tile.gendustry.extractor.name=DNA Extractor
|
||||
tile.gendustry.liquifier.name=Protein Liquifier
|
||||
|
||||
# ==== GENERAL ITEMS ====
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 494 B |
@@ -17,6 +17,8 @@ import net.bdew.gendustry.machines.sampler.MachineSampler
|
||||
import net.bdew.lib.config.MachineManager
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.gendustry.machines.advmutatron.MachineMutatronAdv
|
||||
import net.bdew.gendustry.machines.liquifier.MachineLiquifier
|
||||
import net.bdew.gendustry.machines.extractor.MachineExtractor
|
||||
|
||||
object Machines extends MachineManager(Config.IDs, Tuning.getSection("Machines"), Config.guiHandler) {
|
||||
val mutagenProducer = registerMachine(new MachineMutagenProducer)
|
||||
@@ -25,6 +27,8 @@ object Machines extends MachineManager(Config.IDs, Tuning.getSection("Machines")
|
||||
val imprinter = registerMachine(new MachineImprinter)
|
||||
val sampler = registerMachine(new MachineSampler)
|
||||
val mutatronAdv = registerMachine(new MachineMutatronAdv)
|
||||
val liquifier = registerMachine(new MachineLiquifier)
|
||||
val extractor = registerMachine(new MachineExtractor)
|
||||
|
||||
Gendustry.logInfo("Machines loaded")
|
||||
}
|
||||
@@ -26,4 +26,5 @@ object HintIcons extends IconPreloader(1) {
|
||||
val drone = TextureLoc("gendustry:hints/drone")
|
||||
|
||||
val upgrade = TextureLoc("gendustry:hints/upgrade")
|
||||
val meat = TextureLoc("gendustry:hints/meat")
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.extractor
|
||||
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.material.Material
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.util.Icon
|
||||
import cpw.mods.fml.relauncher.Side
|
||||
import cpw.mods.fml.relauncher.SideOnly
|
||||
import net.bdew.lib.block.HasTE
|
||||
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
|
||||
import net.bdew.gendustry.config.Machines
|
||||
import net.bdew.gendustry.gui.BlockGuiWrenchable
|
||||
|
||||
class BlockExtractor(id: Int) extends Block(id, Material.rock) with HasTE[TileExtractor] with BreakableInventoryBlock with BlockGuiWrenchable {
|
||||
private var icons: Array[Icon] = null
|
||||
val TEClass = classOf[TileExtractor]
|
||||
lazy val guiId = Machines.extractor.guiId
|
||||
|
||||
setUnlocalizedName(Gendustry.modId + ".extractor")
|
||||
setHardness(5)
|
||||
|
||||
override def getIcon(side: Int, meta: Int): Icon = {
|
||||
side match {
|
||||
case 0 =>
|
||||
return icons(0)
|
||||
case 1 =>
|
||||
return icons(1)
|
||||
case _ =>
|
||||
return icons(2)
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(reg: IconRegister) {
|
||||
icons = new Array[Icon](3)
|
||||
icons(0) = reg.registerIcon(Gendustry.modId + ":extractor/bottom")
|
||||
icons(1) = reg.registerIcon(Gendustry.modId + ":extractor/top")
|
||||
icons(2) = reg.registerIcon(Gendustry.modId + ":extractor/side")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.extractor
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.bdew.lib.gui.{BaseContainer, SlotValidating}
|
||||
import net.bdew.lib.data.base.ContainerDataSlots
|
||||
|
||||
class ContainerExtractor(val te: TileExtractor, player: EntityPlayer) extends BaseContainer(te) with ContainerDataSlots {
|
||||
lazy val dataSource = te
|
||||
|
||||
addSlotToContainer(new SlotValidating(te, te.slots.inIndividual, 44, 41))
|
||||
addSlotToContainer(new SlotValidating(te, te.slots.inLabware, 94, 19))
|
||||
bindPlayerInventory(player.inventory, 8, 84, 142)
|
||||
|
||||
def canInteractWith(entityplayer: EntityPlayer): Boolean = te.isUseableByPlayer(entityplayer)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.extractor
|
||||
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.bdew.lib.gui.{Texture, Color, Rect, BaseScreen}
|
||||
import net.bdew.lib.gui.widgets.{WidgetLabel, WidgetFluidGauge}
|
||||
import net.bdew.lib.Misc
|
||||
import net.bdew.gendustry.gui.{HintIcons, WidgetPowerCustom, WidgetProgressBarNEI, Textures}
|
||||
|
||||
class GuiExtractor(val te: TileExtractor, player: EntityPlayer) extends BaseScreen(new ContainerExtractor(te, player), 176, 166) {
|
||||
val background = Texture(Gendustry.modId, "textures/gui/extractor.png", rect)
|
||||
|
||||
override def initGui() {
|
||||
super.initGui()
|
||||
widgets.add(new WidgetProgressBarNEI(new Rect(79, 41, 53, 15), Textures.greenProgress(53), te.progress, "Extractor"))
|
||||
widgets.add(new WidgetPowerCustom(new Rect(8, 19, 16, 58), Textures.powerFill, te.power))
|
||||
widgets.add(new WidgetFluidGauge(new Rect(152, 19, 16, 58), Textures.tankOverlay, te.tank))
|
||||
widgets.add(new WidgetLabel(Misc.toLocal("tile.gendustry.extractor.name"), 8, 6, Color.darkgray))
|
||||
|
||||
inventorySlots.getSlotFromInventory(te, te.slots.inIndividual).setBackgroundIcon(HintIcons.droneOrSapling)
|
||||
inventorySlots.getSlotFromInventory(te, te.slots.inLabware).setBackgroundIcon(HintIcons.labware)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.extractor
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import cpw.mods.fml.relauncher.{SideOnly, Side}
|
||||
import net.bdew.lib.machine.{Machine, ProcessorMachine}
|
||||
import net.bdew.lib.gui.GuiProvider
|
||||
|
||||
class MachineExtractor extends Machine("Extractor", new BlockExtractor(_)) with GuiProvider with ProcessorMachine {
|
||||
def guiId = 8
|
||||
type TEClass = TileExtractor
|
||||
|
||||
lazy val tankSize = tuning.getInt("TankSize")
|
||||
lazy val labwareConsumeChance = tuning.getInt("LabwareConsumeChance")
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def getGui(te: TileExtractor, player: EntityPlayer) = new GuiExtractor(te, player)
|
||||
def getContainer(te: TileExtractor, player: EntityPlayer) = new ContainerExtractor(te, player)
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.extractor
|
||||
|
||||
import net.bdew.gendustry.config.{Items, Fluids, Machines}
|
||||
import net.bdew.gendustry.fluids.LiquidDNASources
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import net.bdew.lib.data._
|
||||
import net.bdew.lib.tile.ExposeTank
|
||||
import net.bdew.lib.data.base.UpdateKind
|
||||
import net.bdew.lib.power.TileBaseProcessor
|
||||
import net.bdew.gendustry.power.TilePowered
|
||||
|
||||
class TileExtractor extends TileBaseProcessor with TilePowered with ExposeTank {
|
||||
lazy val cfg = Machines.extractor
|
||||
|
||||
object slots {
|
||||
val inIndividual = 0
|
||||
val inLabware = 1
|
||||
}
|
||||
|
||||
val tank = DataSlotTankRestricted("tank", this, cfg.tankSize, Fluids.dna.getID).setUpdate(UpdateKind.GUI, UpdateKind.SAVE)
|
||||
val output = DataSlotInt("output", this).setUpdate(UpdateKind.SAVE)
|
||||
|
||||
def getSizeInventory = 2
|
||||
|
||||
def getTankFromDirection(dir: ForgeDirection): IFluidTank = tank
|
||||
|
||||
def isWorking = output > 0
|
||||
|
||||
def tryStart(): Boolean = {
|
||||
if (getStackInSlot(slots.inIndividual) != null && getStackInSlot(slots.inLabware) != null) {
|
||||
output := LiquidDNASources.getValue(getStackInSlot(0))
|
||||
if (worldObj.rand.nextInt(100) < cfg.labwareConsumeChance)
|
||||
decrStackSize(slots.inLabware, 1)
|
||||
decrStackSize(0, 1)
|
||||
return true
|
||||
} else return false
|
||||
}
|
||||
|
||||
def tryFinish(): Boolean = {
|
||||
if (tank.fill(output, false) == output.cval) {
|
||||
tank.fill(output, true)
|
||||
output := -1
|
||||
return true
|
||||
} else return false
|
||||
}
|
||||
|
||||
def sendFluid() {
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS) {
|
||||
val te: TileEntity = worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
|
||||
if (te != null && te.isInstanceOf[IFluidHandler]) {
|
||||
val pumped = te.asInstanceOf[IFluidHandler].fill(dir.getOpposite, tank.getFluid, true)
|
||||
if (pumped > 0) {
|
||||
tank.drain(pumped, true)
|
||||
if (tank.getFluidAmount <= 0) return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override def tickServer() {
|
||||
super.tickServer()
|
||||
if (tank.getFluidAmount > 0) sendFluid()
|
||||
}
|
||||
|
||||
allowSided = true
|
||||
override def isItemValidForSlot(slot: Int, itemstack: ItemStack): Boolean = slot match {
|
||||
case slots.inIndividual => LiquidDNASources.getValue(itemstack) > 0
|
||||
case slots.inLabware => itemstack.getItem == Items.labware
|
||||
case _ => false
|
||||
}
|
||||
override def canExtractItem(slot: Int, item: ItemStack, side: Int): Boolean = false
|
||||
|
||||
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean) = 0
|
||||
override def canFill(from: ForgeDirection, fluid: Fluid) = false
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.liquifier
|
||||
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.material.Material
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.util.Icon
|
||||
import cpw.mods.fml.relauncher.Side
|
||||
import cpw.mods.fml.relauncher.SideOnly
|
||||
import net.bdew.lib.block.HasTE
|
||||
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
|
||||
import net.bdew.gendustry.config.Machines
|
||||
import net.bdew.gendustry.gui.BlockGuiWrenchable
|
||||
|
||||
class BlockLiquifier(id: Int) extends Block(id, Material.rock) with HasTE[TileLiquifier] with BreakableInventoryBlock with BlockGuiWrenchable {
|
||||
private var icons: Array[Icon] = null
|
||||
val TEClass = classOf[TileLiquifier]
|
||||
lazy val guiId = Machines.liquifier.guiId
|
||||
|
||||
setUnlocalizedName(Gendustry.modId + ".liquifier")
|
||||
setHardness(5)
|
||||
|
||||
override def getIcon(side: Int, meta: Int): Icon = {
|
||||
side match {
|
||||
case 0 =>
|
||||
return icons(0)
|
||||
case 1 =>
|
||||
return icons(1)
|
||||
case _ =>
|
||||
return icons(2)
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(reg: IconRegister) {
|
||||
icons = new Array[Icon](3)
|
||||
icons(0) = reg.registerIcon(Gendustry.modId + ":liquifier/bottom")
|
||||
icons(1) = reg.registerIcon(Gendustry.modId + ":liquifier/top")
|
||||
icons(2) = reg.registerIcon(Gendustry.modId + ":liquifier/side")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.liquifier
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.bdew.lib.gui.{BaseContainer, SlotValidating}
|
||||
import net.bdew.lib.data.base.ContainerDataSlots
|
||||
|
||||
class ContainerLiquifier(val te: TileLiquifier, player: EntityPlayer) extends BaseContainer(te) with ContainerDataSlots {
|
||||
lazy val dataSource = te
|
||||
|
||||
addSlotToContainer(new SlotValidating(te, te.slots.inMeat, 44, 41))
|
||||
bindPlayerInventory(player.inventory, 8, 84, 142)
|
||||
|
||||
def canInteractWith(entityplayer: EntityPlayer): Boolean = te.isUseableByPlayer(entityplayer)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.liquifier
|
||||
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.bdew.lib.gui.{Texture, Color, Rect, BaseScreen}
|
||||
import net.bdew.lib.gui.widgets.{WidgetLabel, WidgetFluidGauge}
|
||||
import net.bdew.lib.Misc
|
||||
import net.bdew.gendustry.gui.{HintIcons, WidgetPowerCustom, WidgetProgressBarNEI, Textures}
|
||||
|
||||
class GuiLiquifier(val te: TileLiquifier, player: EntityPlayer) extends BaseScreen(new ContainerLiquifier(te, player), 176, 166) {
|
||||
val background = Texture(Gendustry.modId, "textures/gui/liquifier.png", rect)
|
||||
|
||||
override def initGui() {
|
||||
super.initGui()
|
||||
widgets.add(new WidgetProgressBarNEI(new Rect(79, 41, 53, 15), Textures.greenProgress(53), te.progress, "Liquifier"))
|
||||
widgets.add(new WidgetPowerCustom(new Rect(8, 19, 16, 58), Textures.powerFill, te.power))
|
||||
widgets.add(new WidgetFluidGauge(new Rect(152, 19, 16, 58), Textures.tankOverlay, te.tank))
|
||||
widgets.add(new WidgetLabel(Misc.toLocal("tile.gendustry.liquifier.name"), 8, 6, Color.darkgray))
|
||||
|
||||
inventorySlots.getSlotFromInventory(te, te.slots.inMeat).setBackgroundIcon(HintIcons.meat)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.liquifier
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import cpw.mods.fml.relauncher.{SideOnly, Side}
|
||||
import net.bdew.lib.machine.{Machine, ProcessorMachine}
|
||||
import net.bdew.lib.gui.GuiProvider
|
||||
|
||||
class MachineLiquifier extends Machine("Liquifier", new BlockLiquifier(_)) with GuiProvider with ProcessorMachine {
|
||||
def guiId = 7
|
||||
type TEClass = TileLiquifier
|
||||
|
||||
lazy val tankSize = tuning.getInt("TankSize")
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def getGui(te: TileLiquifier, player: EntityPlayer) = new GuiLiquifier(te, player)
|
||||
def getContainer(te: TileLiquifier, player: EntityPlayer) = new ContainerLiquifier(te, player)
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.machines.liquifier
|
||||
|
||||
import net.bdew.gendustry.config.{Fluids, Machines}
|
||||
import net.bdew.gendustry.fluids.ProteinSources
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.fluids._
|
||||
import net.bdew.lib.data._
|
||||
import net.bdew.lib.tile.ExposeTank
|
||||
import net.bdew.lib.data.base.UpdateKind
|
||||
import net.bdew.lib.power.TileBaseProcessor
|
||||
import net.bdew.gendustry.power.TilePowered
|
||||
|
||||
class TileLiquifier extends TileBaseProcessor with TilePowered with ExposeTank {
|
||||
lazy val cfg = Machines.liquifier
|
||||
|
||||
val tank = DataSlotTankRestricted("tank", this, cfg.tankSize, Fluids.protein.getID).setUpdate(UpdateKind.GUI, UpdateKind.SAVE)
|
||||
val output = DataSlotInt("output", this).setUpdate(UpdateKind.SAVE)
|
||||
|
||||
object slots {
|
||||
val inMeat = 0
|
||||
}
|
||||
|
||||
def getSizeInventory = 1
|
||||
|
||||
def getTankFromDirection(dir: ForgeDirection): IFluidTank = tank
|
||||
|
||||
def isWorking = output > 0
|
||||
def tryStart(): Boolean = {
|
||||
if (getStackInSlot(slots.inMeat) != null) {
|
||||
output := ProteinSources.getValue(getStackInSlot(0))
|
||||
decrStackSize(slots.inMeat, 1)
|
||||
return true
|
||||
} else return false
|
||||
}
|
||||
|
||||
def tryFinish(): Boolean = {
|
||||
if (tank.fill(output, false) == output.cval) {
|
||||
tank.fill(output, true)
|
||||
output := -1
|
||||
return true
|
||||
} else return false
|
||||
}
|
||||
|
||||
def sendFluid() {
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS) {
|
||||
val te: TileEntity = worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
|
||||
if (te != null && te.isInstanceOf[IFluidHandler]) {
|
||||
val pumped = te.asInstanceOf[IFluidHandler].fill(dir.getOpposite, tank.getFluid, true)
|
||||
if (pumped > 0) {
|
||||
tank.drain(pumped, true)
|
||||
if (tank.getFluidAmount <= 0) return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override def tickServer() {
|
||||
super.tickServer()
|
||||
if (tank.getFluidAmount > 0) sendFluid()
|
||||
}
|
||||
|
||||
allowSided = true
|
||||
override def isItemValidForSlot(slot: Int, itemstack: ItemStack): Boolean = ProteinSources.getValue(itemstack) > 0
|
||||
override def canExtractItem(slot: Int, item: ItemStack, side: Int): Boolean = false
|
||||
|
||||
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean) = 0
|
||||
override def canFill(from: ForgeDirection, fluid: Fluid) = false
|
||||
}
|
||||
Reference in new issue
Block a user