mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-21 19:43:28 +01:00
account for storage drawers' item handler behavior for over-sending prevention
Should close #131
This commit is contained in:
parent
78012cf019
commit
239aa499c4
2 changed files with 12 additions and 0 deletions
|
@ -111,6 +111,9 @@ dependencies {
|
|||
compileOnly fg.deobf("mezz.jei:jei-1.19.2-common-api:11.3.0.260")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.19.2-forge:11.3.0.260")
|
||||
|
||||
// test storage drawers
|
||||
runtimeOnly fg.deobf("curse.maven:storage-drawers-223852:3884263")
|
||||
|
||||
// to test the rf requiring and crafting stuff
|
||||
/* runtimeOnly fg.deobf("curse.maven:powah-352656:3057732")
|
||||
runtimeOnly fg.deobf("curse.maven:lollipop-347954:3057731")
|
||||
|
|
|
@ -236,12 +236,21 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC
|
|||
// have space for items of other types, but it'll be good enough for us
|
||||
var left = handler.insertItem(i, copy, true);
|
||||
totalSpace += maxStackSize - left.getCount();
|
||||
|
||||
}
|
||||
// if the items on the way plus the items we're trying to move are too much, reduce
|
||||
if (onTheWay + toInsert.getCount() > totalSpace)
|
||||
toInsert.setCount(totalSpace - onTheWay);
|
||||
}
|
||||
}
|
||||
|
||||
// the 0th slot of a storage drawer is a "catch-all" for any items that can be inserted into the drawer, and all
|
||||
// subsequent slots are the actual slots for the items. this causes a problem because the drawer will seem to have
|
||||
// space for twice the amount of items that it actually does.
|
||||
// see https://github.com/Ellpeck/PrettyPipes/issues/131#issuecomment-1288653623 and Discord convo with Quinteger
|
||||
if (handler.getClass().getName().equals("com.jaquadro.minecraft.storagedrawers.capabilities.DrawerItemHandler"))
|
||||
toInsert.setCount(toInsert.getCount() / 2);
|
||||
|
||||
// we return the item that can actually be inserted, NOT the remainder!
|
||||
if (!toInsert.isEmpty())
|
||||
return Pair.of(offset, toInsert);
|
||||
|
|
Loading…
Reference in a new issue