Tons of changes:

- Added interface to game, client and server
- Added transformations
- Made ingredient conditions more practical to use, no longer requires imports
- Started implementation of event handling
- Moved commands and logic to the common API code
- Added common interface to MineTweaker recipes
- Added string methods
- Moved the logger from static value to static getter
- Fixed crashes on dedicated servers
- Fixed bracket resolution for <id:meta> values in 1.6.4
- Fixed scripts not being sent to multiplayer clients in 1.6.4
This commit is contained in:
Stan Hebben committed 2014-07-04 22:03:03 +02:00
1 parent 7f6235f30d
commit 115593efa5
131 files changed
+3215 -1930

No files matched your search

@@ -15,7 +15,7 @@ import minetweaker.api.item.IItemStack;
*
* @author Stan
*/
public class ShapelessRecipe {
public class ShapelessRecipe implements ICraftingRecipe {
private final IItemStack output;
private final IRecipeFunction function;
private final IIngredient[] ingredients;
@@ -38,10 +38,12 @@ public class ShapelessRecipe {
return output;
}
@Override
public boolean matches(ICraftingInventory inventory) {
return matchShapeless(ingredients, inventory) != null;
}
@Override
public IItemStack getCraftingResult(ICraftingInventory inventory) {
RecipeMatching matching = matchShapeless(ingredients, inventory);
@@ -54,13 +56,20 @@ public class ShapelessRecipe {
}
}
actualOutput = function.process(actualOutput, map, inventory);
actualOutput = function.process(actualOutput, map, new CraftingInfo(inventory, null));
}
if (actualOutput == null) {
return null;
}
return actualOutput;
}
@Override
public void applyTransformers(ICraftingInventory inventory) {
RecipeMatching matching = matchShapeless(ingredients, inventory);
for (int i = 0; i < ingredients.length; i++) {
IIngredient ingredient = ingredients[i];
IItemStack transformed = ingredient.applyTransform(matching.inputs[i]);
@@ -68,8 +77,6 @@ public class ShapelessRecipe {
inventory.setStack(matching.indices[i], transformed);
}
}
return actualOutput;
}
/**
@@ -116,6 +123,17 @@ public class ShapelessRecipe {
return new RecipeMatching(matched, indices);
}
@Override
public boolean hasTransformers() {
for (IIngredient ingredient : ingredients) {
if (ingredient.hasTransformers()) {
return true;
}
}
return false;
}
private static class RecipeMatching {
public final IItemStack[] inputs;
public final int[] indices;