Open-Block / OpenBlock

A free open source Block based development template
0 stars 0 forks source link

Combine Attachable #2

Closed mosemister closed 4 years ago

mosemister commented 4 years ago

Currently the following Blocks accept other blocks being attached to them, however each of them have there own interface for adding/setting/removing the attached which is a hassle to check.

There needs to be the following functions assigned to unify the following

List<Block> getAttached();

Which will return a unmodifiable ordered list of the attached

void setAttached(int, Block);

Which will set (override if needed) the block in the position

void removeAttached(int)
void removeAttached(Block)

Which will removed the attached block if possible

boolean canAttach(int, Block)

Which will check if the block is acceptable in the position given

boolean containsAttached(Block)

Simple check to see if a block is already attached

int getMaxAttached()

Which gives the maximum amount of attachments the block can accept

Due to the original Attachable class being that it only accepts a single attachment, you can Deprecate the get, set and contains and then add in functions that show its single nature.