Skip to content

Commit

Permalink
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComput…
Browse files Browse the repository at this point in the history
…ers into OC1.5-MC1.7.10

Conflicts:
	build.properties
  • Loading branch information
fnuecke committed Sep 20, 2015
2 parents f49b10a + e9ad0f2 commit c24eea3
Show file tree
Hide file tree
Showing 139 changed files with 3,115 additions and 360 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This mod is [licensed under the **MIT license**](https://github.com/MightyPirate
If you would like to contribute better textures for certain items or blocks, feel free to pull-request them. If you would like to contribute *alternative* textures, make it a resource pack, and post it on the forums, for example.
3. **Documentation**
Help with keeping the [wiki][] up to date would be *really* appreciated. If you notice anything amiss and know better, fix it. If you don't ask someone who does, then fix it. If you had a question answered, consider adding that information somewhere in the wiki where you would have expected to find that information.
There are also the [files containing the ingame help][manpages], which could probably be much better than they are right now. Improvements to them, and new ones (e.g. for the libraries, such as `text` or `sides`) would help a lot. Thanks!
There are also the files containing the ingame help [for programs][manpages] and [for blocks and items][manual], which could probably be much better than they are right now. Improvements to them, and new ones (e.g. for the libraries, such as `text` or `sides`) would help a lot. Thanks!
4. **Robot Names**
Robots get a random name when placed (unless set with an Anvil). The list the names are chose from [can be found here][robot names]. Feel free to pull request additional names! *However*: since the list has grown to a considerable length already, here are the two basic criteria for new names: it must either be a real or fictional robot, or an AI that at least *appears* to be self-aware.

Expand Down Expand Up @@ -99,7 +99,8 @@ In the case you wish to use Eclipse rather than IntelliJ IDEA, the process is mo
[jenkins]: http://ci.cil.li/
[localizations]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/lang
[loot]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/loot
[manpages]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/lua/rom/usr/man
[manpages]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/loot/OpenOS/usr/man
[manual]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/doc
[mcf]: http://www.minecraftforum.net/topic/2201440-opencomputers-v122/
[pack.mcmeta]: https://github.com/MightyPirates/OpenComputers/blob/master-MC1.7.10/src/main/resources/pack.mcmeta
[releases]: https://github.com/MightyPirates/OpenComputers/releases
Expand Down
Binary file modified assets/items.psd
Binary file not shown.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ repositories {
}
maven {
name = "dmodoomsirius"
url = "http://ci.dmodoomsirius.me/maven/"
url = "http://api.dmodoomsirius.me/"
}
maven {
name = "ue"
Expand Down Expand Up @@ -187,7 +187,7 @@ dependencies {
provided "mcp.mobius.waila:Waila:${config.waila.version}_${config.minecraft.version}:dev"
provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev"
provided "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev"
provided "notenoughkeys:NeK:${config.minecraft.version}-${config.nek.version}:deobf-dev"
provided "dev.modwarriors.notenoughkeys:NotEnoughKeys:${config.minecraft.version}-${config.nek.version}:deobf-dev"
provided "qmunity:QmunityLib:${config.qmunitylib.version}:deobf"
provided "tmech:TMechworks:${config.minecraft.version}-${config.tmech.version}:deobf"
provided ("mrtjp:ProjectRed:${config.projred.version}:dev") {
Expand Down
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
minecraft.version=1.7.10
forge.version=10.13.4.1448-1.7.10

oc.version=1.5.17
oc.version=1.5.18
oc.subversion=

ae2.version=rv2-beta-26
Expand Down Expand Up @@ -32,7 +32,7 @@ mekanism.version=7.1.2
mfr.cf=2229/626
mfr.version=[1.7.10]2.8.0RC8-86
nei.version=1.0.3.57
nek.version=1.0.0b2dev
nek.version=2.0.0b4
projred.version=1.7.10-4.6.2.82
qmunitylib.version=0.1.105
rc.cf=2219/321
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/li/cil/oc/api/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
*/
public class API {
public static final String ID_OWNER = "OpenComputers|Core";
public static final String VERSION = "5.5.4";
public static final String VERSION = "5.6.2";

public static DriverAPI driver = null;
public static FileSystemAPI fileSystem = null;
public static ItemAPI items = null;
public static MachineAPI machine = null;
public static ManualAPI manual = null;
public static NanomachinesAPI nanomachines = null;
public static NetworkAPI network = null;

public static Config config = null;
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/li/cil/oc/api/IMC.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,29 @@ public static void registerWrenchTool(String callback) {
FMLInterModComms.sendMessage(MOD_ID, "registerWrenchTool", callback);
}

/**
* Register a callback for checking if an item is a wrench.
* <p/>
* This is used to determine whether certain item stacks are wrench items,
* which is used, for example, when "itemizing" a drone.
* <p/>
* The returned value must <tt>true</tt> if the item stack is a wrench,
* <tt>false</tt> otherwise.
* <p/>
* Signature of callbacks must be:
* <pre>
* boolean callback(ItemStack stack)
* </pre>
* <p/>
* Callbacks must be declared as <tt>packagePath.className.methodName</tt>.
* For example: <tt>com.example.Integration.callbackMethod</tt>.
*
* @param callback the callback to register as a wrench tool tester.
*/
public static void registerWrenchToolCheck(String callback) {
FMLInterModComms.sendMessage(MOD_ID, "registerWrenchToolCheck", callback);
}

/**
* Register a handler for items that can be charged.
* <p/>
Expand Down
100 changes: 100 additions & 0 deletions src/main/java/li/cil/oc/api/Nanomachines.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package li.cil.oc.api;

import li.cil.oc.api.nanomachines.BehaviorProvider;
import li.cil.oc.api.nanomachines.Controller;
import net.minecraft.entity.player.EntityPlayer;

import java.util.Collections;

/**
* This API allows interfacing with nanomachines.
* <p/>
* It allows registering custom behavior providers as well as querying for all
* presently registered providers and getting a controller for a player.
*/
public class Nanomachines {
/**
* Register a new behavior provider.
* <p/>
* When a controller is reconfigured it will draw behaviors from all
* registered providers and build a new random connection graph to
* those behaviors.
*
* @param provider the provider to add.
*/
public static void addProvider(BehaviorProvider provider) {
if (API.nanomachines != null)
API.nanomachines.addProvider(provider);
}

/**
* Get a list of all currently registered providers.
*
* @return the list of all currently registered providers.
*/
public static Iterable<BehaviorProvider> getProviders() {
if (API.nanomachines != null)
return API.nanomachines.getProviders();
return Collections.emptyList();
}

/**
* Check whether a player has a nanomachine controller installed.
*
* @param player the player to check for.
* @return <tt>true</tt> if the player has a controller, <tt>false</tt> otherwise.
*/
public static boolean hasController(EntityPlayer player) {
if (API.nanomachines != null)
return API.nanomachines.hasController(player);
return false;
}

/**
* Get the nanomachine controller of the specified player.
* <p/>
* If the player has a controller installed, this will initialize the
* controller if it has not already been loaded. If the player has no
* controller, this will return <tt>null</tt>.
*
* @param player the player to get the controller for.
* @return the controller for the specified player.
*/
public static Controller getController(EntityPlayer player) {
if (API.nanomachines != null)
return API.nanomachines.getController(player);
return null;
}

/**
* Install a controller for the specified player if it doesn't already
* have one.
* <p/>
* This will also initialize the controller if it has not already been
* initialized.
*
* @param player the player to install a nanomachine controller for.
*/
public static Controller installController(EntityPlayer player) {
if (API.nanomachines != null)
return API.nanomachines.installController(player);
return null;
}

/**
* Uninstall a controller from the specified player if it has one.
* <p/>
* This will disable all active behaviors before disposing the controller.
*
* @param player the player to uninstall a nanomachine controller from.
*/
public static void uninstallController(EntityPlayer player) {
if (API.nanomachines != null)
API.nanomachines.uninstallController(player);
}

// ----------------------------------------------------------------------- //

private Nanomachines() {
}
}
66 changes: 66 additions & 0 deletions src/main/java/li/cil/oc/api/detail/NanomachinesAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package li.cil.oc.api.detail;

import li.cil.oc.api.nanomachines.BehaviorProvider;
import li.cil.oc.api.nanomachines.Controller;
import net.minecraft.entity.player.EntityPlayer;

public interface NanomachinesAPI {
/**
* Register a new behavior provider.
* <p/>
* When a controller is reconfigured it will draw behaviors from all
* registered providers and build a new random connection graph to
* those behaviors.
*
* @param provider the provider to add.
*/
void addProvider(BehaviorProvider provider);

/**
* Get a list of all currently registered providers.
*
* @return the list of all currently registered providers.
*/
Iterable<BehaviorProvider> getProviders();

/**
* Check whether a player has a nanomachine controller installed.
*
* @param player the player to check for.
* @return <tt>true</tt> if the player has a controller, <tt>false</tt> otherwise.
*/
boolean hasController(EntityPlayer player);

/**
* Get the nanomachine controller of the specified player.
* <p/>
* If the player has a controller installed, this will initialize the
* controller if it has not already been loaded. If the player has no
* controller, this will return <tt>null</tt>.
*
* @param player the player to get the controller for.
* @return the controller for the specified player.
*/
Controller getController(EntityPlayer player);

/**
* Install a controller for the specified player if it doesn't already
* have one.
* <p/>
* This will also initialize the controller if it has not already been
* initialized.
*
* @param player the player to install a nanomachine controller for.
* @return the controller for the specified player.
*/
Controller installController(EntityPlayer player);

/**
* Uninstall a controller from the specified player if it has one.
* <p/>
* This will disable all active behaviors before disposing the controller.
*
* @param player the player to uninstall a nanomachine controller from.
*/
void uninstallController(EntityPlayer player);
}
52 changes: 52 additions & 0 deletions src/main/java/li/cil/oc/api/nanomachines/Behavior.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package li.cil.oc.api.nanomachines;

/**
* Implemented by single behaviors.
* <p/>
* If you need a reference to the player this behavior applies to (which you'll
* probably usually want to have), pass it along from {@link BehaviorProvider#createBehaviors}.
*/
public interface Behavior {
/**
* A short name / description of this behavior.
* <p/>
* You can <em>not</em> use commas (<tt>,</tt>) or double quotes (<tt>"</tt>)
* in the returned string. If you do, they'll automatically be replaced with
* underscores.
* <p/>
* This is entirely optional and may even return <tt>null</tt>. It is made
* accessible via the controller's wireless protocol, to allow better
* automating reconfigurations / determining input mappings. In some cases
* you may not wish to make this possible, in those cases return <tt>null</tt>
* or a random string.
* <p/>
* Again, you can return whatever you like here, it's not used in mod internal
* logic, but only provided to ingame devices as a hint to make configuring
* nanomachines a little easier.
*
* @return the name to provide for this behavior, if any.
*/
String getNameHint();

/**
* Called when this behavior becomes active because all its required inputs
* are now satisfied.
* <p/>
* Use this to initialize permanent effects.
*/
void onEnable();

/**
* Called when this behavior becomes inactive.
* <p/>
* Use this to remove permanent effects.
*
* @param reason the reason the behavior is being disabled.
*/
void onDisable(DisableReason reason);

/**
* Called each tick while this behavior is active.
*/
void update();
}
66 changes: 66 additions & 0 deletions src/main/java/li/cil/oc/api/nanomachines/BehaviorProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package li.cil.oc.api.nanomachines;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;

/**
* Implemented by providers for behaviors.
* <p/>
* You may implement one provider for each of your behaviors, or one provider
* for all of your behaviors; it really doesn't matter. This just allows for
* some logical grouping of behaviors, where desired.
* <p/>
* Each behavior provider must be capable or serializing the behaviors it
* creates, and re-create the behavior from its serialized form. It will
* not be given any hints as to whether a provided tag was originally
* produced by it, so you should add a sufficiently unique marker to the
* output NBT to allow identification later on. I recommend generating a
* UUID once, and using that. This is necessary to both save and restore
* neural connection state between saves without breaking the state when
* new behaviors are added, as well as to send states to the client.
*/
public interface BehaviorProvider {
/**
* Create all behaviors valid for the specified player.
* <p/>
* Note that this is only called on the server side when reconfiguring
* nanomachines. If you have a behavior that actually acts client-only,
* you still need to return it here, as it will be synchronized to the
* client using {@link #writeToNBT} and {@link #readFromNBT}.
*
* @param player the player the behaviors should be created for.
* @return list of new behaviors, may be <tt>null</tt>.
*/
Iterable<Behavior> createBehaviors(EntityPlayer player);

/**
* Write a behavior to NBT.
* <p/>
* This will only be called for behaviors originally created by this provider.
* <p/>
* This will only be called on the server. All behaviors not saved will be
* lost when loading again, they will <em>not</em> be regenerated using
* {@link #createBehaviors}, so make sure to save all your behaviors.
*
* @param behavior the behavior to serialize.
* @return the serialized representation of the specified behavior.
*/
NBTTagCompound writeToNBT(Behavior behavior);

/**
* Restore a behavior from NBT.
* <p/>
* You are <em>not</em> guaranteed that his nbt belongs to a behavior
* created by this provider! If the NBT cannot be handled, return
* <tt>null</tt>.
* <p/>
* This is called both on the server and the client; on the server it
* is called when restoring a saved player, on the client when
* synchronizing a configuration.
*
* @param player the player the behaviors should be created for.
* @param nbt the tag to restore the behavior from.
* @return the restored behavior, or <tt>null</tt> if unhandled.
*/
Behavior readFromNBT(EntityPlayer player, NBTTagCompound nbt);
}
Loading

0 comments on commit c24eea3

Please sign in to comment.