diff --git a/src/net/bdew/lib/Misc.scala b/src/net/bdew/lib/Misc.scala index a1d9a51..06b56a4 100644 --- a/src/net/bdew/lib/Misc.scala +++ b/src/net/bdew/lib/Misc.scala @@ -108,11 +108,19 @@ object Misc { def nextInSeq[T](seq: Seq[T], elem: T) = { val pos = seq.indexOf(elem) if (pos < 0 || pos == seq.size - 1) - seq(0) + seq.head else seq(pos + 1) } + def prevInSeq[T](seq: Seq[T], elem: T) = { + val pos = seq.indexOf(elem) + if (pos <= 0) + seq.last + else + seq(pos - 1) + } + def getFluidIcon(fs: FluidStack): IIcon = if (fs != null && fs.getFluid != null && fs.getFluid.getIcon != null) fs.getFluid.getIcon(fs) diff --git a/src/net/bdew/lib/tile/inventory/SimpleInventory.scala b/src/net/bdew/lib/tile/inventory/SimpleInventory.scala new file mode 100644 index 0000000..64594c2 --- /dev/null +++ b/src/net/bdew/lib/tile/inventory/SimpleInventory.scala @@ -0,0 +1,15 @@ +/* + * Copyright (c) bdew, 2013 - 2015 + * https://github.com/bdew/bdlib + * + * 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 + * http://bdew.net/minecraft-mod-public-license/ + */ + +package net.bdew.lib.tile.inventory + +class SimpleInventory(size: Int) extends BaseInventory { + override def getSizeInventory = size + override def markDirty() = {} +}