diff options
| author | Raven Szewczyk <git@eigenraven.me> | 2024-05-23 17:41:55 +0100 |
|---|---|---|
| committer | Raven Szewczyk <git@eigenraven.me> | 2024-05-23 17:41:55 +0100 |
| commit | dc9f68ad0ab8ce378a1680da0d59510de1f7236c (patch) | |
| tree | a8ff3976cef19443247f200fd69451884e79bf67 /src/main/java/net/glease/ggfab/api | |
| parent | 0cce27d780a9fa7afc2e7673c5ba590eaa27ead9 (diff) | |
| download | GT5-Unofficial-dc9f68ad0ab8ce378a1680da0d59510de1f7236c.tar.gz GT5-Unofficial-dc9f68ad0ab8ce378a1680da0d59510de1f7236c.tar.bz2 GT5-Unofficial-dc9f68ad0ab8ce378a1680da0d59510de1f7236c.zip | |
Spotless
Diffstat (limited to 'src/main/java/net/glease/ggfab/api')
| -rw-r--r-- | src/main/java/net/glease/ggfab/api/GGFabRecipeMaps.java | 65 | ||||
| -rw-r--r-- | src/main/java/net/glease/ggfab/api/GigaGramFabAPI.java | 4 |
2 files changed, 39 insertions, 30 deletions
diff --git a/src/main/java/net/glease/ggfab/api/GGFabRecipeMaps.java b/src/main/java/net/glease/ggfab/api/GGFabRecipeMaps.java index 088e9a7782..039b9d2b58 100644 --- a/src/main/java/net/glease/ggfab/api/GGFabRecipeMaps.java +++ b/src/main/java/net/glease/ggfab/api/GGFabRecipeMaps.java @@ -22,34 +22,43 @@ import gregtech.api.util.GT_Recipe; public class GGFabRecipeMaps { public static final RecipeMetadataKey<ToolDictNames> OUTPUT_TYPE = SimpleRecipeMetadataKey - .create(ToolDictNames.class, "output_type"); + .create(ToolDictNames.class, "output_type"); public static final RecipeMetadataKey<Integer> OUTPUT_COUNT = SimpleRecipeMetadataKey - .create(Integer.class, "output_count"); + .create(Integer.class, "output_count"); public static final RecipeMap<RecipeMapBackend> toolCastRecipes = RecipeMapBuilder.of("ggfab.recipe.toolcast") - .maxIO(1, 4, 1, 0).minInputs(1, 1).progressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .recipeEmitter(b -> { - Optional<GT_Recipe> rr = b.noOptimize().validateNoInput().validateInputFluidCount(0, 1) - .validateNoOutput().validateNoOutputFluid().build(); - if (!rr.isPresent()) return Collections.emptyList(); - ToolDictNames outputType = b.getMetadata(OUTPUT_TYPE); - GT_Recipe r = rr.get(); - int outputSize = b.getMetadataOrDefault(OUTPUT_COUNT, 0); - if (outputSize > 64 * 4 || outputSize <= 0) return Collections.emptyList(); - ItemStack shape, output; - try { - shape = GGItemList.valueOf("Shape_One_Use_" + outputType).get(0L); - output = GGItemList.valueOf("One_Use_" + outputType).get(outputSize); - } catch (IllegalArgumentException ex) { - // this looks like python not java, but I don't have better way around this - return Collections.emptyList(); - } - output.stackSize = outputSize; - List<ItemStack> outputs = new ArrayList<>(); - int maxStackSize = output.getMaxStackSize(); - while (output.stackSize > maxStackSize) outputs.add(output.splitStack(maxStackSize)); - outputs.add(output); - r.mInputs = new ItemStack[] { shape }; - r.mOutputs = outputs.toArray(new ItemStack[0]); - return Collections.singletonList(r); - }).build(); + .maxIO(1, 4, 1, 0) + .minInputs(1, 1) + .progressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .recipeEmitter(b -> { + Optional<GT_Recipe> rr = b.noOptimize() + .validateNoInput() + .validateInputFluidCount(0, 1) + .validateNoOutput() + .validateNoOutputFluid() + .build(); + if (!rr.isPresent()) return Collections.emptyList(); + ToolDictNames outputType = b.getMetadata(OUTPUT_TYPE); + GT_Recipe r = rr.get(); + int outputSize = b.getMetadataOrDefault(OUTPUT_COUNT, 0); + if (outputSize > 64 * 4 || outputSize <= 0) return Collections.emptyList(); + ItemStack shape, output; + try { + shape = GGItemList.valueOf("Shape_One_Use_" + outputType) + .get(0L); + output = GGItemList.valueOf("One_Use_" + outputType) + .get(outputSize); + } catch (IllegalArgumentException ex) { + // this looks like python not java, but I don't have better way around this + return Collections.emptyList(); + } + output.stackSize = outputSize; + List<ItemStack> outputs = new ArrayList<>(); + int maxStackSize = output.getMaxStackSize(); + while (output.stackSize > maxStackSize) outputs.add(output.splitStack(maxStackSize)); + outputs.add(output); + r.mInputs = new ItemStack[] { shape }; + r.mOutputs = outputs.toArray(new ItemStack[0]); + return Collections.singletonList(r); + }) + .build(); } diff --git a/src/main/java/net/glease/ggfab/api/GigaGramFabAPI.java b/src/main/java/net/glease/ggfab/api/GigaGramFabAPI.java index 7797d037c3..6b35b26486 100644 --- a/src/main/java/net/glease/ggfab/api/GigaGramFabAPI.java +++ b/src/main/java/net/glease/ggfab/api/GigaGramFabAPI.java @@ -16,11 +16,11 @@ public class GigaGramFabAPI { private static final Map<ToolDictNames, IToolStats> SINGLE_USE_TOOLS_STORE = new HashMap<>(); public static final Map<ToolDictNames, IToolStats> SINGLE_USE_TOOLS = Collections - .unmodifiableMap(SINGLE_USE_TOOLS_STORE); + .unmodifiableMap(SINGLE_USE_TOOLS_STORE); private static final Map<ToolDictNames, Long> COST_SINGLE_USE_TOOLS_STORE = new HashMap<>(); public static final Map<ToolDictNames, Long> COST_SINGLE_USE_TOOLS = Collections - .unmodifiableMap(COST_SINGLE_USE_TOOLS_STORE); + .unmodifiableMap(COST_SINGLE_USE_TOOLS_STORE); public static void addSingleUseToolType(ToolDictNames type, IToolStats stat, long materialCost) { if (SINGLE_USE_TOOLS_STORE.put(type, stat) != null) |
