Cannot get computer by id on fabric #1908
carson-coder
started this conversation in
General
Replies: 3 comments 2 replies
-
I am on fabric 1.20.6 and computer craft 1.111.0 |
Beta Was this translation helpful? Give feedback.
0 replies
-
You should use ServerContext.get(<MinecraftServer instance>).registry().getComputers().stream().filter((computer) -> computer.getID() == numId).getFirst().orElse(null); |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think think this is a bit of an XY problem here. Mods should almost never be using |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to get a computer by a id in my own mod with this code
but vscode and gradle say that I cannot run get with a int even though https://github.com/cc-tweaked/CC-Tweaked/blob/mc-1.20.x/projects/common/src/main/java/dan200/computercraft/shared/computer/core/ServerComputerRegistry.java#L13 has that function. When decompiling the class in vscode the get(int) doesn't exist.
Full Error:
Beta Was this translation helpful? Give feedback.
All reactions