Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tutorial:modding_onefour [2014/10/10 15:47]
sangar created
tutorial:modding_onefour [2015/01/14 22:40] (current)
Line 107: Line 107:
   Moved to `li.cil.oc.api.internal.Robot`. This is an effort to keep all interfaces that are or should be implemented by tile entities in one package, for clarity.  ​   Moved to `li.cil.oc.api.internal.Robot`. This is an effort to keep all interfaces that are or should be implemented by tile entities in one package, for clarity.  ​
   //How to adjust//: update imports.   //How to adjust//: update imports.
 +
  
 ### Added and renamed methods in existing interfaces ### Added and renamed methods in existing interfaces
Line 117: Line 118:
  
 - `li.cil.oc.api.FileSystem.asManagedEnvironment(FileSystem,​ String, EnvironmentHost)`  ​ - `li.cil.oc.api.FileSystem.asManagedEnvironment(FileSystem,​ String, EnvironmentHost)`  ​
-  Extended to `li.cil.oc.api.FileSystem.asManagedEnvironment(FileSystem,​ String, EnvironmentHost,​ String)`. Takes additional parameter, name of the sound effect to play when file system is being accessed.+  Extended to `li.cil.oc.api.FileSystem.asManagedEnvironment(FileSystem,​ String, EnvironmentHost,​ String)`. Takes additional parameter, name of the sound effect to play when file system is being accessed. ​ 
   //How to adjust//: pass name of sound effect to play on filesystem access, `null` otherwise.   //How to adjust//: pass name of sound effect to play on filesystem access, `null` otherwise.
  
 - `li.cil.oc.api.driver.Item.slot(ItemStack)`  ​ - `li.cil.oc.api.driver.Item.slot(ItemStack)`  ​
   Now returns a String instead of using the `Slot` enum (which has been removed).  ​   Now returns a String instead of using the `Slot` enum (which has been removed).  ​
-  //How to adjust//: return string name of the slot type. Built-in types are`card`, `component_bus`,​ `container`,​ `cpu`, `floppy`, `hdd`, `memory`, `tablet`, `tool`, `upgrade`.+  //How to adjust//: return string name of the slot type. Built-in types are listed in `li.cil.oc.api.driver.item.Slot`.
  
 - `li.cil.oc.api.driver.NamedBlock.priority()`  ​ - `li.cil.oc.api.driver.NamedBlock.priority()`  ​
Line 134: Line 135:
 - `li.cil.oc.api.driver.item.Container.providedSlot(ItemStack)`  ​ - `li.cil.oc.api.driver.item.Container.providedSlot(ItemStack)`  ​
   Now returns a String instead of using the `Slot` enum (which has been removed).  ​   Now returns a String instead of using the `Slot` enum (which has been removed).  ​
-  //How to adjust//: return string name of the slot type. Built-in types are`card`, `component_bus`,​ `container`,​ `cpu`, `floppy`, `hdd`, `memory`, `tablet`, `tool`, `upgrade`.+  //How to adjust//: return string name of the slot type. Built-in types are listed in `li.cil.oc.api.driver.item.Slot`.
  
 - `li.cil.oc.api.machine.Machine.owner()`  ​ - `li.cil.oc.api.machine.Machine.owner()`  ​
Line 145: Line 146:
  
 - `li.cil.oc.api.machine.MachineHost.callBudget()`  ​ - `li.cil.oc.api.machine.MachineHost.callBudget()`  ​
-  Added to the `MachineHost` interface to allow providing a custom direct call budget for machines, enabling machines that run at different speeds. In OC this value is based on the tier of the installed CPU, with the values being 0.5, 1.0 and 1.5 for the tiers one, two and three, respectively.+  Added to the `MachineHost` interface to allow providing a custom direct call budget for machines, enabling machines that run at different speeds. In OC this value is based on the tier of the installed CPU, with the values being 0.5, 1.0 and 1.5 for the tiers one, two and three, respectively. ​ 
   //How to adjust//: return desired call budget for machine, 1.0 being equivalent to before.   //How to adjust//: return desired call budget for machine, 1.0 being equivalent to before.
  
Line 151: Line 152:
   Renamed to `li.cil.oc.api.machine.MachineHost.markForSaving` to clarify difference to EnvironmentHost'​s markChanged (which usually means the inventory changed).  ​   Renamed to `li.cil.oc.api.machine.MachineHost.markForSaving` to clarify difference to EnvironmentHost'​s markChanged (which usually means the inventory changed).  ​
   //How to adjust//: rename implementing methods.   //How to adjust//: rename implementing methods.
 +
 +- `li.cil.oc.api.network.WirelessEndpoint.receivePacket(Packet packet, double distance)`  ​
 +  Changed signature to `receivePacket(Packet packet, WirelessEndpoint sender)`, which is much more versatile.  ​
 +  //How to adjust//: change signatures, compute distance when needed.
 +
 +- `li.cil.oc.api.prefab.ManagedEnvironment.node`  ​
 +  Made private. This change was made to ensure it can be overridden by overriding `node()`.  ​
 +  //How to adjust//: use `node()` to access, use `setNode(Node)` to set.
 +
  
 Removed Removed
Line 160: Line 170:
  
 - `li.cil.oc.api.driver.Slot`  ​ - `li.cil.oc.api.driver.Slot`  ​
-  The slot enum has gone, slot types are now simply strings. This allows much more flexibility,​ at the cost of potential typos and having to look up which slots actually exist (sorry for that). The built-in slot types are at the time of writing: ​`card`, `component_bus`,​ `container`,​ `cpu`, `floppy`, `hdd`, `memory`, `tool`, `upgrade`.  ​+  The slot enum has gone, slot types are now simply strings. This allows much more flexibility,​ at the cost of potential typos and having to look up which slots actually exist (sorry for that). The built-in slot types are listed in `li.cil.oc.api.driver.item.Slot`.  ​
   //How to adjust//: wwitch to the according string equivalents of the of old enum values.   //How to adjust//: wwitch to the according string equivalents of the of old enum values.
  
Line 175: Line 185:
   //How to adjust//: use `machine.methods(componentWithAddress.host)(methodName)` instead.   //How to adjust//: use `machine.methods(componentWithAddress.host)(methodName)` instead.
  
-IMC +## IMC
-===+
  
 - `registerAssemblerTemplate`  ​ - `registerAssemblerTemplate`  ​
   Added parameter `hostClass`,​ a string that is the fully qualified class name of the environment host the generated device will use. This is used to provide said class to drivers to allow them to check whether they wish to work in the environment or not. For now this is used to disable a couple of components for tablets, where they wouldn'​t work anyway (e.g. inventory upgrade).   Added parameter `hostClass`,​ a string that is the fully qualified class name of the environment host the generated device will use. This is used to provide said class to drivers to allow them to check whether they wish to work in the environment or not. For now this is used to disable a couple of components for tablets, where they wouldn'​t work anyway (e.g. inventory upgrade).
  
 +
 +Contents
 +------------
 +{{page>​tutorial:​contents&​noheader&​noeditbutton&​nouser&​nofooter}}