Added an HDD to tablet for testing.

This commit is contained in:
Florian Nücke 2014-07-22 16:48:27 +02:00
parent 56be86f17e
commit b718f22c9c
2 changed files with 12 additions and 15 deletions

View File

@ -3,5 +3,5 @@ forge.version=9.11.1.964
oc.version=1.3.2 oc.version=1.3.2
oc.subversion=dev oc.subversion=dev
ccl.version=1.0.0.62 ccl.version=1.0.0.62
fmp.version=1.0.0.250 fmp.version=1.0.1.268
maven.url=file:///var/www/users/fnuecke/maven.cil.li maven.url=file:///var/www/users/fnuecke/maven.cil.li

View File

@ -41,7 +41,7 @@ class Tablet(val parent: Delegator) extends Delegate {
} }
} }
class TabletWrapper(val stack: ItemStack, var holder: Entity) extends ComponentInventory with Container with Owner { class TabletWrapper(var stack: ItemStack, var holder: Entity) extends ComponentInventory with Container with Owner {
lazy val computer = if (holder.worldObj.isRemote) null else Machine.create(this) lazy val computer = if (holder.worldObj.isRemote) null else Machine.create(this)
val items = Array( val items = Array(
@ -53,6 +53,7 @@ class TabletWrapper(val stack: ItemStack, var holder: Entity) extends ComponentI
Option(api.Items.get("batteryUpgrade2").createItemStack(1)), Option(api.Items.get("batteryUpgrade2").createItemStack(1)),
Option(api.Items.get("navigationUpgrade").createItemStack(1)), Option(api.Items.get("navigationUpgrade").createItemStack(1)),
Option(api.Items.get("openOS").createItemStack(1)), Option(api.Items.get("openOS").createItemStack(1)),
Option(api.Items.get("hdd1").createItemStack(1)),
Option(api.Items.get("wlanCard").createItemStack(1)) Option(api.Items.get("wlanCard").createItemStack(1))
) )
@ -230,7 +231,7 @@ object Tablet extends Callable[TabletWrapper] with RemovalListener[String, Table
private var currentHolder: Entity = _ private var currentHolder: Entity = _
def get(stack: ItemStack, holder: Entity) = clientCache.synchronized { def get(stack: ItemStack, holder: Entity) = (if (holder.worldObj.isRemote) clientCache else serverCache).synchronized {
currentStack = stack currentStack = stack
currentHolder = holder currentHolder = holder
if (!stack.hasTagCompound) { if (!stack.hasTagCompound) {
@ -240,18 +241,14 @@ object Tablet extends Callable[TabletWrapper] with RemovalListener[String, Table
stack.getTagCompound.setString(Settings.namespace + "tablet", UUID.randomUUID().toString) stack.getTagCompound.setString(Settings.namespace + "tablet", UUID.randomUUID().toString)
} }
val id = stack.getTagCompound.getString(Settings.namespace + "tablet") val id = stack.getTagCompound.getString(Settings.namespace + "tablet")
val wrapper =
if (holder.worldObj.isRemote) if (holder.worldObj.isRemote)
clientCache.get(id, this) clientCache.get(id, this)
else else
serverCache.get(id, this) serverCache.get(id, this)
} wrapper.stack = stack
wrapper.holder = holder
def get(stack: ItemStack) = clientCache.synchronized { wrapper
if (stack.hasTagCompound && stack.getTagCompound.hasKey(Settings.namespace + "tablet")) {
val id = stack.getTagCompound.getString(Settings.namespace + "tablet")
Option(clientCache.getIfPresent(id))
}
else None
} }
def call = { def call = {