solution for problems

Started by SupremeHunter2022 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
solution for problems

hi. i'm trying to make a custom single and double chest on my mod. i'm currently use mcreator 2023.4 to do my mod. can someone help me please???

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(Friendly advice- try to…
Wed, 01/17/2024 - 13:31

(Friendly advice- try to name your posts something related to the topic, otherwise it's harder to get help!)

The single chest is sort of straightforward: you want to create a block, probably with a custom model since chests aren't a full 1*1*1 block, then give it an inventory of 27 slots, each with 64 item capacity. (By enabling 'block entity' in the item's properties tab.) You then need a procedure which, when right clicked, opens a custom GUI with 27 input slots. (Each of which will be automatically linked to the blocks 27 storage slots.) This will be mildly annoying to make, (MCreator's GUI creation interface isn't the greatest), but shouldn't take too long. A player can then right click on your block, opening the inventory, and exchange items between their inventory and the chest's.

  • Make sure to have your custom GUI be of the 'inventory' type, so it displays the player's inventory as well.
  • You'll also want to add a title to the GUI that uses the display name of the block as its text provided. (You could also just write 'chest' like vanilla chests; but vanilla chests and shulkerboxes can be renamed, which changes the name of the inventory title. You might need to create an extra NBT tag for this though, probably not worth the effort.)
  • The animation is a bit tricker- you could make two seperate blocks with different textures, one for the opened state and one for closed, (like a barrel), and swap the blocks out while preserving their NBT/inventory whenever the GUI is opened, or, (if you really want it to be vanillaish), use Geckolib to make an opening animation for the block that triggers when the player interacts with it.
  • And make sure to keep in mind the other properties of chests. (You don't want them to be pushable, you probably don't want them to be flammable, they need to have a slightly smaller hitbox than regular blocks, etc.)

The double chest is substantially harder, though not impossible. You need two separate blocks, (one for the left side, one for the right.) One of the blocks needs to have zero slots, the other needs to have 54. Make the GUI behave like usual, except whenever the player clicks on the side of the chest with no slots, cancel the trigger and simulate a right click on the other block. (Or find another means of opening the GUI for the block that actually has the inventory.) You'll also need a procedure that reverts the block to the single version of your chest and either transfers half of the filled side's inventory to the new single chest, (if the filled side is broken), or ejects half of the double chest's inventory into the broken block, (if the unfilled side is broken.) 

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
like its too complicate for…
Wed, 01/17/2024 - 14:51

like its too complicate for me... i'm at the beggining of this type of block...even if it's been 3 yeras that i try to make workspace i still don't understand how procedure work. maybe i just need to follow some tutorial... thanks for your information.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
NorthWestTrees probably has…
Wed, 01/17/2024 - 14:54

NorthWestTrees probably has a better explanation than mine, worth checking out on Youtube. Anyways, good luck.