ShetiPhian 0 Posted January 28, 2016 Share Posted January 28, 2016 I've added support for OpenComputers robots by creating an upgrade/driver for one of my mods tools. While the upgrade works perfectly, there are a few quirks I couldn't seem to find the answer to. 1) How do I flag an upgrade for use in robots only? -- Currently it can go into any upgrade slot but only works in the robots. 2) Is there a way to get a robots facing via the API? -- Currently using ((Robot)host).facing() Driver Registration is done in FMLInitializationEvent via: Driver.add(new DriverColorizer());DriverColorizer.class : public class DriverColorizer extends DriverItem { public DriverColorizer() { super (Values.stacks.get("robot_colorizer")); } @Override public ManagedEnvironment createEnvironment(ItemStack stack, EnvironmentHost host) { return (host instanceof Robot) ? new EnvironmentColorizer(host) : null; } @Override public String slot(ItemStack stack) { return Slot.Upgrade; } }EnvironmentColorizer.class (truncated) public class EnvironmentColorizer extends ManagedEnvironment { private final EnvironmentHost host; private final Robot robot; public EnvironmentColorizer(EnvironmentHost host) { this.host = host; setNode(Network.newNode(this, Visibility.Neighbors).withComponent("colorizer").create()); robot = (Robot)host; } <SNIP> } Quote Link to post Share on other sites
I've added support for OpenComputers robots by creating an upgrade/driver for one of my mods tools.
While the upgrade works perfectly, there are a few quirks I couldn't seem to find the answer to.
1) How do I flag an upgrade for use in robots only?
-- Currently it can go into any upgrade slot but only works in the robots.
2) Is there a way to get a robots facing via the API?
-- Currently using ((Robot)host).facing()
Driver Registration is done in FMLInitializationEvent via:
DriverColorizer.class : EnvironmentColorizer.class (truncated)Link to post
Share on other sites