From db36d0103241bdb04957c20d565232b79ad0fd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sun, 3 Jan 2016 12:22:24 +0100 Subject: [PATCH] Fixed all file system speeds being off by one, causing raid to be broken. Fixed potential NPE while loading, leading to raids losing their contents e.g. --- .../scala/li/cil/oc/integration/opencomputers/DriverAPU.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverDataCard.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverDebugCard.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverEEPROM.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverFileSystem.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverGeolyzer.scala | 2 +- .../cil/oc/integration/opencomputers/DriverGraphicsCard.scala | 2 +- .../cil/oc/integration/opencomputers/DriverInternetCard.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverLinkedCard.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverNetworkCard.scala | 2 +- .../cil/oc/integration/opencomputers/DriverRedstoneCard.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverTablet.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverTransposer.scala | 2 +- .../cil/oc/integration/opencomputers/DriverUpgradeAngel.scala | 2 +- .../cil/oc/integration/opencomputers/DriverUpgradeBattery.scala | 2 +- .../oc/integration/opencomputers/DriverUpgradeChunkloader.scala | 2 +- .../oc/integration/opencomputers/DriverUpgradeCrafting.scala | 2 +- .../oc/integration/opencomputers/DriverUpgradeDatabase.scala | 2 +- .../oc/integration/opencomputers/DriverUpgradeGenerator.scala | 2 +- .../opencomputers/DriverUpgradeInventoryController.scala | 2 +- .../cil/oc/integration/opencomputers/DriverUpgradeLeash.scala | 2 +- .../oc/integration/opencomputers/DriverUpgradeNavigation.scala | 2 +- .../cil/oc/integration/opencomputers/DriverUpgradePiston.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverUpgradeSign.scala | 2 +- .../integration/opencomputers/DriverUpgradeSolarGenerator.scala | 2 +- .../li/cil/oc/integration/opencomputers/DriverUpgradeTank.scala | 2 +- .../integration/opencomputers/DriverUpgradeTankController.scala | 2 +- .../oc/integration/opencomputers/DriverUpgradeTractorBeam.scala | 2 +- .../integration/opencomputers/DriverWirelessNetworkCard.scala | 2 +- src/main/scala/li/cil/oc/server/fs/FileSystem.scala | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverAPU.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverAPU.scala index 93d50cba2..f1a9329d6 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverAPU.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverAPU.scala @@ -18,7 +18,7 @@ object DriverAPU extends DriverCPU with HostAware { api.Items.get(Constants.ItemName.APUCreative)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else gpuTier(stack) match { case Tier.One => new component.GraphicsCard(Tier.One) case Tier.Two => new component.GraphicsCard(Tier.Two) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverDataCard.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverDataCard.scala index 93ec318b1..9d32c6290 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverDataCard.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverDataCard.scala @@ -18,7 +18,7 @@ object DriverDataCard extends Item { api.Items.get(Constants.ItemName.DataCardTier3)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else tier(stack) match { case Tier.One => new component.DataCard.Tier1() case Tier.Two => new component.DataCard.Tier2() diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverDebugCard.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverDebugCard.scala index d3a060c7c..c469c7be9 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverDebugCard.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverDebugCard.scala @@ -13,7 +13,7 @@ object DriverDebugCard extends Item { api.Items.get(Constants.ItemName.DebugCard)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.DebugCard(host) override def slot(stack: ItemStack) = Slot.Card diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverEEPROM.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverEEPROM.scala index a8542ea10..fa309c537 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverEEPROM.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverEEPROM.scala @@ -14,7 +14,7 @@ object DriverEEPROM extends Item { api.Items.get(Constants.ItemName.EEPROM)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.EEPROM() override def slot(stack: ItemStack) = Slot.EEPROM diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverFileSystem.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverFileSystem.scala index 12ddbafc4..e64d8b280 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverFileSystem.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverFileSystem.scala @@ -24,7 +24,7 @@ object DriverFileSystem extends Item { api.Items.get(Constants.ItemName.Floppy)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else Delegator.subItem(stack) match { case Some(hdd: HardDiskDrive) => createEnvironment(stack, hdd.kiloBytes * 1024, hdd.platterCount, host, hdd.tier + 2) case Some(disk: FloppyDisk) => createEnvironment(stack, Settings.get.floppySize * 1024, 1, host, 1) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverGeolyzer.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverGeolyzer.scala index ba9f85619..afa811ee1 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverGeolyzer.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverGeolyzer.scala @@ -14,7 +14,7 @@ object DriverGeolyzer extends Item with HostAware { api.Items.get(Constants.BlockName.Geolyzer)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.Geolyzer(host) override def slot(stack: ItemStack) = Slot.Upgrade diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverGraphicsCard.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverGraphicsCard.scala index 258451ce1..bc9f3a477 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverGraphicsCard.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverGraphicsCard.scala @@ -19,7 +19,7 @@ object DriverGraphicsCard extends Item with HostAware { api.Items.get(Constants.ItemName.GraphicsCardTier3)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else tier(stack) match { case Tier.One => new component.GraphicsCard(Tier.One) case Tier.Two => new component.GraphicsCard(Tier.Two) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverInternetCard.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverInternetCard.scala index e5e3b805d..e4a718bb1 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverInternetCard.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverInternetCard.scala @@ -14,7 +14,7 @@ object DriverInternetCard extends Item { api.Items.get(Constants.ItemName.InternetCard)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.InternetCard() override def slot(stack: ItemStack) = Slot.Card diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverLinkedCard.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverLinkedCard.scala index b75057609..e83a08d5c 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverLinkedCard.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverLinkedCard.scala @@ -14,7 +14,7 @@ object DriverLinkedCard extends Item { api.Items.get(Constants.ItemName.LinkedCard)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.LinkedCard() override def slot(stack: ItemStack) = Slot.Card diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverNetworkCard.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverNetworkCard.scala index a7d768d35..70fd0ca61 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverNetworkCard.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverNetworkCard.scala @@ -14,7 +14,7 @@ object DriverNetworkCard extends Item with HostAware { api.Items.get(Constants.ItemName.NetworkCard)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.NetworkCard(host) override def slot(stack: ItemStack) = Slot.Card diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverRedstoneCard.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverRedstoneCard.scala index 021eb0cc7..c856b60e3 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverRedstoneCard.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverRedstoneCard.scala @@ -22,7 +22,7 @@ object DriverRedstoneCard extends Item with HostAware { api.Items.get(Constants.ItemName.RedstoneCardTier2)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else { val isAdvanced = tier(stack) == Tier.Two val hasBundled = BundledRedstone.isAvailable && isAdvanced diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverTablet.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverTablet.scala index 05450c3a0..594ee66e9 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverTablet.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverTablet.scala @@ -18,7 +18,7 @@ object DriverTablet extends Item { api.Items.get(Constants.ItemName.Tablet)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else { Tablet.Server.cache.invalidate(Tablet.getId(stack)) val data = new TabletData(stack) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverTransposer.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverTransposer.scala index 312d21533..a2637d104 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverTransposer.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverTransposer.scala @@ -14,7 +14,7 @@ object DriverTransposer extends Item with HostAware { api.Items.get(Constants.BlockName.Transposer)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.Transposer.Upgrade(host) override def slot(stack: ItemStack) = Slot.Upgrade diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeAngel.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeAngel.scala index fee751801..3f7a1013e 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeAngel.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeAngel.scala @@ -14,7 +14,7 @@ object DriverUpgradeAngel extends Item with HostAware { api.Items.get(Constants.ItemName.AngelUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.UpgradeAngel() override def slot(stack: ItemStack) = Slot.Upgrade diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeBattery.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeBattery.scala index 9d0c73861..ce2ba4f6f 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeBattery.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeBattery.scala @@ -18,7 +18,7 @@ object DriverUpgradeBattery extends Item with HostAware { api.Items.get(Constants.ItemName.BatteryUpgradeTier3)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.UpgradeBattery(tier(stack)) override def slot(stack: ItemStack) = Slot.Upgrade diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeChunkloader.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeChunkloader.scala index 4d724aeb9..36532b63b 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeChunkloader.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeChunkloader.scala @@ -15,7 +15,7 @@ object DriverUpgradeChunkloader extends Item with HostAware { api.Items.get(Constants.ItemName.ChunkloaderUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.UpgradeChunkloader(host) override def slot(stack: ItemStack) = Slot.Upgrade diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeCrafting.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeCrafting.scala index a416320d5..6fab0a16f 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeCrafting.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeCrafting.scala @@ -16,7 +16,7 @@ object DriverUpgradeCrafting extends Item with HostAware { api.Items.get(Constants.ItemName.CraftingUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case robot: EnvironmentHost with Robot => new component.UpgradeCrafting(robot) case _ => null diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeDatabase.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeDatabase.scala index 2193da500..eec6918df 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeDatabase.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeDatabase.scala @@ -19,7 +19,7 @@ object DriverUpgradeDatabase extends Item with api.driver.item.HostAware { api.Items.get(Constants.ItemName.DatabaseUpgradeTier3)) override def createEnvironment(stack: ItemStack, host: api.network.EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.UpgradeDatabase(new DatabaseInventory { override def container = stack diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeGenerator.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeGenerator.scala index c84e65725..dae2f6999 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeGenerator.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeGenerator.scala @@ -16,7 +16,7 @@ object DriverUpgradeGenerator extends Item with HostAware { api.Items.get(Constants.ItemName.GeneratorUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case host: internal.Agent => new component.UpgradeGenerator(host) case _ => null diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeInventoryController.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeInventoryController.scala index 76f6563da..85897d72a 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeInventoryController.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeInventoryController.scala @@ -18,7 +18,7 @@ object DriverUpgradeInventoryController extends Item with HostAware { api.Items.get(Constants.ItemName.InventoryControllerUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case host: EnvironmentHost with Adapter => new component.UpgradeInventoryController.Adapter(host) case host: EnvironmentHost with Drone => new component.UpgradeInventoryController.Drone(host) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeLeash.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeLeash.scala index 3aba7d7bf..0af34be1c 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeLeash.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeLeash.scala @@ -16,7 +16,7 @@ object DriverUpgradeLeash extends Item with HostAware { api.Items.get(Constants.ItemName.LeashUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case entity: Entity => new component.UpgradeLeash(entity) case _ => null diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeNavigation.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeNavigation.scala index b20d7a6f9..150155f82 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeNavigation.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeNavigation.scala @@ -16,7 +16,7 @@ object DriverUpgradeNavigation extends Item with HostAware { api.Items.get(Constants.ItemName.NavigationUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case rotatable: EnvironmentHost with Rotatable => new component.UpgradeNavigation(rotatable) case _ => null diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradePiston.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradePiston.scala index 182cda6ca..64b40bd11 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradePiston.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradePiston.scala @@ -15,7 +15,7 @@ object DriverUpgradePiston extends Item with HostAware { api.Items.get(Constants.ItemName.PistonUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case host: internal.Drone => new component.UpgradePiston.Drone(host) case host: internal.Tablet => new component.UpgradePiston.Tablet(host) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeSign.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeSign.scala index c37aeab96..58638827d 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeSign.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeSign.scala @@ -18,7 +18,7 @@ object DriverUpgradeSign extends Item with HostAware { api.Items.get(Constants.ItemName.SignUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case rotatable: EnvironmentHost with Rotatable => new UpgradeSignInRotatable(rotatable) case adapter: EnvironmentHost with Adapter => new UpgradeSignInAdapter(adapter) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeSolarGenerator.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeSolarGenerator.scala index df1179e90..f91a21c30 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeSolarGenerator.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeSolarGenerator.scala @@ -14,7 +14,7 @@ object DriverUpgradeSolarGenerator extends Item with HostAware { api.Items.get(Constants.ItemName.SolarGeneratorUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.UpgradeSolarGenerator(host) override def slot(stack: ItemStack) = Slot.Upgrade diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTank.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTank.scala index c9b9543fd..618875afc 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTank.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTank.scala @@ -13,7 +13,7 @@ object DriverUpgradeTank extends Item with HostAware { api.Items.get(Constants.ItemName.TankUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.UpgradeTank(host, 16000) override def slot(stack: ItemStack) = Slot.Upgrade diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTankController.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTankController.scala index ca8cd6b7f..b66090ffe 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTankController.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTankController.scala @@ -18,7 +18,7 @@ object DriverUpgradeTankController extends Item with HostAware { api.Items.get(Constants.ItemName.TankControllerUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case host: EnvironmentHost with Adapter => new component.UpgradeTankController.Adapter(host) case host: EnvironmentHost with Drone => new component.UpgradeTankController.Drone(host) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTractorBeam.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTractorBeam.scala index 7c21097a0..8d01e4232 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTractorBeam.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeTractorBeam.scala @@ -19,7 +19,7 @@ object DriverUpgradeTractorBeam extends Item with HostAware { api.Items.get(Constants.ItemName.TractorBeamUpgrade)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else host match { case drone: Drone => new UpgradeTractorBeam.Drone(drone) case robot: Robot => new component.UpgradeTractorBeam.Player(host, robot.player) diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/DriverWirelessNetworkCard.scala b/src/main/scala/li/cil/oc/integration/opencomputers/DriverWirelessNetworkCard.scala index e60959d1e..c2967a73b 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/DriverWirelessNetworkCard.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/DriverWirelessNetworkCard.scala @@ -14,7 +14,7 @@ object DriverWirelessNetworkCard extends Item { api.Items.get(Constants.ItemName.WirelessNetworkCard)) override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = - if (host.world.isRemote) null + if (host.world != null && host.world.isRemote) null else new component.WirelessNetworkCard(host) override def slot(stack: ItemStack) = Slot.Card diff --git a/src/main/scala/li/cil/oc/server/fs/FileSystem.scala b/src/main/scala/li/cil/oc/server/fs/FileSystem.scala index ae0a7eb24..fce6ffb89 100755 --- a/src/main/scala/li/cil/oc/server/fs/FileSystem.scala +++ b/src/main/scala/li/cil/oc/server/fs/FileSystem.scala @@ -114,7 +114,7 @@ object FileSystem extends api.detail.FileSystemAPI { else new ReadOnlyWrapper(fileSystem) def asManagedEnvironment(fileSystem: api.fs.FileSystem, label: Label, host: EnvironmentHost, accessSound: String, speed: Int) = - Option(fileSystem).flatMap(fs => Some(new component.FileSystem(fs, label, Option(host), Option(accessSound), speed))).orNull + Option(fileSystem).flatMap(fs => Some(new component.FileSystem(fs, label, Option(host), Option(accessSound), (speed - 1) max 0 min 5))).orNull def asManagedEnvironment(fileSystem: api.fs.FileSystem, label: String, host: EnvironmentHost, accessSound: String, speed: Int) = asManagedEnvironment(fileSystem, new ReadOnlyLabel(label), host, accessSound, speed)