Advanced Peripherals

Advanced Peripherals

29M Downloads

meBridge function exportItemToPeripheral() ignoring count

AshuraKurai opened this issue · 7 comments

commented

Describe

Please note: I am using version 0.7.24b, the bug report page shows 0.7.23b as the latest.

While testing ME Bridge functions to build a script for automation between MineColonies and AE2, I could not get exportItemToPeripheral to honour the count value provided, as such it would always export a full stack.

Mods Installed:
Advanced Peripherals - AdvancedPeripherals-0.7.24b.jar
Applied Energistics 2 - appliedenergistics2-forge-12.9.2.jar
BlockUI - blockui-1.19-0.0.64-ALPHA.jar
CC: Tweaked - cc-tweaked-1.19.2-1.101.2.jar
Domum Ornamentum - domum_ornamentum-1.19-1.0.76-ALPHA-universal.jar
Just Enough Items (JEI) - jei-1.19.2-forge-11.6.0.1013.jar
MineColonies - minecolonies-1.19.2-1.0.1283-ALPHA.jar
MineColonies for ComputerCraft - Colony4ComputerCraft-1.19.2-2.3.2.jar
Multi-Piston - multipiston-1.19.2-1.2.21-ALPHA.jar
Structurize - structurize-1.19.2-1.0.483-ALPHA.jar

Steps to reproduce

  1. Setup ME system with some dirt in a drive, attach ME bridge to ME system. Refer to provided image of example setup.
  2. Setup CC with a modem block connected to ME bridge and a chest. Refer to provided image of example setup.
  3. Run the following commands in Lua:
    me = peripheral.wrap("meBridge_0")
    me.exportItemToPeripheral({name="minecraft:dirt",count=5}, "minecraft:chest_0")
  4. Observe the output (also attached):
    64
    nil
  5. Check the chest, it should now have 64 dirt instead of the expected 5

I also tested importItemFromPeripheral(), and it worked as expected. Following the above steps moved 5 dirt from the chest to the ME system, so the issue appears to be with exportItemToPeripheral() only.

Example Setup
2023-03-13_14 41 08

Command Output
2023-03-13_14 46 55

Multiplayer?

Yes

Version

1.19.2-0.7.23b (Latest 1.19)

Minecraft, Forge and maybe other related mods versions

Forge - 43.2.6 Advanced Peripherals - AdvancedPeripherals-0.7.24b.jar Applied Energistics 2 - appliedenergistics2-forge-12.9.2.jar BlockUI - blockui-1.19-0.0.64-ALPHA.jar CC: Tweaked - cc-tweaked-1.19.2-1.101.2.jar Domum Ornamentum - domum_ornamentum-1.19-1.0.76-ALPHA-universal.jar Just Enough Items (JEI) - jei-1.19.2-forge-11.6.0.1013.jar MineColonies - minecolonies-1.19.2-1.0.1283-ALPHA.jar MineColonies for ComputerCraft - Colony4ComputerCraft-1.19.2-2.3.2.jar Multi-Piston - multipiston-1.19.2-1.2.21-ALPHA.jar Structurize - structurize-1.19.2-1.0.483-ALPHA.jar

Screenshots or Videos

No response

Crashlog/log

No response

commented

Do you have the same issue with importing?

commented

Dude, you're fast! Thank you for the reply.

No, import works as expected, I mentioned it in my notes above:

"I also tested importItemFromPeripheral(), and it worked as expected. Following the above steps moved 5 dirt from the chest to the ME system, so the issue appears to be with exportItemToPeripheral() only."

commented

Oh sorry, I did not saw that

commented

No worries!

I did some further testing, this time with Refined Storage (refinedstorage-1.11.5.jar) instead of AE2, and it seems Refined Storage's exportItemToPeripheral is also ignoring the count value (import is fine for RS as well). Using the following commands I got the output in the screenshot:

Commands
rs = peripheral.wrap("rsBridge_0")
rs.exportItemToPeripheral({name="minecraft:stone",count=5},"minecraft:chest_0")
rs.importItemFromPeripheral({name="minecraft:stone",count=5},"minecraft:chest_0")

Output
2023-03-13_21 24 44

I tried to look through the source code (I'm not a programmer, but I did technically take a course in Java back in 2006, haha), I got stuck in MeBridgePeripheral.java at "protected MethodResult exportToChest". If I'm right, whenever this function is called and there is a "right" value in the arguments it runs:

if(filter.rightPresent())
return MethodResult.of(0, filter.getRight());

Otherwise it runs:

return MethodResult.of(InventoryUtil.moveFluid(fluidHandler, targetTank, filter.getLeft()), null);

I can't figure out what "MethodResult.of(0, filter.getRight());" does, but it seems to work fine for importToMe. And since I can't figure out what it means, I guess that's where I hit a brickwall here. I don't know if this information will be useful or is just distracting (in which case, I apologize), but I figured I'd provide what I can in hope that it helps.

Regardless, I greatly appreciate any time you spend looking into this. If you do happen to reproduce the issue, hopefully it won't be too difficult to resolve.

commented

I fixed the issue - there was also an issue with the fluid exporting

AdvancedPeripherals-0.7.24b.zip

You can test it if you want
Unzip the file before using it

commented

Absolutely incredible! Thank you so much!

I just tested it and it works amazing.

commented

Glad that it works and you like it ❤️