Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
port to 1.18.x
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Apr 5, 2023
1 parent 1abc677 commit 3b51667
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 55 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CreateFabricRecipeREICompatibility

Fix CreateFabric Recipe display on REI issues. Code from Create's Delight by Phoupraw.

# Code references

- Create's Delight (Fabric 1.19.x) [MIT([`fabric.mod.json`](https://github.com/Phoupraw/CreateSDelightFabricJava/blob/e203b6a14d272013463cdfde49512a9ea13f5769/src/main/resources/fabric.mod.json#L18)), CCO([`LICENSE`](https://github.com/Phoupraw/CreateSDelightFabricJava/blob/master/LICENSE))]
- Phoupraw's Common (Fabric) (Decompiled `REICreates.java`) [MIT(`fabric.mod.json`), CCO(`LICENSE`)]

## License

This mod is available under the MIT license.
11 changes: 4 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ dependencies {
modImplementation("com.simibubi.create:create-fabric-${minecraft_version}:${create_version}") {
exclude(Map.of("module", "forge-config-api-port-fabric-547434"))
}
modImplementation("io.github.fabricators_of_create.Porting-Lib:porting-lib:${port_lib_version}+${minecraft_version}")
modLocalRuntime("maven.modrinth:forge-config-api-port:4.2.11")

modImplementation("maven.modrinth:farmers-delight-fabric:1.3.9")
modCompileOnly("me.shedaniel:RoughlyEnoughItems-fabric:9.1.580")
modLocalRuntime("maven.modrinth:enchlevel-langpatch:2.1.0")
modImplementation fileTree(dir: 'libs', include: ['*.jar'])
modImplementation "io.github.fabricators_of_create:Porting-Lib:${portinglib_version}"
modLocalRuntime "maven.modrinth:forge-config-api-port:${forgeconfigapiport_version}"
modImplementation "me.shedaniel:RoughlyEnoughItems-fabric:${rei_version}"
//modImplementation fileTree(dir: 'libs', include: ['*.jar'])
}

base {
Expand Down
13 changes: 8 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.18
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4
loader_version=0.14.17

# Mod Properties
Expand All @@ -14,7 +14,10 @@ org.gradle.parallel=true
archives_base_name=CreateFabricRecipeREICompatibility

# Dependencies
fabric_version=0.67.0+1.19.2
fabric_version=0.76.0+1.18.2

create_version=0.5.0.i-961+1.19.2
port_lib_version=2.1.811
rei_version=8.3.594
farmersdelight_version=1.2.5
forgeconfigapiport_version=3.2.4
create_version=0.5.0.i-983+1.18.2
portinglib_version=1.2.869-beta+1.18.2
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public class CreateFabricRecipeREICompatibilityMod implements ModInitializer {

@Override
public void onInitialize() {

LOGGER.info(MODNAME + " (" + MODID + ") " + " is loaded!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ public static EntryIngredient ingredientOf(@NotNull FluidIngredient fluidIngredi
}

@Contract(pure = true)
public static @NotNull List<EntryIngredient> ingredientsOf(@NotNull ProcessingRecipe<?> recipe) {
@NotNull
public static List<EntryIngredient> ingredientsOf(@NotNull ProcessingRecipe<?> recipe) {
return ingredientsOf(recipe.getIngredients(), recipe.getFluidIngredients());
}

@Contract(pure = true)
public static @NotNull List<EntryIngredient> ingredientsOf(@NotNull SequencedRecipe<?> recipe0) {
@NotNull
public static List<EntryIngredient> ingredientsOf(@NotNull SequencedRecipe<?> recipe0) {
ProcessingRecipe<?> recipe = recipe0.getRecipe();
DefaultedList<Ingredient> ingredients = DefaultedList.of();
ingredients.addAll(recipe.getIngredients());
Expand All @@ -72,74 +74,59 @@ public static EntryIngredient ingredientOf(@NotNull FluidIngredient fluidIngredi
}

@Contract(pure = true)
public static @NotNull List<EntryIngredient> ingredientsOf(@NotNull DefaultedList<Ingredient> ingredients, @NotNull DefaultedList<FluidIngredient> fluidIngredients) {
List<EntryIngredient> list = new LinkedList();
Iterator var3 = ItemHelper.condenseIngredients(ingredients).iterator();

while(var3.hasNext()) {
Pair<Ingredient, MutableInt> condensed = (Pair)var3.next();
Collection<ItemConvertible> items = new LinkedList();
ItemStack[] var6 = ((Ingredient)condensed.getFirst()).getMatchingStacks();
int var7 = var6.length;

for(int var8 = 0; var8 < var7; ++var8) {
ItemStack matchingStack = var6[var8];
@NotNull
public static List<EntryIngredient> ingredientsOf(@NotNull DefaultedList<Ingredient> ingredients, @NotNull DefaultedList<FluidIngredient> fluidIngredients) {
List<EntryIngredient> list = new LinkedList<>();
for (Pair<Ingredient, MutableInt> condensed : ItemHelper.condenseIngredients(ingredients)) {
Collection<ItemConvertible> items = new LinkedList<>();
for (ItemStack matchingStack : (condensed.getFirst()).getMatchingStacks()) {
items.add(matchingStack.getItem());
}

list.add(EntryIngredients.ofItems(items, ((MutableInt)condensed.getSecond()).getValue()));
list.add(EntryIngredients.ofItems(items, (condensed.getSecond()).getValue()));
}

var3 = fluidIngredients.iterator();

while(var3.hasNext()) {
FluidIngredient fluidIngredient = (FluidIngredient)var3.next();
list.add(ingredientOf(fluidIngredient));
Iterator<FluidIngredient> it = fluidIngredients.iterator();
while (it.hasNext()) {
list.add(ingredientOf(it.next()));
}

return list;
}

@Contract(pure = true)
public static @NotNull List<EntryIngredient> resultsOf(@NotNull ProcessingRecipe<?> recipe) {
@NotNull
public static List<EntryIngredient> resultsOf(@NotNull ProcessingRecipe<?> recipe) {
return resultsOf(recipe.getRollableResults(), recipe.getFluidResults());
}

@Contract(pure = true)
public static @NotNull List<EntryIngredient> resultsOf(@NotNull SequencedRecipe<?> recipe0) {
@NotNull
public static List<EntryIngredient> resultsOf(@NotNull SequencedRecipe<?> recipe0) {
ProcessingRecipe<?> recipe = recipe0.getRecipe();
LinkedList<ProcessingOutput> rollableResults = new LinkedList(recipe.getRollableResults());
LinkedList<ProcessingOutput> rollableResults = new LinkedList<>(recipe.getRollableResults());
rollableResults.remove(0);
return resultsOf(rollableResults, recipe.getFluidResults());
}

@Contract(pure = true)
public static @NotNull List<EntryIngredient> resultsOf(@NotNull List<ProcessingOutput> rollableResults, @NotNull DefaultedList<FluidStack> fluidResults) {
List<EntryIngredient> list = new LinkedList();
Iterator var3 = rollableResults.iterator();

while(var3.hasNext()) {
ProcessingOutput rollableResult = (ProcessingOutput)var3.next();
@NotNull
public static List<EntryIngredient> resultsOf(@NotNull List<ProcessingOutput> rollableResults, @NotNull DefaultedList<FluidStack> fluidResults) {
List<EntryIngredient> list = new LinkedList<>();
for (ProcessingOutput rollableResult : rollableResults) {
list.add(EntryIngredients.of(rollableResult.getStack().copy()));
}

var3 = fluidResults.iterator();

while(var3.hasNext()) {
FluidStack fluidResult = (FluidStack)var3.next();
Iterator<FluidStack> it = fluidResults.iterator();
while (it.hasNext()) {
FluidStack fluidResult = it.next();
list.add(EntryIngredients.of(dev.architectury.fluid.FluidStack.create(fluidResult.getFluid(), fluidResult.getAmount(), fluidResult.getTag())));
}

return list;
}

public static Slot slotOf(Point pos, Collection<EntryStack<?>> entries) {
Slot slot = Widgets.createSlot(pos).entries(entries);
if (((EntryStack)entries.iterator().next()).getValue() instanceof dev.architectury.fluid.FluidStack) {
if (entries.iterator().next().getValue() instanceof dev.architectury.fluid.FluidStack) {
CreateRecipeCategory.setFluidRenderRatio(slot);
CreateRecipeCategory.setFluidTooltip(slot);
}

return slot;
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
"depends": {
"fabricloader": ">=0.14.x",
"fabric-api": "*",
"minecraft": "1.19.x",
"minecraft": "1.18.x",
"java": ">=17",
"rei": "*",
"create": "*"
},
"breaks": {
"phouprawscommon": "*"
"phouprawscommon": "*",
"createsdelight": "*"
}
}

0 comments on commit 3b51667

Please sign in to comment.