Skip to content

Commit c24eea3

Browse files
committed
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into OC1.5-MC1.7.10
Conflicts: build.properties
2 parents f49b10a + e9ad0f2 commit c24eea3

File tree

139 files changed

+3115
-360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+3115
-360
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This mod is [licensed under the **MIT license**](https://github.com/MightyPirate
2525
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.
2626
3. **Documentation**
2727
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.
28-
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!
28+
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!
2929
4. **Robot Names**
3030
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.
3131

@@ -99,7 +99,8 @@ In the case you wish to use Eclipse rather than IntelliJ IDEA, the process is mo
9999
[jenkins]: http://ci.cil.li/
100100
[localizations]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/lang
101101
[loot]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/loot
102-
[manpages]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/lua/rom/usr/man
102+
[manpages]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/loot/OpenOS/usr/man
103+
[manual]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/doc
103104
[mcf]: http://www.minecraftforum.net/topic/2201440-opencomputers-v122/
104105
[pack.mcmeta]: https://github.com/MightyPirates/OpenComputers/blob/master-MC1.7.10/src/main/resources/pack.mcmeta
105106
[releases]: https://github.com/MightyPirates/OpenComputers/releases

assets/items.psd

-44.2 KB
Binary file not shown.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ repositories {
9393
}
9494
maven {
9595
name = "dmodoomsirius"
96-
url = "http://ci.dmodoomsirius.me/maven/"
96+
url = "http://api.dmodoomsirius.me/"
9797
}
9898
maven {
9999
name = "ue"
@@ -187,7 +187,7 @@ dependencies {
187187
provided "mcp.mobius.waila:Waila:${config.waila.version}_${config.minecraft.version}:dev"
188188
provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev"
189189
provided "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev"
190-
provided "notenoughkeys:NeK:${config.minecraft.version}-${config.nek.version}:deobf-dev"
190+
provided "dev.modwarriors.notenoughkeys:NotEnoughKeys:${config.minecraft.version}-${config.nek.version}:deobf-dev"
191191
provided "qmunity:QmunityLib:${config.qmunitylib.version}:deobf"
192192
provided "tmech:TMechworks:${config.minecraft.version}-${config.tmech.version}:deobf"
193193
provided ("mrtjp:ProjectRed:${config.projred.version}:dev") {

build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
minecraft.version=1.7.10
22
forge.version=10.13.4.1448-1.7.10
33

4-
oc.version=1.5.17
4+
oc.version=1.5.18
55
oc.subversion=
66

77
ae2.version=rv2-beta-26
@@ -32,7 +32,7 @@ mekanism.version=7.1.2
3232
mfr.cf=2229/626
3333
mfr.version=[1.7.10]2.8.0RC8-86
3434
nei.version=1.0.3.57
35-
nek.version=1.0.0b2dev
35+
nek.version=2.0.0b4
3636
projred.version=1.7.10-4.6.2.82
3737
qmunitylib.version=0.1.105
3838
rc.cf=2219/321

src/main/java/li/cil/oc/api/API.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
*/
1313
public class API {
1414
public static final String ID_OWNER = "OpenComputers|Core";
15-
public static final String VERSION = "5.5.4";
15+
public static final String VERSION = "5.6.2";
1616

1717
public static DriverAPI driver = null;
1818
public static FileSystemAPI fileSystem = null;
1919
public static ItemAPI items = null;
2020
public static MachineAPI machine = null;
2121
public static ManualAPI manual = null;
22+
public static NanomachinesAPI nanomachines = null;
2223
public static NetworkAPI network = null;
2324

2425
public static Config config = null;

src/main/java/li/cil/oc/api/IMC.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,29 @@ public static void registerWrenchTool(String callback) {
238238
FMLInterModComms.sendMessage(MOD_ID, "registerWrenchTool", callback);
239239
}
240240

241+
/**
242+
* Register a callback for checking if an item is a wrench.
243+
* <p/>
244+
* This is used to determine whether certain item stacks are wrench items,
245+
* which is used, for example, when "itemizing" a drone.
246+
* <p/>
247+
* The returned value must <tt>true</tt> if the item stack is a wrench,
248+
* <tt>false</tt> otherwise.
249+
* <p/>
250+
* Signature of callbacks must be:
251+
* <pre>
252+
* boolean callback(ItemStack stack)
253+
* </pre>
254+
* <p/>
255+
* Callbacks must be declared as <tt>packagePath.className.methodName</tt>.
256+
* For example: <tt>com.example.Integration.callbackMethod</tt>.
257+
*
258+
* @param callback the callback to register as a wrench tool tester.
259+
*/
260+
public static void registerWrenchToolCheck(String callback) {
261+
FMLInterModComms.sendMessage(MOD_ID, "registerWrenchToolCheck", callback);
262+
}
263+
241264
/**
242265
* Register a handler for items that can be charged.
243266
* <p/>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package li.cil.oc.api;
2+
3+
import li.cil.oc.api.nanomachines.BehaviorProvider;
4+
import li.cil.oc.api.nanomachines.Controller;
5+
import net.minecraft.entity.player.EntityPlayer;
6+
7+
import java.util.Collections;
8+
9+
/**
10+
* This API allows interfacing with nanomachines.
11+
* <p/>
12+
* It allows registering custom behavior providers as well as querying for all
13+
* presently registered providers and getting a controller for a player.
14+
*/
15+
public class Nanomachines {
16+
/**
17+
* Register a new behavior provider.
18+
* <p/>
19+
* When a controller is reconfigured it will draw behaviors from all
20+
* registered providers and build a new random connection graph to
21+
* those behaviors.
22+
*
23+
* @param provider the provider to add.
24+
*/
25+
public static void addProvider(BehaviorProvider provider) {
26+
if (API.nanomachines != null)
27+
API.nanomachines.addProvider(provider);
28+
}
29+
30+
/**
31+
* Get a list of all currently registered providers.
32+
*
33+
* @return the list of all currently registered providers.
34+
*/
35+
public static Iterable<BehaviorProvider> getProviders() {
36+
if (API.nanomachines != null)
37+
return API.nanomachines.getProviders();
38+
return Collections.emptyList();
39+
}
40+
41+
/**
42+
* Check whether a player has a nanomachine controller installed.
43+
*
44+
* @param player the player to check for.
45+
* @return <tt>true</tt> if the player has a controller, <tt>false</tt> otherwise.
46+
*/
47+
public static boolean hasController(EntityPlayer player) {
48+
if (API.nanomachines != null)
49+
return API.nanomachines.hasController(player);
50+
return false;
51+
}
52+
53+
/**
54+
* Get the nanomachine controller of the specified player.
55+
* <p/>
56+
* If the player has a controller installed, this will initialize the
57+
* controller if it has not already been loaded. If the player has no
58+
* controller, this will return <tt>null</tt>.
59+
*
60+
* @param player the player to get the controller for.
61+
* @return the controller for the specified player.
62+
*/
63+
public static Controller getController(EntityPlayer player) {
64+
if (API.nanomachines != null)
65+
return API.nanomachines.getController(player);
66+
return null;
67+
}
68+
69+
/**
70+
* Install a controller for the specified player if it doesn't already
71+
* have one.
72+
* <p/>
73+
* This will also initialize the controller if it has not already been
74+
* initialized.
75+
*
76+
* @param player the player to install a nanomachine controller for.
77+
*/
78+
public static Controller installController(EntityPlayer player) {
79+
if (API.nanomachines != null)
80+
return API.nanomachines.installController(player);
81+
return null;
82+
}
83+
84+
/**
85+
* Uninstall a controller from the specified player if it has one.
86+
* <p/>
87+
* This will disable all active behaviors before disposing the controller.
88+
*
89+
* @param player the player to uninstall a nanomachine controller from.
90+
*/
91+
public static void uninstallController(EntityPlayer player) {
92+
if (API.nanomachines != null)
93+
API.nanomachines.uninstallController(player);
94+
}
95+
96+
// ----------------------------------------------------------------------- //
97+
98+
private Nanomachines() {
99+
}
100+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package li.cil.oc.api.detail;
2+
3+
import li.cil.oc.api.nanomachines.BehaviorProvider;
4+
import li.cil.oc.api.nanomachines.Controller;
5+
import net.minecraft.entity.player.EntityPlayer;
6+
7+
public interface NanomachinesAPI {
8+
/**
9+
* Register a new behavior provider.
10+
* <p/>
11+
* When a controller is reconfigured it will draw behaviors from all
12+
* registered providers and build a new random connection graph to
13+
* those behaviors.
14+
*
15+
* @param provider the provider to add.
16+
*/
17+
void addProvider(BehaviorProvider provider);
18+
19+
/**
20+
* Get a list of all currently registered providers.
21+
*
22+
* @return the list of all currently registered providers.
23+
*/
24+
Iterable<BehaviorProvider> getProviders();
25+
26+
/**
27+
* Check whether a player has a nanomachine controller installed.
28+
*
29+
* @param player the player to check for.
30+
* @return <tt>true</tt> if the player has a controller, <tt>false</tt> otherwise.
31+
*/
32+
boolean hasController(EntityPlayer player);
33+
34+
/**
35+
* Get the nanomachine controller of the specified player.
36+
* <p/>
37+
* If the player has a controller installed, this will initialize the
38+
* controller if it has not already been loaded. If the player has no
39+
* controller, this will return <tt>null</tt>.
40+
*
41+
* @param player the player to get the controller for.
42+
* @return the controller for the specified player.
43+
*/
44+
Controller getController(EntityPlayer player);
45+
46+
/**
47+
* Install a controller for the specified player if it doesn't already
48+
* have one.
49+
* <p/>
50+
* This will also initialize the controller if it has not already been
51+
* initialized.
52+
*
53+
* @param player the player to install a nanomachine controller for.
54+
* @return the controller for the specified player.
55+
*/
56+
Controller installController(EntityPlayer player);
57+
58+
/**
59+
* Uninstall a controller from the specified player if it has one.
60+
* <p/>
61+
* This will disable all active behaviors before disposing the controller.
62+
*
63+
* @param player the player to uninstall a nanomachine controller from.
64+
*/
65+
void uninstallController(EntityPlayer player);
66+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package li.cil.oc.api.nanomachines;
2+
3+
/**
4+
* Implemented by single behaviors.
5+
* <p/>
6+
* If you need a reference to the player this behavior applies to (which you'll
7+
* probably usually want to have), pass it along from {@link BehaviorProvider#createBehaviors}.
8+
*/
9+
public interface Behavior {
10+
/**
11+
* A short name / description of this behavior.
12+
* <p/>
13+
* You can <em>not</em> use commas (<tt>,</tt>) or double quotes (<tt>"</tt>)
14+
* in the returned string. If you do, they'll automatically be replaced with
15+
* underscores.
16+
* <p/>
17+
* This is entirely optional and may even return <tt>null</tt>. It is made
18+
* accessible via the controller's wireless protocol, to allow better
19+
* automating reconfigurations / determining input mappings. In some cases
20+
* you may not wish to make this possible, in those cases return <tt>null</tt>
21+
* or a random string.
22+
* <p/>
23+
* Again, you can return whatever you like here, it's not used in mod internal
24+
* logic, but only provided to ingame devices as a hint to make configuring
25+
* nanomachines a little easier.
26+
*
27+
* @return the name to provide for this behavior, if any.
28+
*/
29+
String getNameHint();
30+
31+
/**
32+
* Called when this behavior becomes active because all its required inputs
33+
* are now satisfied.
34+
* <p/>
35+
* Use this to initialize permanent effects.
36+
*/
37+
void onEnable();
38+
39+
/**
40+
* Called when this behavior becomes inactive.
41+
* <p/>
42+
* Use this to remove permanent effects.
43+
*
44+
* @param reason the reason the behavior is being disabled.
45+
*/
46+
void onDisable(DisableReason reason);
47+
48+
/**
49+
* Called each tick while this behavior is active.
50+
*/
51+
void update();
52+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package li.cil.oc.api.nanomachines;
2+
3+
import net.minecraft.entity.player.EntityPlayer;
4+
import net.minecraft.nbt.NBTTagCompound;
5+
6+
/**
7+
* Implemented by providers for behaviors.
8+
* <p/>
9+
* You may implement one provider for each of your behaviors, or one provider
10+
* for all of your behaviors; it really doesn't matter. This just allows for
11+
* some logical grouping of behaviors, where desired.
12+
* <p/>
13+
* Each behavior provider must be capable or serializing the behaviors it
14+
* creates, and re-create the behavior from its serialized form. It will
15+
* not be given any hints as to whether a provided tag was originally
16+
* produced by it, so you should add a sufficiently unique marker to the
17+
* output NBT to allow identification later on. I recommend generating a
18+
* UUID once, and using that. This is necessary to both save and restore
19+
* neural connection state between saves without breaking the state when
20+
* new behaviors are added, as well as to send states to the client.
21+
*/
22+
public interface BehaviorProvider {
23+
/**
24+
* Create all behaviors valid for the specified player.
25+
* <p/>
26+
* Note that this is only called on the server side when reconfiguring
27+
* nanomachines. If you have a behavior that actually acts client-only,
28+
* you still need to return it here, as it will be synchronized to the
29+
* client using {@link #writeToNBT} and {@link #readFromNBT}.
30+
*
31+
* @param player the player the behaviors should be created for.
32+
* @return list of new behaviors, may be <tt>null</tt>.
33+
*/
34+
Iterable<Behavior> createBehaviors(EntityPlayer player);
35+
36+
/**
37+
* Write a behavior to NBT.
38+
* <p/>
39+
* This will only be called for behaviors originally created by this provider.
40+
* <p/>
41+
* This will only be called on the server. All behaviors not saved will be
42+
* lost when loading again, they will <em>not</em> be regenerated using
43+
* {@link #createBehaviors}, so make sure to save all your behaviors.
44+
*
45+
* @param behavior the behavior to serialize.
46+
* @return the serialized representation of the specified behavior.
47+
*/
48+
NBTTagCompound writeToNBT(Behavior behavior);
49+
50+
/**
51+
* Restore a behavior from NBT.
52+
* <p/>
53+
* You are <em>not</em> guaranteed that his nbt belongs to a behavior
54+
* created by this provider! If the NBT cannot be handled, return
55+
* <tt>null</tt>.
56+
* <p/>
57+
* This is called both on the server and the client; on the server it
58+
* is called when restoring a saved player, on the client when
59+
* synchronizing a configuration.
60+
*
61+
* @param player the player the behaviors should be created for.
62+
* @param nbt the tag to restore the behavior from.
63+
* @return the restored behavior, or <tt>null</tt> if unhandled.
64+
*/
65+
Behavior readFromNBT(EntityPlayer player, NBTTagCompound nbt);
66+
}

0 commit comments

Comments
 (0)