#Preventing Items from Being Placed in Chests and Barrels – Best Methods?

11 messages · Page 1 of 1 (latest)

lime venture
#

Hey everyone, I was wondering if anyone has a good solution for preventing an item from being placed in chests and barrels. I was thinking about using mixins, but I'm open to suggestions if there’s a more efficient method. Any ideas?

tidal sundial
#

check how shulkers do it

lime venture
#

i have check it uses the canBeNested method which would work but only does this check in bundles and shulkerboxes

#

which is good but i would like a global check for every inventory slot

high drift
#

maybe use a mixin to edit the canBeNested method to include the rest?

lime venture
#

Yeah i got it working after some testing. I changed the Slot class i dont really like this method currently because my current code would apply to ALL slots which is a bit overkill.

Changing the canBeNested method would not work I think because the ChestEntityBlock (also does not work for the barrel block) do not implement that method.

I will try to look at other ideas any other suggestions are very welcome. I am still new to modding but i do have allot of programming experience so technical or advanced ideas are also welcome

mystic steeple
#

If this is a server-side mod this is gonna get funky

#

but if this is a client side (or both and the client mod require the server mod)

#

that you can just make inventory moves when opening a chess or barrel menu

#

check canbeNested

lime venture
#

Its both client and server