CC: Tweaked

CC: Tweaked

42M Downloads

Hoppers suck out items from all slots in printer

MrCrackerplays opened this issue ยท 1 comments

commented

Minecraft Version

1.20.1

Version

tested on 1.111.0 & 1.113.0

Details

Hoppers suck out items from all the printer slots rather than just the output slots as I would've expected. To reproduce:

Step 1: place a hopper down
Step 2: place a printer on top of the hopper
Step 3: put dye and/or paper into the printer and see it get sucked into the hopper immediately

I ran into this issue when trying to build u/Bright-Historian-216's printer which uses hoppers to insert and extract from the printer. (which was made in mc 1.18.2 in case that'd help narrow down the issue)

commented

Thanks for the report. This appears to be an issue specific to Forge 1.20.1 (it does not occur on Fabric, and is fixed on later versions of the game). Fixing this bug without duplicating a lot of code is going to be a right pain, so given its relatively limited scope, I'm afraid I'm going to mark this as wontfix.


For those interested in the details:

CC:T's printers are well-behaved from a vanilla perspective โ€” we implement WorldlyContainer (the interface used to mark inventories with side-specific insertion/extraction behaviour), limit which slots are usable for each side.

Forge replaces the vanilla Container/WorldyContainer interfaces with IItemHandler and the whole capability system. To make sure the two interact correctly, we register a sided capability for printers. What I hadn't appreciated is that Forge also registers its own item handler capability for any BE extending BaseContainerBlockEntity (which includes printers). This takes preference over the one we provide.

The trouble is, there's not really a good way to get rid of the Forge-provided implementation, at least in a multiloader project. We can't override getCapability (as Forge isn't on the classpath) and I don't want to use mixins because of various build issues (4675583). So I think the only options are to have a platform-specific printer (lots of extra code) or to stop inheriting from BaseContainerBlockEntity (even more code!).