mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-11-12 08:17:37 +00:00
Added Misc.prevInSeq, Added SimpleInventory
This commit is contained in:
1 parent
dc59ee3d31
commit
6439ef8f08
2 files changed
+24
-1
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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() = {}
|
||||
}
|
||||
Reference in new issue
Block a user