mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-19 19:49:35 +00:00
- Added toString to the data values
- Added getPlayer to crafting inventory - Added crafting inventory to recipe function - Removed some print statements - Renamed the global minetweaker variable to tweaker - Bumped forge version to 1121 due to ore dictionary changes - Added bracket handler for ore entries - Enabled withTag(null) - Fixed issues with the new ore dictionary implementation in Forge 1113+ - Fixed bug in Ore recipe conversion - Fixed import errors not being detected and reported properly - Fixed nested NBT tags not being converted properly - Fixed something in any type implementation - Added commas in function name generation - Added class registries for IC2 and NEI integration
This commit is contained in:
1 parent
2de467d7d8
commit
3827eba3e2
39 files changed
+301
-50
No files matched your search
@@ -184,4 +184,9 @@ public class DataBool implements IData {
|
||||
public IData not() {
|
||||
return new DataBool(!value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
}
|
||||
@@ -184,4 +184,9 @@ public class DataByte implements IData {
|
||||
public IData not() {
|
||||
return new DataByte((byte) (~ value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString() + " as byte";
|
||||
}
|
||||
}
|
||||
@@ -217,4 +217,9 @@ public class DataByteArray implements IData {
|
||||
public <T> T convert(IDataConverter<T> converter) {
|
||||
return converter.fromByteArray(this.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString() + " as byte[]";
|
||||
}
|
||||
}
|
||||
@@ -184,4 +184,9 @@ public class DataDouble implements IData {
|
||||
public IData not() {
|
||||
throw new UnsupportedOperationException("Cannot perform bitwise operations on double");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
}
|
||||
@@ -184,4 +184,9 @@ public class DataFloat implements IData {
|
||||
public IData not() {
|
||||
throw new UnsupportedOperationException("Cannot perform bitwise operations on float");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString() + " as float";
|
||||
}
|
||||
}
|
||||
@@ -184,4 +184,9 @@ public class DataInt implements IData {
|
||||
public IData not() {
|
||||
return new DataInt(~ value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
}
|
||||
@@ -219,4 +219,9 @@ public class DataIntArray implements IData {
|
||||
public <T> T convert(IDataConverter<T> converter) {
|
||||
return converter.fromIntArray(this.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString() + " as int[]";
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class DataList implements IData {
|
||||
} else {
|
||||
output.append(", ");
|
||||
}
|
||||
output.append(value.asString());
|
||||
output.append(value.toString());
|
||||
}
|
||||
output.append(']');
|
||||
return output.toString();
|
||||
@@ -240,4 +240,9 @@ public class DataList implements IData {
|
||||
public IData not() {
|
||||
throw new UnsupportedOperationException("Lists don't support bitwise operators");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
}
|
||||
@@ -184,4 +184,9 @@ public class DataLong implements IData {
|
||||
public IData not() {
|
||||
return new DataLong(~ value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString() + " as long";
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class DataMap implements IData {
|
||||
public String asString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append('{');
|
||||
boolean first = false;
|
||||
boolean first = true;
|
||||
for (Map.Entry<String, IData> entry : data.entrySet()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
@@ -142,7 +142,7 @@ public class DataMap implements IData {
|
||||
}
|
||||
result.append(entry.getKey());
|
||||
result.append(": ");
|
||||
result.append(entry.getValue().asString());
|
||||
result.append(entry.getValue().toString());
|
||||
}
|
||||
result.append('}');
|
||||
return result.toString();
|
||||
@@ -207,7 +207,7 @@ public class DataMap implements IData {
|
||||
for (Map.Entry<String, IData> dataEntry : dataMap.entrySet()) {
|
||||
if (!this.data.containsKey(dataEntry.getKey())) {
|
||||
return false;
|
||||
} else if (!this.data.get(dataEntry.getKey()).contains(data)) {
|
||||
} else if (!this.data.get(dataEntry.getKey()).contains(dataEntry.getValue())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -269,4 +269,9 @@ public class DataMap implements IData {
|
||||
public <T> T convert(IDataConverter<T> converter) {
|
||||
return converter.fromMap(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
}
|
||||
@@ -184,4 +184,9 @@ public class DataShort implements IData {
|
||||
public IData not() {
|
||||
return new DataShort((short) (~ value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString() + " as short";
|
||||
}
|
||||
}
|
||||
@@ -188,4 +188,9 @@ public class DataString implements IData {
|
||||
public IData not() {
|
||||
throw new UnsupportedOperationException("Cannot perform bitwise arithmetic on a string");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return '\"' + value.replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
}
|
||||
@@ -120,4 +120,7 @@ public interface IData {
|
||||
public IData update(IData data);
|
||||
|
||||
public <T> T convert(IDataConverter<T> converter);
|
||||
|
||||
@Override
|
||||
public String toString();
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
package minetweaker.api.recipes;
|
||||
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
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.recipes.ICraftingInventory")
|
||||
public interface ICraftingInventory {
|
||||
@ZenGetter("player")
|
||||
public IPlayer getPlayer();
|
||||
|
||||
@ZenGetter("size")
|
||||
public int getSize();
|
||||
|
||||
|
||||
@@ -16,5 +16,5 @@ import stanhebben.zenscript.annotations.ZenClass;
|
||||
*/
|
||||
@ZenClass("minetweaker.recipes.IRecipeFunction")
|
||||
public interface IRecipeFunction {
|
||||
public IItemStack process(IItemStack output, Map<String, IItemStack> inputs);
|
||||
public IItemStack process(IItemStack output, Map<String, IItemStack> inputs, ICraftingInventory inventory);
|
||||
}
|
||||
@@ -64,11 +64,11 @@ public class ShapedRecipe {
|
||||
this.height = height1;
|
||||
this.mirrored = mirrored;
|
||||
|
||||
System.out.println("ShapedRecipe width=" + width + ", height=" + height);
|
||||
/*System.out.println("ShapedRecipe width=" + width + ", height=" + height);
|
||||
System.out.println("Ingredients: ");
|
||||
for (int i = 0; i < this.ingredients.length; i++) {
|
||||
System.out.println("(" + posx[i] + ", " + posy[i] + "): " + this.ingredients[i]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
@@ -187,7 +187,8 @@ public class ShapedRecipe {
|
||||
}
|
||||
}
|
||||
|
||||
output = function.process(output, tagged);
|
||||
output = function.process(output, tagged, inventory);
|
||||
System.out.println("Ouput: " + output);
|
||||
}
|
||||
|
||||
if (output == null) {
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ShapelessRecipe {
|
||||
}
|
||||
}
|
||||
|
||||
actualOutput = function.process(actualOutput, map);
|
||||
actualOutput = function.process(actualOutput, map, inventory);
|
||||
}
|
||||
|
||||
if (actualOutput == null) {
|
||||
|
||||
Reference in new issue
Block a user