Hello! I have a fairly complex idea for a custom block that I need a little help with implementing. Any help at all is appreciated!
The idea is I want to create a block called the Juice Presser and overhaul the way sugarcanes turn into sugar. (The Juice Presser will also be used to make apples into apple juice, etc.)
Theoretically, it will work like this:
A player will click on the block with an empty bucket. The model will show that there is a bucket
The player can now fill the Juice Press with a pressable item. In this case: Sugarcane. It will take 4 sugarcane to fill it.
Once the Presser is full. Clicking on the presser will begin to press it. The presser needs to be clicked a total of three times to fully fill the bucket.
Once the bucket is full. Clicking on the presser again will give the player the bucket of sugarcane juice and return the presser to its original state.
Here is a link to the block's current code.
I currently have the model so that it will rotate to face where you place the block.
Currently, I also need to figure out how to make the block function as a two-high block.
For a 2 high block, look at tall grass or sunflower code. You need to add a extra block on top when placing your presser, and remove both when either are destroyed. For right clicking items into the inventory look at my code here:
Inside the tile_entity use setStackInSlot()
You dont need a container unless your planning to use a GUI to render the items inside.
For rendering the item in on the block model use a TileEntitySpecialRenderer TESR:
Inside this, use onBlockActivated() for right clicking actions, and onBlockClicked() for left clicked actions.
Also do you want to render liquids, or the item when put inside the block?
For getting the machine to work, inside the blockClass, determine whether or not the player is holding sugar cane, and act accordingly.
If you need more help just reply to my message