diff --git a/src/net/bdew/lib/block/HasTE.scala b/src/net/bdew/lib/block/HasTE.scala index caa844c..89ca24c 100644 --- a/src/net/bdew/lib/block/HasTE.scala +++ b/src/net/bdew/lib/block/HasTE.scala @@ -16,14 +16,15 @@ import net.bdew.lib.BdLib trait HasTE[T] extends Block with ITileEntityProvider { val TEClass: Class[_ <: TileEntity] - def createNewTileEntity(world: World): TileEntity = TEClass.newInstance() + + def createNewTileEntity(world: World, meta: Int): TileEntity = TEClass.newInstance() def getTE(w: IBlockAccess, x: Int, y: Int, z: Int): T = { var t = w.getTileEntity(x, y, z) if ((t == null) || !TEClass.isInstance(t)) { BdLib.logError("Tile entity for block %s at (%d,%d,%d) is corrupt or missing - recreating", this, x, y, z) w match { case ww: World => - t = createNewTileEntity(ww) + t = createNewTileEntity(ww, w.getBlockMetadata(x, y, z)) ww.setTileEntity(x, y, z, t) case _ => sys.error("Unable to recreate TE") diff --git a/src/net/bdew/lib/config/BlockManager.scala b/src/net/bdew/lib/config/BlockManager.scala index 24d022a..2562173 100644 --- a/src/net/bdew/lib/config/BlockManager.scala +++ b/src/net/bdew/lib/config/BlockManager.scala @@ -17,7 +17,7 @@ import net.bdew.lib.block.HasTE class BlockManager() { def regBlockCls[T <: Block](blockCls: Class[T], name: String, addStack: Boolean = true): T = { - val block = blockCls.getConstructor(classOf[Int]).newInstance() + val block = blockCls.newInstance() regBlock[T](block, name, addStack) } diff --git a/src/net/bdew/lib/config/ItemManager.scala b/src/net/bdew/lib/config/ItemManager.scala index 14db44a..3d09e94 100644 --- a/src/net/bdew/lib/config/ItemManager.scala +++ b/src/net/bdew/lib/config/ItemManager.scala @@ -19,7 +19,7 @@ class ItemManager() { def regItem[T <: SimpleItem](item: T): T = regItem[T](item, item.name) def regItemCls[T <: Item](itemCls: Class[T], name: String, addStack: Boolean = true): T = { - val item = itemCls.getConstructor(classOf[Int]).newInstance() + val item = itemCls.newInstance() regItem[T](item, name, addStack) } diff --git a/src/net/bdew/lib/tile/inventory/BaseInventory.scala b/src/net/bdew/lib/tile/inventory/BaseInventory.scala index 389af40..049971c 100644 --- a/src/net/bdew/lib/tile/inventory/BaseInventory.scala +++ b/src/net/bdew/lib/tile/inventory/BaseInventory.scala @@ -18,29 +18,29 @@ trait BaseInventory extends IInventory { def getStackInSlot(i: Int): ItemStack = inv(i) - def getInvName = "" + def getInventoryName = "" - def isInvNameLocalized = false + def hasCustomInventoryName = false def getInventoryStackLimit = 64 def isUseableByPlayer(player: EntityPlayer) = true - def openChest() = Unit + def openInventory() {} - def closeChest() = Unit + def closeInventory() {} def isItemValidForSlot(slot: Int, stack: ItemStack) = true def decrStackSize(slot: Int, n: Int): ItemStack = { - var item = inv(slot) + val item = inv(slot) if (item != null) { if (item.stackSize <= n) { inv(slot) = null markDirty() return item } else { - var newstack = item.splitStack(n) + val newstack = item.splitStack(n) if (item.stackSize == 0) { inv(slot) = null }