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

Add RawOre to the OreProccessing Page #30

Merged
merged 16 commits into from
May 22, 2024
10 changes: 5 additions & 5 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ dependencies {
compileOnly('com.google.auto.value:auto-value-annotations:1.8.2')
annotationProcessor('com.google.auto.value:auto-value:1.8.2')

api('com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.5.26-GTNH:dev')

api('com.github.GTNewHorizons:DetravScannerMod:1.8.0:dev') {transitive=false}
api('com.github.GTNewHorizons:EnderStorage:1.5.0:dev') {transitive=false}
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.25:dev')
api('com.github.GTNewHorizons:GTplusplus:1.11.13:dev')
api('com.github.GTNewHorizons:NewHorizonsCoreMod:2.3.11:dev')
api('com.github.GTNewHorizons:bartworks:0.9.4:dev')
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.160-pre:dev')
api('com.github.GTNewHorizons:GTplusplus:1.11.57:dev')
api('com.github.GTNewHorizons:NewHorizonsCoreMod:2.3.48:dev')
api('com.github.GTNewHorizons:bartworks:0.9.21:dev')
}
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ channel = stable
mappingsVersion = 12

# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
Expand Down Expand Up @@ -61,6 +61,9 @@ gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =

# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =

# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
Expand Down Expand Up @@ -123,7 +126,7 @@ includeWellKnownRepositories = true
usesMavenPublishing = true

# Maven repository to publish the mod to.
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/

# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
Expand Down Expand Up @@ -187,5 +190,3 @@ customArchiveBaseName = NEICustomDiagram
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

# Non-GTNH properties
gradleTokenGroupName =
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.16'
}


Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ class DiagramBuilder {
private final RecipeHandler recipeHandler;

private final ItemComponent rawOre;
private final Optional<ItemComponent> trueRawOre;
private final Set<Component> craftingComponents;
private final Set<Component> usageComponents;
private final Diagram.Builder diagramBuilder;

DiagramBuilder(LayoutHandler layoutHandler, LabelHandler labelHandler, RecipeHandler recipeHandler,
List<ItemComponent> rawOres) {
List<ItemComponent> rawOres, Optional<ItemComponent> trueRawOres) {
Ethryan marked this conversation as resolved.
Show resolved Hide resolved
this.layoutHandler = layoutHandler;
this.labelHandler = labelHandler;
this.recipeHandler = recipeHandler;
Expand All @@ -71,6 +72,8 @@ class DiagramBuilder {
this.rawOre = rawOres.get(0);
}

this.trueRawOre = trueRawOres;

this.craftingComponents = new HashSet<>(filteredRawOres);
this.usageComponents = new HashSet<>(filteredRawOres);
Ethryan marked this conversation as resolved.
Show resolved Hide resolved
this.diagramBuilder = Diagram.builder();
Expand All @@ -79,6 +82,14 @@ class DiagramBuilder {
void buildDiagram(ComponentDiagramMatcher.Builder matcherBuilder) {
diagramBuilder.addAllOptionalLayouts(layoutHandler.layouts())
.insertIntoSlot(LayoutHandler.SlotKeys.RAW_ORE, DisplayComponent.builder(rawOre).build());
trueRawOre.ifPresent(v -> {
diagramBuilder.autoInsertIntoSlotGroup(LayoutHandler.SlotGroupKeys.TRUE_RAW_ORE)
Ethryan marked this conversation as resolved.
Show resolved Hide resolved
.insertIntoNextSlot(DisplayComponent.builder(v).build());
Optional<ItemComponent> crushedOreOptional = handleRecipes(
RecipeHandler.RecipeMap.MACERATOR,
v,
LayoutHandler.SlotGroupKeys.TRUE_RAW_ORE_MACERATE);
});

Optional<ItemComponent> crushedOreOptional = handleRecipes(
RecipeHandler.RecipeMap.MACERATOR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.items.GT_MetaGenerated_Item_03;
import gtPlusPlus.core.block.base.BlockBaseOre;
import gtPlusPlus.core.material.Material;

Expand All @@ -46,7 +47,8 @@ public final class GregTechOreProcessing implements DiagramGenerator {
OrePrefixes.oreSmall,
OrePrefixes.orePoor,
OrePrefixes.oreEndstone,
OrePrefixes.oreEnd);
OrePrefixes.oreEnd,
OrePrefixes.rawOre);
Ethryan marked this conversation as resolved.
Show resolved Hide resolved

private final DiagramGroupInfo info;

Expand Down Expand Up @@ -94,12 +96,15 @@ public DiagramGroup generate() {
OTHER_ORE_PREFIXES
.forEach(prefix -> rawOres.addAll(GregTechOreDictUtil.getAllComponents(prefix, material)));

buildDiagram(matcherBuilder, rawOres);
ItemComponent trueRawOres = GregTechOreDictUtil.getAllComponents(OrePrefixes.rawOre, material).get(0);
Ethryan marked this conversation as resolved.
Show resolved Hide resolved
Ethryan marked this conversation as resolved.
Show resolved Hide resolved

buildDiagram(matcherBuilder, rawOres, Optional.ofNullable(trueRawOres));
}

if (Registry.ModDependency.BARTWORKS.isLoaded()) {
for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) {
Optional<ItemComponent> rawOre = BartWorksOreDictUtil.getComponent(OrePrefixes.ore, werkstoff);
Optional<ItemComponent> trueRawOre = BartWorksOreDictUtil.getComponent(OrePrefixes.rawOre, werkstoff);
if (!rawOre.isPresent()) {
continue;
}
Expand All @@ -110,7 +115,7 @@ public DiagramGroup generate() {
OTHER_ORE_PREFIXES.forEach(
prefix -> BartWorksOreDictUtil.getComponent(prefix, werkstoff).ifPresent(rawOres::add));

buildDiagram(matcherBuilder, rawOres);
buildDiagram(matcherBuilder, rawOres, trueRawOre);
}
}

Expand All @@ -122,15 +127,21 @@ public DiagramGroup generate() {
continue;
}

buildDiagram(matcherBuilder, ImmutableList.of(ItemComponent.create(ore)));
buildDiagram(matcherBuilder, ImmutableList.of(ItemComponent.create(ore)), Optional.ofNullable(null));
}
}

return new DiagramGroup(info, matcherBuilder.build());
}

private void buildDiagram(ComponentDiagramMatcher.Builder matcherBuilder, List<ItemComponent> rawOres) {
DiagramBuilder diagramBuilder = new DiagramBuilder(layoutHandler, labelHandler, recipeHandler, rawOres);
private void buildDiagram(ComponentDiagramMatcher.Builder matcherBuilder, List<ItemComponent> rawOres,
Optional<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 @@ -140,4 +151,11 @@ static boolean isGregTechOreBlock(ItemComponent itemComponent) {
Block block = Block.getBlockFromItem(itemComponent.item());
return block instanceof GT_Block_Ores_Abstract;
}

static boolean isGregTechRawOreItem(ItemComponent itemComponent) {
Ethryan marked this conversation as resolved.
Show resolved Hide resolved
if (itemComponent == null) {
return false;
}
return itemComponent.item() instanceof GT_MetaGenerated_Item_03;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ static final class SlotKeys {

static final class SlotGroupKeys {

static final Layout.SlotGroupKey TRUE_RAW_ORE = Layout.SlotGroupKey.create("true-raw-ore");
Ethryan marked this conversation as resolved.
Show resolved Hide resolved
static final Layout.SlotGroupKey RAW_ORE_MACERATE = Layout.SlotGroupKey.create("raw-ore-macerate");
static final Layout.SlotGroupKey TRUE_RAW_ORE_MACERATE = Layout.SlotGroupKey.create("true-raw-ore-macerate");
static final Layout.SlotGroupKey CRUSHED_ORE_MACERATE = Layout.SlotGroupKey.create("crushed-ore-macerate");
static final Layout.SlotGroupKey CRUSHED_ORE_WASH = Layout.SlotGroupKey.create("crushed-ore-wash");
static final Layout.SlotGroupKey CRUSHED_ORE_BATH_MERCURY = Layout.SlotGroupKey
Expand Down Expand Up @@ -67,7 +69,9 @@ static final class AdditionalRecipeLabelPositions {
void initialize() {
ImmutableList.Builder<Layout> layoutsBuilder = new ImmutableList.Builder<>();
layoutsBuilder.add(buildRawOreLayout());
layoutsBuilder.add(buildTrueRawOreLayout());
layoutsBuilder.add(buildRawOreMacerateLayout());
layoutsBuilder.add(buildTrueRawOreMacerateLayout());
layoutsBuilder.add(buildCrushedOreWashLayout());
layoutsBuilder.add(buildCrushedOreBathMercuryLayout());
layoutsBuilder.add(buildCrushedOreBathSodiumPersulfateLayout());
Expand All @@ -88,8 +92,9 @@ ImmutableList<Layout> layouts() {
return layouts;
}

// Ores Block
private Layout buildRawOreLayout() {
Slot inputSlot = Slot.builder(Grid.GRID.grid(6, 4)).setDrawFunction(Draw::drawBigSlot)
Slot inputSlot = Slot.builder(Grid.GRID.grid(4, 2)).setDrawFunction(Draw::drawBigSlot)
.setTooltip(Tooltip.create(Lang.GREGTECH_5_ORE_PROCESSING.trans("oreslot"), Tooltip.SLOT_FORMATTING))
.build();

Expand All @@ -98,13 +103,23 @@ private Layout buildRawOreLayout() {
return Layout.builder().putSlot(SlotKeys.RAW_ORE, inputSlot).addInteractable(allDiagramsButton).build();
}

// Raw Ores Item
private Layout buildTrueRawOreLayout() {
SlotGroup inputSlot = SlotGroup.builder(1, 1, Grid.GRID.grid(6, 2), Grid.Direction.S)
.setDefaultDrawFunction(Draw::drawBigSlot)
.setDefaultTooltip(
Tooltip.create(Lang.GREGTECH_5_ORE_PROCESSING.trans("oreslot"), Tooltip.SLOT_FORMATTING))
Ethryan marked this conversation as resolved.
Show resolved Hide resolved
.build();

return Layout.builder().putSlotGroup(SlotGroupKeys.TRUE_RAW_ORE, inputSlot).build();
}

private Layout buildRawOreMacerateLayout() {
Lines lines = Lines.builder(Grid.GRID.grid(6, 4)).addSegment(Grid.GRID.grid(4, 4))
.addArrow(Grid.GRID.edge(4, 10, Grid.Direction.N)).build();
Lines lines = Lines.builder(Grid.GRID.grid(4, 2)).addArrow(Grid.GRID.edge(4, 8, Grid.Direction.N)).build();

CustomInteractable label = labelHandler.buildLabel(LabelHandler.ItemLabel.MACERATOR, Grid.GRID.grid(4, 8));
CustomInteractable label = labelHandler.buildLabel(LabelHandler.ItemLabel.MACERATOR, Grid.GRID.grid(4, 5));

SlotGroup outputSlots = SlotGroup.builder(1, 2, Grid.GRID.grid(4, 10), Grid.Direction.S)
SlotGroup outputSlots = SlotGroup.builder(1, 2, Grid.GRID.grid(4, 7), Grid.Direction.S)
.setDefaultTooltip(
Tooltip.create(Lang.GREGTECH_5_ORE_PROCESSING.trans("maceratorslot"), Tooltip.SLOT_FORMATTING))
.build();
Expand All @@ -113,8 +128,23 @@ private Layout buildRawOreMacerateLayout() {
.putSlotGroup(SlotGroupKeys.RAW_ORE_MACERATE, outputSlots).build();
}

private Layout buildTrueRawOreMacerateLayout() {
Lines lines = Lines.builder(Grid.GRID.grid(6, 2)).addArrow(Grid.GRID.edge(6, 8, Grid.Direction.N)).build();

CustomInteractable label = labelHandler.buildLabel(LabelHandler.ItemLabel.MACERATOR, Grid.GRID.grid(6, 5));

SlotGroup outputSlots = SlotGroup.builder(1, 2, Grid.GRID.grid(6, 7), Grid.Direction.S)
.setDefaultTooltip(
Tooltip.create(Lang.GREGTECH_5_ORE_PROCESSING.trans("maceratorslot"), Tooltip.SLOT_FORMATTING))
.build();

return Layout.builder().addLines(lines).addInteractable(label)
.putSlotGroup(SlotGroupKeys.TRUE_RAW_ORE_MACERATE, outputSlots).build();
}

private Layout buildCrushedOreMacerateLayout() {
Lines lines = Lines.builder(Grid.GRID.grid(4, 10)).addSegment(Grid.GRID.grid(2, 10))
Lines lines = Lines.builder(Grid.GRID.grid(4, 7)).addSegment(Grid.GRID.grid(3, 7))
.addSegment(Grid.GRID.grid(3, 10)).addSegment(Grid.GRID.grid(2, 10))
.addArrow(Grid.GRID.edge(2, 14, Grid.Direction.N)).build();

CustomInteractable label = labelHandler.buildLabel(LabelHandler.ItemLabel.MACERATOR, Grid.GRID.grid(2, 12));
Expand All @@ -129,8 +159,7 @@ private Layout buildCrushedOreMacerateLayout() {
}

private Layout buildCrushedOreWashLayout() {
Lines lines = Lines.builder(Grid.GRID.grid(4, 10)).addSegment(Grid.GRID.grid(5, 10))
.addSegment(Grid.GRID.grid(5, 8)).addSegment(Grid.GRID.grid(8, 8))
Lines lines = Lines.builder(Grid.GRID.grid(4, 7)).addSegment(Grid.GRID.grid(8, 7))
.addArrow(Grid.GRID.edge(8, 10, Grid.Direction.N)).build();

CustomInteractable label = labelHandler
Expand All @@ -145,7 +174,8 @@ private Layout buildCrushedOreWashLayout() {
}

private Layout buildCrushedOreBathMercuryLayout() {
Lines lines = Lines.builder(Grid.GRID.grid(4, 10)).addSegment(Grid.GRID.grid(0, 10))
Lines lines = Lines.builder(Grid.GRID.grid(4, 7)).addSegment(Grid.GRID.grid(3, 7))
.addSegment(Grid.GRID.grid(3, 10)).addSegment(Grid.GRID.grid(0, 10))
.addArrow(Grid.GRID.edge(0, 6, Grid.Direction.S)).build();

CustomInteractable label = labelHandler.buildLabel(LabelHandler.ItemLabel.CHEMICAL_BATH, Grid.GRID.grid(0, 8));
Expand All @@ -168,7 +198,8 @@ private Layout buildCrushedOreBathMercuryLayout() {
}

private Layout buildCrushedOreBathSodiumPersulfateLayout() {
Lines lines = Lines.builder(Grid.GRID.grid(4, 10)).addSegment(Grid.GRID.grid(2, 10))
Lines lines = Lines.builder(Grid.GRID.grid(4, 7)).addSegment(Grid.GRID.grid(3, 7))
.addSegment(Grid.GRID.grid(3, 10)).addSegment(Grid.GRID.grid(2, 10))
.addArrow(Grid.GRID.edge(2, 6, Grid.Direction.S)).build();

CustomInteractable label = labelHandler.buildLabel(LabelHandler.ItemLabel.CHEMICAL_BATH, Grid.GRID.grid(2, 8));
Expand Down Expand Up @@ -207,11 +238,11 @@ private Layout buildPurifiedOreMacerateLayout() {

private Layout buildPurifiedOreSiftLayout() {
Lines lines = Lines.builder(Grid.GRID.grid(8, 10)).addSegment(Grid.GRID.grid(10, 10))
.addArrow(Grid.GRID.edge(10, 6, Grid.Direction.S)).build();
.addArrow(Grid.GRID.edge(10, 5, Grid.Direction.S)).build();

CustomInteractable label = labelHandler.buildLabel(LabelHandler.ItemLabel.SIFTER, Grid.GRID.grid(10, 8));

SlotGroup outputSlots = SlotGroup.builder(3, 3, Grid.GRID.grid(10, 6), Grid.Direction.N)
SlotGroup outputSlots = SlotGroup.builder(3, 3, Grid.GRID.grid(10, 5), Grid.Direction.N)
.setDefaultTooltip(
Tooltip.create(Lang.GREGTECH_5_ORE_PROCESSING.trans("sifterslot"), Tooltip.SLOT_FORMATTING))
.build();
Expand Down Expand Up @@ -269,7 +300,7 @@ private Layout buildPurifiedDustElectromagneticSeparateLayout() {
}

private Layout buildOreThermalCentrifugeLayout() {
Lines lines = Lines.builder(Grid.GRID.grid(4, 10)).addSegment(Grid.GRID.grid(5, 10))
Lines lines = Lines.builder(Grid.GRID.grid(4, 7)).addSegment(Grid.GRID.grid(5, 7))
.addSegment(Grid.GRID.grid(5, 12)).addSegment(Grid.GRID.grid(7, 12)).addSegment(Grid.GRID.grid(7, 10))
.addSegment(Grid.GRID.grid(8, 10)).move(Grid.GRID.grid(6, 12))
.addArrow(Grid.GRID.edge(6, 14, Grid.Direction.N)).build();
Expand Down
Loading