forked from MightyPirates/OpenComputers
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from GTNewHorizons/feature/configurator
Configurator upgrade
- Loading branch information
Showing
13 changed files
with
538 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+585 Bytes
src/main/resources/assets/opencomputers/textures/items/UpgradeConfigurator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/main/scala/li/cil/oc/common/item/UpgradeConfigurator.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package li.cil.oc.common.item | ||
|
||
class UpgradeConfigurator(val parent: Delegator) extends traits.Delegate with traits.ItemTier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/scala/li/cil/oc/integration/opencomputers/DriverUpgradeConfigurator.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package li.cil.oc.integration.opencomputers | ||
|
||
import li.cil.oc.api.driver.EnvironmentProvider | ||
import li.cil.oc.{Constants, api} | ||
import li.cil.oc.api.driver.item.HostAware | ||
import li.cil.oc.api.internal.Adapter | ||
import li.cil.oc.api.network.{EnvironmentHost, ManagedEnvironment} | ||
import li.cil.oc.common.entity.Drone | ||
import li.cil.oc.common.tileentity.Robot | ||
import li.cil.oc.common.tileentity.Microcontroller | ||
import li.cil.oc.common.{Slot, Tier} | ||
import li.cil.oc.server.component | ||
import net.minecraft.item.ItemStack | ||
|
||
object DriverUpgradeConfigurator extends Item with HostAware { | ||
override def worksWith(stack: ItemStack): Boolean = isOneOf(stack, | ||
api.Items.get(Constants.ItemName.ConfiguratorUpgrade)) | ||
|
||
override def createEnvironment(stack: ItemStack, host: EnvironmentHost) : ManagedEnvironment = | ||
if (host.world != null && host.world.isRemote) null | ||
else host match { | ||
case host: EnvironmentHost with Adapter => new component.UpgradeConfigurator.Adapter(host) | ||
case host: EnvironmentHost with Drone => new component.UpgradeConfigurator.Drone(host) | ||
case host: EnvironmentHost with Robot => new component.UpgradeConfigurator.Robot(host) | ||
case host: EnvironmentHost with Microcontroller => new component.UpgradeConfigurator.Microcontroller(host) | ||
case _ => null | ||
} | ||
|
||
override def slot(stack: ItemStack): String = Slot.Upgrade | ||
|
||
override def tier(stack: ItemStack): Int = Tier.Two | ||
|
||
object Provider extends EnvironmentProvider { | ||
override def getEnvironment(stack: ItemStack): Class[_] = | ||
if (worksWith(stack)) | ||
classOf[component.UpgradeConfigurator.Robot] | ||
else null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.