- Extending API with chat functionality

- Refactoring towards MineTweakerMC calls
- Added IC2 matter amplifier support
This commit is contained in:
Stan Hebben committed 2014-06-29 16:18:50 +02:00
1 parent 7c478da1a2
commit ea0d369519
95 files changed
+1828 -547

No files matched your search

@@ -0,0 +1,17 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package minetweaker;
import minetweaker.api.chat.IChatMessage;
/**
*
* @author Stan
*/
public interface IPlatformFunctions {
public IChatMessage getMessage(String message);
}
@@ -11,6 +11,14 @@ package minetweaker;
* canUndo(), the action is undoable, otherwise it is permanent. Permanent
* actions cannot be used in server scripts.
*
* There also exist semi-permanent actions. Those actions can return an override
* key; if a newer action has the same override key as an old action, the new
* action is considered to override the old one.
*
* Likewise, actions can implement hashCode and equals methods to indicate that
* they are equal. If an action is equal to a non-undoable stuck action, it will
* be omitted from execution.
*
* @author Stan Hebben
*/
public interface IUndoableAction {
@@ -60,4 +68,16 @@ public interface IUndoableAction {
* @return the description of this action, when undone
*/
public String describeUndo();
/**
* Returns the override key. Two actions are considered to override each
* other if their override key is equal. You can return null to indicate
* that an action can never be overridden.
*
* This value only makes sense for recipes that are not undoable. For
* undoable recipes, you should return null.
*
* @return override key (null for actions that are undoable or which can never be overridden by another action)
*/
public Object getOverrideKey();
}
@@ -110,6 +110,11 @@ public class MineTweakerAPI {
*/
public static IResourceManager resources = null;
/**
* Access point to general platform functions.
*/
public static IPlatformFunctions platform = null;
/**
* Register a class registry class. Such class must have (at least) a public
* static method called "getClasses" with accepts a List of classes and which
@@ -0,0 +1,23 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package minetweaker.api.chat;
import stanhebben.zenscript.annotations.OperatorType;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenOperator;
/**
*
* @author Stan
*/
@ZenClass("minetweaker.chat.IChatMessage")
public interface IChatMessage {
@ZenOperator(OperatorType.ADD)
public IChatMessage add(IChatMessage other);
public Object getInternal();
}
@@ -118,7 +118,9 @@ public interface IIngredient {
/**
* Gets the internal item backing this ingredient.
*
* The value is implementation-dependent.
* The value is implementation-dependent and should only be handled by
* the internal code. Don't use this value - instead, use the version-specific
* helper methods.
*
* @return internal item
*/
@@ -9,6 +9,7 @@ package minetweaker.api.oredict;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
/**
@@ -17,6 +18,9 @@ import stanhebben.zenscript.annotations.ZenMethod;
*/
@ZenClass("minetweaker.oredict.IOreDictEntry")
public interface IOreDictEntry extends IIngredient {
@ZenGetter("empty")
public boolean isEmpty();
@ZenMethod
public void add(IItemStack item);
@@ -6,6 +6,7 @@
package minetweaker.api.player;
import minetweaker.api.chat.IChatMessage;
import minetweaker.api.data.IData;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
@@ -25,4 +26,7 @@ public interface IPlayer {
@ZenMethod
public void update(IData data);
@ZenMethod
public void sendChat(IChatMessage message);
}
@@ -6,6 +6,8 @@
package minetweaker.expand;
import minetweaker.MineTweakerAPI;
import minetweaker.api.chat.IChatMessage;
import minetweaker.api.data.DataString;
import minetweaker.api.data.IData;
import stanhebben.zenscript.annotations.ZenCaster;
@@ -21,4 +23,9 @@ public class ExpandString {
public static IData asData(String value) {
return new DataString(value);
}
@ZenCaster
public static IChatMessage asChatMessage(String value) {
return MineTweakerAPI.platform.getMessage(value);
}
}