- Continued writing on the IC2 integration code

- Implemented advanced recipes on <*> values
- Removed unused ZenScript classes
- Continued work on any values
- Moved documentation generation to buildSrc
- Started work on a jar merging task
- Added toString implementation to ingredients
- Added stack count to ICraftingInventory
- Fixed imports
- Added logCommand to the logger to log command output
- Implemented memory script provider to load scripts received from the server
- Added exception handling for script execution
- First attempt at creating a transformer to generate a list of ZenClass and ZenExpansion classes
- Added console commands (reload, names, liquids, inventory, hand, oredict)
- Added general logic
- Fixed item ingredients for wildcard sizes
- Implemented selective recipe removal
- Fixed null recipe results
- Started implementation of player-specific recipes
- Removed redundant IC2 mod copy
- Other minor fixes
This commit is contained in:
Stan Hebben committed 2014-06-20 14:13:55 +02:00
1 parent f3ea7f7831
commit 489347558f
124 files changed
+3942 -419

No files matched your search

@@ -0,0 +1,29 @@
/*
* 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 stanhebben.zenscript.value;
/**
*
* @author Stan
*/
public class IntRange {
private final int from;
private final int to;
public IntRange(int from, int to) {
this.from = from;
this.to = to;
}
public int getFrom() {
return from;
}
public int getTo() {
return to;
}
}
@@ -9,6 +9,7 @@ package stanhebben.zenscript.value.builtin;
import java.util.Iterator;
import stanhebben.zenscript.ZenRuntimeException;
import stanhebben.zenscript.value.IAny;
import stanhebben.zenscript.value.IntRange;
/**
*
@@ -82,8 +83,7 @@ public class AnyByte implements IAny {
@Override
public IAny range(IAny value) {
//return new AnyIntRange(this.value, value.asInt());
return null; // TODO
return new AnyIntRange(new IntRange(this.value, value.asInt()));
}
@Override
@@ -117,7 +117,7 @@ public class AnyByte implements IAny {
@Override
public IAny call(IAny... values) {
throw new ZenRuntimeException("cannot index a byte value");
throw new ZenRuntimeException("cannot call a byte value");
}
@Override
@@ -0,0 +1,177 @@
/*
* 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 stanhebben.zenscript.value.builtin;
import java.util.Iterator;
import stanhebben.zenscript.ZenRuntimeException;
import stanhebben.zenscript.value.IAny;
import stanhebben.zenscript.value.IntRange;
/**
*
* @author Stanneke
*/
public class AnyInt implements IAny {
public static AnyInt valueOf(byte value) {
return new AnyInt(value);
}
private final int value;
public AnyInt(int value) {
this.value = value;
}
@Override
public IAny not() {
return new AnyInt(~value);
}
@Override
public IAny neg() {
return new AnyInt(-value);
}
@Override
public IAny add(IAny value) {
return new AnyInt(this.value + value.asInt());
}
@Override
public IAny sub(IAny value) {
return new AnyInt(this.value - value.asInt());
}
@Override
public IAny cat(IAny value) {
return new AnyString(Integer.toString(this.value) + value.asString());
}
@Override
public IAny mul(IAny value) {
return new AnyInt(this.value * value.asByte());
}
@Override
public IAny div(IAny value) {
return new AnyInt(this.value / value.asByte());
}
@Override
public IAny mod(IAny value) {
return new AnyInt(this.value % value.asByte());
}
@Override
public IAny and(IAny value) {
return new AnyInt(this.value & value.asByte());
}
@Override
public IAny or(IAny value) {
return new AnyInt(this.value | value.asByte());
}
@Override
public IAny xor(IAny value) {
return new AnyInt(this.value ^ value.asByte());
}
@Override
public IAny range(IAny value) {
return new AnyIntRange(new IntRange(this.value, value.asInt()));
}
@Override
public int compareTo(IAny value) {
return Integer.compare(this.value, value.asByte());
}
@Override
public boolean contains(IAny value) {
throw new ZenRuntimeException("int has no in operator");
}
@Override
public IAny member(String value) {
if (value.equals("abs")) {
return new AnyInt(Math.abs(this.value));
} else {
throw new ZenRuntimeException("no such member in int: " + value);
}
}
@Override
public IAny indexGet(IAny key) {
throw new ZenRuntimeException("cannot index an int value");
}
@Override
public void indexSet(IAny key, IAny value) {
throw new ZenRuntimeException("cannot index an int value");
}
@Override
public IAny call(IAny... values) {
throw new ZenRuntimeException("cannot call an int value");
}
@Override
public boolean asBool() {
throw new ZenRuntimeException("cannot convert an int to a bool");
}
@Override
public byte asByte() {
return (byte) value;
}
@Override
public short asShort() {
return (short) value;
}
@Override
public int asInt() {
return value;
}
@Override
public long asLong() {
return value;
}
@Override
public float asFloat() {
return value;
}
@Override
public double asDouble() {
return value;
}
@Override
public String asString() {
return Integer.toString(value);
}
@Override
public <T> T as(Class<T> cls) {
throw new ZenRuntimeException("cannot convert a byte to an object");
}
@Override
public Iterator<IAny> iteratorSingle() {
throw new ZenRuntimeException("cannot iterate over a byte value");
}
@Override
public Iterator<IAny[]> iteratorMulti(int n) {
throw new ZenRuntimeException("cannot iterate over a byte value");
}
}
@@ -7,107 +7,126 @@
package stanhebben.zenscript.value.builtin;
import java.util.Iterator;
import stanhebben.zenscript.ZenRuntimeException;
import stanhebben.zenscript.value.IAny;
import stanhebben.zenscript.value.IntRange;
/**
*
* @author Stanneke
*/
public class AnyIntRange implements IAny {
private IntRange value;
public AnyIntRange(IntRange value) {
this.value = value;
}
@Override
public IAny not() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot invert an int range");
}
@Override
public IAny neg() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot negate an int range");
}
@Override
public IAny add(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot add int ranges");
}
@Override
public IAny sub(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot subtract int ranges");
}
@Override
public IAny cat(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot concatenate int ranges");
}
@Override
public IAny mul(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot multiply int ranges");
}
@Override
public IAny div(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot divide int ranges");
}
@Override
public IAny mod(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot perform modulo on int ranges");
}
@Override
public IAny and(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot perform and on int ranges");
}
@Override
public IAny or(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot perform or on int ranges");
}
@Override
public IAny xor(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot perform xor on int ranges");
}
@Override
public IAny range(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Already a range!");
}
@Override
public int compareTo(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot compare ranges");
}
@Override
public boolean contains(IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
int ivalue = value.asInt();
return ivalue >= this.value.getFrom() && ivalue < this.value.getTo();
}
@Override
public IAny member(String value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
if (value.equals("from")) {
return new AnyInt(this.value.getFrom());
} else if (value.equals("to")) {
return new AnyInt(this.value.getTo());
} else {
throw new ZenRuntimeException("No member " + value + " in int range");
}
}
@Override
public IAny indexGet(IAny key) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
int ivalue = key.asInt();
if (ivalue < value.getTo() - value.getFrom()) {
return new AnyInt(this.value.getFrom() + ivalue);
} else {
throw new ArrayIndexOutOfBoundsException("int range index out of bounds: " + ivalue);
}
}
@Override
public void indexSet(IAny key, IAny value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot modify int ranges");
}
@Override
public IAny call(IAny... values) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot call int ranges");
}
@Override
public boolean asBool() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new ZenRuntimeException("Cannot cast int range to bool");
}
@Override
@@ -159,5 +178,4 @@ public class AnyIntRange implements IAny {
public Iterator<IAny[]> iteratorMulti(int n) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}