Fixed formatting

This commit is contained in:
Jared 2017-07-25 22:56:19 +02:00
parent d4a9c12add
commit 03f8eed67b
14 changed files with 111 additions and 104 deletions

View file

@ -91,7 +91,7 @@ public class Anvil {
}
public static Object[] toShapedAnvilObjects(IIngredient[][] ingredients) {
if (ingredients == null)
if(ingredients == null)
return null;
else {
ArrayList prep = new ArrayList();
@ -100,10 +100,10 @@ public class Anvil {
prep.add("ijkl");
prep.add("mnop");
char[][] map = new char[][]{{'a', 'b', 'c', 'd'}, {'e', 'f', 'g', 'h'}, {'i', 'j', 'k', 'l'}, {'m', 'n', 'o', 'p'}};
for (int x = 0; x < ingredients.length; x++) {
if (ingredients[x] != null) {
for (int y = 0; y < ingredients[x].length; y++) {
if (ingredients[x][y] != null && x < map.length && y < map[x].length) {
for(int x = 0; x < ingredients.length; x++) {
if(ingredients[x] != null) {
for(int y = 0; y < ingredients[x].length; y++) {
if(ingredients[x][y] != null && x < map.length && y < map[x].length) {
prep.add(map[x][y]);
prep.add(InputHelper.toObject(ingredients[x][y]));
}
@ -115,6 +115,7 @@ public class Anvil {
}
public static class RemoveShaped extends BaseUndoable {
private final IItemStack output;
private final IIngredient[][] ingredients;
@ -126,17 +127,17 @@ public class Anvil {
@Override
public void apply() {
if (ingredients != null) {
if(ingredients != null) {
IRecipe removal = new ShapedAnvilRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), toShapedAnvilObjects(ingredients));
for (Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
for(Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput().isItemEqual(removal.getRecipeOutput()) && removal.getIngredients().equals(recipe.getIngredients()))
if(recipe.getRecipeOutput().isItemEqual(removal.getRecipeOutput()) && removal.getIngredients().equals(recipe.getIngredients()))
iterator.remove();
}
} else {
for (Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
for(Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput().isItemEqual(InputHelper.toStack(output))) {
if(recipe.getRecipeOutput().isItemEqual(InputHelper.toStack(output))) {
iterator.remove();
}
}
@ -151,6 +152,7 @@ public class Anvil {
}
public static class RemoveShapeless extends BaseUndoable {
private final IItemStack output;
private final IIngredient[] ingredients;
@ -162,17 +164,17 @@ public class Anvil {
@Override
public void apply() {
if (ingredients != null) {
if(ingredients != null) {
IRecipe removal = new ShapelessAnvilRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), InputHelper.toObjects(ingredients));
for (Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
for(Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput().isItemEqual(removal.getRecipeOutput()) && removal.getIngredients().equals(recipe.getIngredients()))
if(recipe.getRecipeOutput().isItemEqual(removal.getRecipeOutput()) && removal.getIngredients().equals(recipe.getIngredients()))
iterator.remove();
}
} else {
for (Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
for(Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput().isItemEqual(InputHelper.toStack(output))) {
if(recipe.getRecipeOutput().isItemEqual(InputHelper.toStack(output))) {
iterator.remove();
}
}

View file

@ -21,11 +21,12 @@ public class Buoyancy {
@ZenMethod
public static void set(IItemStack stack, float value) {
StackMap<Float> map = new StackMap(1.0);
map.put(new Stack(InputHelper.toStack(stack)),value);
map.put(new Stack(InputHelper.toStack(stack)), value);
CraftTweakerAPI.apply(new Set(map));
}
public static class Set extends BaseMapAddition<Stack, Float> {
protected Set(StackMap<Float> map) {
super("Set Item Buoyancy", HCBuoy.buoyancy, map);
}

View file

@ -33,8 +33,8 @@ public class Cauldron {
}
@ZenMethod
public static void remove(IItemStack output,@Optional IItemStack secondary, IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Cauldron Recipe", CauldronManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY, InputHelper.toObjects(inputs)));
public static void remove(IItemStack output, @Optional IItemStack secondary, IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Cauldron Recipe", CauldronManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY, InputHelper.toObjects(inputs)));
}
}

View file

@ -31,7 +31,7 @@ public class Kiln {
@ZenMethod
public static void add(IItemStack[] output, @NotNull IItemStack input) {
ItemStack stack = InputHelper.toStack(input);
if (InputHelper.isABlock(stack)) {
if(InputHelper.isABlock(stack)) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
ItemStack[] outputs = InputHelper.toStacks(output);
KilnRecipe r = new KilnRecipe(block, stack.getMetadata(), Arrays.asList(outputs));
@ -52,6 +52,7 @@ public class Kiln {
public static class KilnBlock extends BaseUndoable {
private IBlockState state;
protected KilnBlock(IBlockState state) {

View file

@ -23,17 +23,17 @@ public class Mill {
@ZenMethod
public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) {
MillRecipe r = new MillRecipe(0,InputHelper.toStack(output),InputHelper.toStack(secondaryOutput),InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Mill Recipe", MillManager.getInstance(),r));
MillRecipe r = new MillRecipe(0, InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Mill Recipe", MillManager.getInstance(), r));
}
@ZenMethod
public static void remove(IItemStack output) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Mill Recipe", MillManager.getInstance(),InputHelper.toStack(output), ItemStack.EMPTY));
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Mill Recipe", MillManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY));
}
@ZenMethod
public static void remove(IItemStack output, IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Mill Recipe", MillManager.getInstance(),InputHelper.toStack(output), ItemStack.EMPTY, InputHelper.toObjects(inputs)));
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Mill Recipe", MillManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY, InputHelper.toObjects(inputs)));
}
}

View file

@ -28,7 +28,7 @@ public class Saw {
@ZenMethod
public static void add(IItemStack[] output, @NotNull IItemStack input) {
ItemStack stack = InputHelper.toStack(input);
if (InputHelper.isABlock(stack)) {
if(InputHelper.isABlock(stack)) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
ItemStack[] outputs = InputHelper.toStacks(output);
SawRecipe r = new SawRecipe(block, stack.getMetadata(), Arrays.asList(outputs));

View file

@ -24,17 +24,17 @@ public class StokedCauldron {
@ZenMethod
public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) {
StokedCauldronRecipe r = new StokedCauldronRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput),InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Stoked Cauldron Recipe", StokedCauldronManager.getInstance(),r));
StokedCauldronRecipe r = new StokedCauldronRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Stoked Cauldron Recipe", StokedCauldronManager.getInstance(), r));
}
@ZenMethod
public static void remove(IItemStack output) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Cauldron Recipe", StokedCauldronManager.getInstance(),InputHelper.toStack(output), ItemStack.EMPTY));
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Cauldron Recipe", StokedCauldronManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY));
}
@ZenMethod
public static void remove(IItemStack output, IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Cauldron Recipe", StokedCauldronManager.getInstance(),InputHelper.toStack(output), ItemStack.EMPTY, InputHelper.toObjects(inputs)));
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Cauldron Recipe", StokedCauldronManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY, InputHelper.toObjects(inputs)));
}
}

View file

@ -26,12 +26,13 @@ public class Turntable {
@ZenMethod
public static void add(IItemStack inputBlock, IItemStack outputBlock, IItemStack[] additionalOutput) {
if (InputHelper.isABlock(inputBlock))
if(InputHelper.isABlock(inputBlock))
LogHelper.logError("Input must be a block", new IllegalArgumentException());
ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(inputBlock), InputHelper.toStack(outputBlock), Lists.newArrayList(InputHelper.toStacks(additionalOutput))));
}
public static class Add extends BMAdd {
public Add(ItemStack input, ItemStack output, List<ItemStack> scraps) {
super(TurntableRecipeCategory.UID, TurntableManager.INSTANCE, Lists.newArrayList(new TurntableRecipe(input, output, scraps)));
}
@ -39,12 +40,13 @@ public class Turntable {
@ZenMethod
public static void remove(IItemStack inputBlock) {
if (!InputHelper.isABlock(inputBlock))
if(!InputHelper.isABlock(inputBlock))
LogHelper.logError("Input must be a block", new IllegalArgumentException());
ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(inputBlock)));
}
public static class Remove extends BaseListRemoval<TurntableRecipe> {
protected Remove(ItemStack input) {
super("Remove Turntable Recipe", TurntableManager.INSTANCE.getRecipes(), TurntableManager.INSTANCE.removeTurntableRecipe(input));
}

View file

@ -6,6 +6,7 @@ import com.blamejared.mtlib.utils.BaseListRemoval;
import net.minecraft.item.ItemStack;
public class BMRemove extends BaseListRemoval<BlockMetaRecipe> {
public BMRemove(String name, BlockMetaManager recipes, ItemStack input) {
super(name, recipes.getRecipes(), recipes.removeRecipes(input));
}