MovingBlocks

Make an interactive ingot stack block

We have three block shapes that make typical metal ingot style stacks, where the size of the stack indicates the amount of ingots. Think storage of actual items in a stack in the world instead of dumped into a magic chest.

See the block shapes at https://github.com/Terasology/StructuralResources/tree/master/assets/shapes/objects

Your task is to put these block shapes to use by making it possible for the player to place such an ingot stack in the world then place/remove additional ingots and have the stack change to a higher or lower version based on the quantity of ingots present. As a potential extra you could add an inventory to the stack the user can open via e click, to see the exact count of ingots and remove all (or add in a large amount) in one action.

The behavior as expected would be:

  • Left click on a stack block removes an ingot (if it was the last one for a layer drop down to the next lower shape or air)
  • Right click on a stack block adds an ingot (if it was the first one create a stack, if first one in a new layer go one shape up)
  • e click on a stack block opens a regular inventory so you can see how many blocks are in the stack (single inventory slot) - if player removes all the stack should disappear

This will involve intercepting and modifying events and will likely not be easy. Look for similar usages in other modules of custom actions on left and right click (like tools in JoshariasSurvival)

Fork StructuralResources and add code there. Submit PR + screenie

Task tags

  • java
  • interaction
  • custom shaped blocks
  • inventory
  • events

Students who completed this task

Isaac

Task type

  • code Code
  • web Design
close

2016