Skip to content

Commit fd12868

Browse files
committed
fix: remove 9 slots limit from crafting pattern handling in re-packager
1 parent a6182c8 commit fd12868

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

forge/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ plugins {
66
sourceSets.main.resources { srcDir 'src/generated/resources' }
77

88
dependencies {
9-
compileOnly annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0-rc.3")
10-
include implementation("io.github.llamalad7:mixinextras-${forge_flavour}:0.5.0-rc.3")
9+
compileOnly annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0")
10+
include implementation("io.github.llamalad7:mixinextras-${forge_flavour}:0.5.0")
1111

1212
implementation(project(path: ":create_factory_abstractions-${minecraft_version}", configuration: 'namedElements')) { transitive false }
1313
include project(":create_factory_abstractions-${minecraft_version}")
1414

1515
modLocalRuntime "curse.maven:create-vibrant-vaults-1251719:6463890"
1616
// modLocalRuntime "curse.maven:create-enchantment-industry-688768:6549319"
17+
modLocalRuntime "curse.maven:create-extra-gauges-1263228:6916170"
1718
// modLocalRuntime "curse.maven:create-dragon-minus-1216624:6552025"
1819
// modLocalRuntime "net.liukrast:extra_gauges-${minecraft_version}:1.1.1", {
1920
// transitive = false

forge/src/main/java/ru/zznty/create_factory_logistics/logistics/repackager/FactoryRepackagerHelper.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import net.minecraft.util.RandomSource;
1313
import net.minecraft.world.item.ItemStack;
1414
import net.minecraft.world.item.component.CustomData;
15+
import net.neoforged.neoforge.items.ItemHandlerHelper;
1516
import net.neoforged.neoforge.items.ItemStackHandler;
1617
import ru.zznty.create_factory_abstractions.generic.support.GenericOrder;
1718

@@ -153,8 +154,16 @@ protected List<BigItemStack> repackBasedOnRecipes(InventorySummary summary, Pack
153154

154155
ItemStackHandler target = new ItemStackHandler(PackageItem.SLOTS);
155156
List<BigItemStack> stacks = craftingEntry.pattern().stacks();
156-
for (int currentSlot = 0; currentSlot < Math.min(stacks.size(), target.getSlots()); currentSlot++)
157-
target.setStackInSlot(currentSlot, stacks.get(currentSlot).stack.copyWithCount(1));
157+
// for (int currentSlot = 0; currentSlot < Math.min(stacks.size(), target.getSlots()); currentSlot++)
158+
// target.setStackInSlot(currentSlot, stacks.get(currentSlot).stack.copyWithCount(1));
159+
160+
for (BigItemStack stack : stacks) {
161+
ItemStack leftover = ItemHandlerHelper.insertItemStacked(target, stack.stack.copyWithCount(1), false);
162+
if (!leftover.isEmpty()) // more than 9 stacks of items
163+
// i'd like to not fail all recipes in the order, but invalid ones will get voided that way
164+
// so just pretend crafting context is invalid to yield all items back
165+
return List.of();
166+
}
158167

159168
ItemStack box = PackageItem.containing(target);
160169
GenericOrder.set(blockEntity.getLevel().registryAccess(), box, r.nextInt(), 0, true, 0, true,

forge/src/main/resources/mixins.create_factory_logistics.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
"defaultRequire": 1
5353
},
5454
"mixinextras": {
55-
"minVersion": "0.5.0-rc.3"
55+
"minVersion": "0.5.0"
5656
}
5757
}

0 commit comments

Comments
 (0)