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

consume() called on manipulator with bound introspection module sometimes errors. #32

Open
Wojbie opened this issue Feb 13, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@Wojbie
Copy link

Wojbie commented Feb 13, 2023

I have noticed that in some cases (was not able to determine exact cause for this but i think it might be related to death or teleportation) when user tried to call consume on slot in inventory using bound introspection module in manipulator it errors with this message:
obraz
All other methods work correctly and transfer items around to and from inventory, only consume seems to be broken and it persist on quit/reconnect. Only way to fix this i found was removing and re-placing introspection module onto manipulator.

EDIT: Some additional testing leads me to believe that indeed teleprting might is one of ways to trigger this issue.

EDIT2: I have did some more testing and it regullary triggers when i come back after not playing for some time. Considering that it is in offline chunkloaded chunk my current guess is that its caused by manipulator and bound introspection module getting loaded after server restart without bound player on server.

@Lemmmy Lemmmy added the bug Something isn't working label Feb 20, 2023
@Lemmmy
Copy link
Member

Lemmmy commented Feb 20, 2023

val player = fromContext(context, PlayerEntity::class.java) ?:
throw IllegalArgumentException("No player associated with inventory")

I have a hunch that this needs to subtarget an EntityIdentifier instead, much like getPlayerContext does for getInventory itself:

EntityIdentifier.Player player = fromSubtarget(ctx.context, EntityIdentifier.Player.class);
if (player == null) throw new LuaException("Must be run on a player");

But would need to be able to consistently reproduce it to know for sure if that's the problem

@Wojbie
Copy link
Author

Wojbie commented Feb 20, 2023

But would need to be able to consistently reproduce it to know for sure if that's the problem

I knew i was forgetting something sorry! I could swear i posted reproduction steps.

Reproduction steps on singleplayer:

  1. bind introspection module and place it in manipulator.
  2. place computer next to it in world.
  3. quit world
  4. rejoin world
  5. run
man = peripheral.find("manipulator")
inv = man.getInventory()
inv.consume(1)

obraz

@Wojbie
Copy link
Author

Wojbie commented Jul 1, 2023

Reproduction steps for this issue no longer seem to cause it? It is possible some changes in source code has fixed this issue?

EDIT: No this issue still happened on multiplayer. It does not show up as Java Exception anymore tho.
obraz
obraz

@Lemmmy
Copy link
Member

Lemmmy commented Mar 13, 2024

Re #89, you think that everybody running into #85 was running into this instead?

@Wojbie
Copy link
Author

Wojbie commented Mar 13, 2024

I think those are 2 separate issues? They might be related code wise but one involves item movement and other involves just .consume failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants