Posted August 2, 20205 yr Hey, I want to make it so players can't take items out of a chest. How can I do this?
August 2, 20205 yr Author 1 hour ago, diesieben07 said: Subscribe to PlayerContainerEvent.Open. Check for ChestContainer. If you detect it, replace it's Slots with a custom Slot implementation where canTakeStack returns false. That's the server side done. For the client subscribe to GuiOpenEvent, check for ChestScreen and do the same with the contained ChestContainer. Note: Chests are special in that they are not tied to their tile entity very strongly in the container implementation. Servers that allow vanilla clients to connect will often use the "chest container" (which in the code is actually called "generic_9x6", there exists "generic_9x1" through "generic_9x6") for arbitrary inventories. There is no way to detect the difference. okay, thank you
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.