Custom chest that works like vanilla chests, merge chests and back to small on destroying (no code involved)

Started by SumoHomuS on

Topic category: Mod showcase and discussion

Last seen on 07:23, 26. Jun 2023
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom chest that works like vanilla chests, merge chests and back to small on destroying (no code involved)
Wed, 05/17/2023 - 19:22 (edited)

Requirements:
- GUI for small chest (27 slots)
- GUI for large chest (54 slots)
- 3d model for small chest
- 3d model for large chest
- 3d model for inner chest (a copy of large chest but X-coord is mirrored, as in the following image) 


Create a block for SmallChest that allow GUI and select model and smallChestGUI for that block, in trigger tab create this procedure onNeighborBlockChanged:


Create another block for InnerChest with no GUI, select the InnerChestModel then go to "bounding boxes" tab and set "Min X coord" to -16. In trigger tab use this procedures:
onClickOnBlock procedure:

OnBlockDestroyed procedure:

 

Then create another block for LargeChest, select the model and the LargeChestGui, then go to "bounding boxes" tab and set "Max X coord" to 32. In trigger tab use this procedure:

OnBlockDestroyed procedure (just copy/paste the InnerChestOnDestroyed file and inside the procedure replace any LargeChest with InnerChest)


For any chestblock go to visual tab and set "block rotation mode" to "Y axis rotation (from player side)",  in properties tab set the hardness to 2.5 and hardness to 12.5, material and sound to wood, the  and select the SmallChest as "custom drop".
For both GUI: open the editor (where you create slots), and click on the bottom where you can see "GUI procedure triggers [click to expand]" and create a procedure for isOpened trigger and one for isClosed trigger where you only use a play block to play open/close chest sound.

 


If it is all right, when you place a SmallChest near to another, LargeChest and InnerChest will be merge to create a 2x1 blocks chest as a vanilla large chest.
__________________________________________________________________________________

I didnt get how to animate the chest (open/close chest animation) and I haven't handled the correct transfer of items from the large to the small chest when the larger one is destroyed yet.

Edited by SumoHomuS on Wed, 05/17/2023 - 19:22
Last seen on 16:03, 8. Aug 2023
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks so much that works…
Sat, 07/29/2023 - 13:04

Thanks so much that works correctly !
To summarise for everyone, when we put another chest next to the same chest, the left chest "innerChest" contains no GUI and as soon as it is clicked, the click is taken to the "largeChest" on the right, which has a GUI with all 56 slots.
What is missing, as mentioned above, is the transfer of items to be destroyed in the other chest. But functional.