-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: recipe mod integration for jei and emi
Ghost dragging support.
- Loading branch information
1 parent
035e0ff
commit 4ed86ba
Showing
8 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
refinedarchitectVersion=0.20.0 | ||
refinedstorageVersion=2.0.0-milestone.4.10 | ||
refinedstorageJeiIntegrationVersion=0.6.0 | ||
# https://www.curseforge.com/minecraft/mc-mods/mekanism/files/all | ||
mekanismVersion=10.7.7.64 | ||
jeiVersion=19.20.0.241 | ||
emiVersion=1.1.11+1.21 | ||
minecraftVersion=1.21.1 | ||
# Gradle | ||
org.gradle.jvmargs=-Xmx1G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...inedmods/refinedstorage/mekanism/recipemod/EmiChemicalResourceModIngredientConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.refinedmods.refinedstorage.mekanism.recipemod; | ||
|
||
import com.refinedmods.refinedstorage.api.resource.ResourceAmount; | ||
import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; | ||
import com.refinedmods.refinedstorage.common.api.support.resource.RecipeModIngredientConverter; | ||
import com.refinedmods.refinedstorage.mekanism.ChemicalResource; | ||
|
||
import java.util.Optional; | ||
|
||
import dev.emi.emi.api.stack.EmiStack; | ||
import mekanism.api.IMekanismAccess; | ||
import mekanism.api.chemical.Chemical; | ||
import net.neoforged.neoforge.fluids.FluidType; | ||
|
||
import static com.refinedmods.refinedstorage.mekanism.ChemicalResource.ofChemicalStack; | ||
|
||
public class EmiChemicalResourceModIngredientConverter implements RecipeModIngredientConverter { | ||
@Override | ||
public Optional<PlatformResourceKey> convertToResource(final Object ingredient) { | ||
if (ingredient instanceof EmiStack emiStack) { | ||
return IMekanismAccess.INSTANCE.emiHelper() | ||
.asChemicalStack(emiStack) | ||
.map(ChemicalResource::ofChemicalStack); | ||
} | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<ResourceAmount> convertToResourceAmount(final Object ingredient) { | ||
if (ingredient instanceof EmiStack emiStack) { | ||
return IMekanismAccess.INSTANCE.emiHelper() | ||
.asChemicalStack(emiStack) | ||
.map(chemical -> new ResourceAmount(ofChemicalStack(chemical), emiStack.getAmount())); | ||
} | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<Object> convertToIngredient(final PlatformResourceKey resourceKey) { | ||
if (resourceKey instanceof ChemicalResource(Chemical chemical)) { | ||
return Optional.of(IMekanismAccess.INSTANCE.emiHelper().createEmiStack(chemical, FluidType.BUCKET_VOLUME)); | ||
} | ||
return Optional.empty(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...efinedmods/refinedstorage/mekanism/recipemod/JeiChemicalRecipeModIngredientConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.refinedmods.refinedstorage.mekanism.recipemod; | ||
|
||
import com.refinedmods.refinedstorage.api.resource.ResourceAmount; | ||
import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; | ||
import com.refinedmods.refinedstorage.common.api.support.resource.RecipeModIngredientConverter; | ||
import com.refinedmods.refinedstorage.mekanism.ChemicalResource; | ||
|
||
import java.util.Optional; | ||
|
||
import mekanism.api.chemical.Chemical; | ||
import mekanism.api.chemical.ChemicalStack; | ||
import net.neoforged.neoforge.fluids.FluidType; | ||
|
||
import static com.refinedmods.refinedstorage.mekanism.ChemicalResource.ofChemicalStack; | ||
|
||
public class JeiChemicalRecipeModIngredientConverter implements RecipeModIngredientConverter { | ||
@Override | ||
public Optional<PlatformResourceKey> convertToResource(final Object ingredient) { | ||
if (ingredient instanceof ChemicalStack stack) { | ||
return Optional.of(ofChemicalStack(stack)); | ||
} | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<ResourceAmount> convertToResourceAmount(final Object ingredient) { | ||
if (ingredient instanceof ChemicalStack stack) { | ||
return Optional.of(new ResourceAmount(ofChemicalStack(stack), stack.getAmount())); | ||
} | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<Object> convertToIngredient(final PlatformResourceKey resourceKey) { | ||
if (resourceKey instanceof ChemicalResource(Chemical chemical)) { | ||
return Optional.of(new ChemicalStack(chemical, FluidType.BUCKET_VOLUME)); | ||
} | ||
return Optional.empty(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/refinedmods/refinedstorage/mekanism/recipemod/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@ParametersAreNonnullByDefault | ||
@FieldsAndMethodsAreNonnullByDefault | ||
package com.refinedmods.refinedstorage.mekanism.recipemod; | ||
|
||
import com.refinedmods.refinedstorage.api.core.FieldsAndMethodsAreNonnullByDefault; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; |