Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotless apply for branch raw-ores-patch for #30 #32

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.util.function.Function;
import java.util.stream.Collectors;

import javax.annotation.Nullable;

import com.github.dcysteine.neicustomdiagram.api.diagram.Diagram;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.Component;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.DisplayComponent;
Expand All @@ -34,8 +36,6 @@
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;

import javax.annotation.Nullable;

class DiagramBuilder {

private static final ItemComponent STONE_DUST = ItemComponent
Expand All @@ -52,7 +52,7 @@ class DiagramBuilder {
private final Diagram.Builder diagramBuilder;

DiagramBuilder(LayoutHandler layoutHandler, LabelHandler labelHandler, RecipeHandler recipeHandler,
List<ItemComponent> rawOres, @Nullable ItemComponent trueRawOres) {
List<ItemComponent> rawOres, @Nullable ItemComponent trueRawOres) {
this.layoutHandler = layoutHandler;
this.labelHandler = labelHandler;
this.recipeHandler = recipeHandler;
Expand Down Expand Up @@ -84,10 +84,10 @@ class DiagramBuilder {
void buildDiagram(ComponentDiagramMatcher.Builder matcherBuilder) {
diagramBuilder.addAllOptionalLayouts(layoutHandler.layouts())
.insertIntoSlot(LayoutHandler.SlotKeys.RAW_ORE, DisplayComponent.builder(rawOre).build());
trueRawOre.ifPresent(v -> {
trueRawOre.ifPresent(v -> {
diagramBuilder.autoInsertIntoSlotGroup(LayoutHandler.SlotGroupKeys.TRUE_RAW_ORE)
.insertIntoNextSlot(DisplayComponent.builder(v).build());
});
});

Optional<ItemComponent> crushedOreOptional = handleRecipes(
RecipeHandler.RecipeMap.MACERATOR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import java.util.List;
import java.util.Optional;

import it.unimi.dsi.fastutil.Pair;
import javax.annotation.Nullable;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;

Expand All @@ -29,8 +30,6 @@
import gtPlusPlus.core.block.base.BlockBaseOre;
import gtPlusPlus.core.material.Material;

import javax.annotation.Nullable;

/** Generates ore processing diagrams for GregTech ores. */
public final class GregTechOreProcessing implements DiagramGenerator {

Expand All @@ -53,7 +52,6 @@ public final class GregTechOreProcessing implements DiagramGenerator {
OrePrefixes.oreEnd,
OrePrefixes.rawOre);


private final DiagramGroupInfo info;

private final LabelHandler labelHandler;
Expand Down Expand Up @@ -137,8 +135,14 @@ public DiagramGroup generate() {
return new DiagramGroup(info, matcherBuilder.build());
}

private void buildDiagram(ComponentDiagramMatcher.Builder matcherBuilder, List<ItemComponent> rawOres, @Nullable ItemComponent trueRawOre) {
DiagramBuilder diagramBuilder = new DiagramBuilder(layoutHandler, labelHandler, recipeHandler, rawOres, trueRawOre);
private void buildDiagram(ComponentDiagramMatcher.Builder matcherBuilder, List<ItemComponent> rawOres,
@Nullable ItemComponent trueRawOre) {
DiagramBuilder diagramBuilder = new DiagramBuilder(
layoutHandler,
labelHandler,
recipeHandler,
rawOres,
trueRawOre);
diagramBuilder.buildDiagram(matcherBuilder);

Logger.GREGTECH_5_ORE_PROCESSING.debug("Generated diagram [{}]", rawOres.get(0));
Expand All @@ -150,7 +154,9 @@ static boolean isGregTechOreBlock(ItemComponent itemComponent) {
}

static boolean isGregTechRawOreItem(ItemComponent itemComponent) {
if (itemComponent == null) {return false;}
if (itemComponent == null) {
return false;
}
return itemComponent.item() instanceof GT_MetaGenerated_Item_03;
}
}