Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CC: Tweaked 1.12.2-1.89.2 & Logistics 1.12.2-0.10.4.18 - makeRequest #1676

Open
JordanTemrite opened this issue Oct 22, 2022 · 3 comments
Open
Labels
Bug Mod Interaction Another mod is involved Needs Validation For developers to reproduce the issue and check back with the issuer if necessary

Comments

@JordanTemrite
Copy link

JordanTemrite commented Oct 22, 2022

Hey there!

I've seen a few duplicate posts about the API and getItem / makeRequest. The API works just fine for me but I am unable to get it to actually process makeRequest.

Heres my code -------------->

local pipe = peripheral.wrap('LogisticsPipes:Request_0')
local item_dat = pipe.getAvailableItems()

local function getItem()
local r = pipe.getLP().getItemIdentifierBuilder()
r.setItemID( item_dat[1].getValue1().getIdName() || tostring(..) || textutils.serialise(..))
r.setItemData( item_dat[1].getValue1().getData())
req = r.build()
pipe.makeRequest( req, 1)
end


When running with item_dat[1].getValue1().getIdName() || tostring(..) I get these errors -------------->

Java Exception Thrown:
java.lang.UnsupportedOperationException: No such method.makeRequest(logisticspipes.utils.item.ItemIdentifier, java.lang.Double, java.lang.Boolean)
makeRequest(logisticspipes.utils.item.ItemIdentifierStack)
makeRequest(logisticspipes.utils.item.ItemIdentifierStack, java.lang.Boolean)
makeRequest(logisticspipes.utils.item.ItemIdentifier, java.lang.Double)


If I run it with textutils.serialise(..) I get this -------------->

Java Exception Thrown: java.lang.RuntimeException:
Java.lang.UnsupportedOperationException: Not a valid ItemIdentifier. I've also tried using the integer item ID's as well as raw item names etc.

Any help would be greatly appreciated!!

@bziemons bziemons added Bug Needs Validation For developers to reproduce the issue and check back with the issuer if necessary Mod Interaction Another mod is involved labels Nov 8, 2022
@tranquillity-codes
Copy link

tranquillity-codes commented Dec 19, 2022

I can replicate this bug as well, and have made a private fork of the mod, where I tracked down the bug & added a workaround. The issue comes from PipeItemsRequestLogistics#makeRequest expecting an ItemIdentifier, however instead receiving a Map<String, Object>. I have been unable to find a way to pass in an ItemIdentifier; using getItemIdentifierBuilder (as result of build() in Lua code) results in an empty Map.
I might've missed something in the codebase, it is quite complex.
So far the workaround replaces the API such that peripheral.wrap(side).makeRequest({item="minecraft:wool",damage=12},4) or peripheral.wrap(side).makeRequest({item="minecraft:grass"},32).
It is only a workaround, however, as I have not been able to figure out how an ItemIdentifier could make it into the method call at all, or find definitive proof it cannot.
I will publish the hack I wrote after cleaning it up a bit on my fork over at tranquillity-codes/LogisticsPipes
If any more action would be necessary, do tell me. I have done this as I hit this issue in my personal modpack & decided to fix it.

@KorewaLidesu
Copy link
Contributor

using getItemIdentifierBuilder (as result of build() in Lua code) results in an empty Map.
image

logisticspipes.proxy.computers.objects.CCItemIdentifierBuilder
image

could you send me sample world?

@tranquillity-codes
Copy link

I think that passing around the ItemIdentifier is not working. Any world with latest CC:Tweaked and LP on 1.12.2, attach to a request pipe, try to use makeRequest. I admit I am not well versed in the CC API enough to know how to pass arbitrary objects around in the Lua code, and the way used by LP does not seem to work rn, as seen in this bug. I personally don't understand the need to pass around a custom object rather than just reading from a table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Mod Interaction Another mod is involved Needs Validation For developers to reproduce the issue and check back with the issuer if necessary
Projects
None yet
Development

No branches or pull requests

4 participants