Multiblock mod

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps

Adeon

terasology.ru
Contributor
Architecture
GUI
Logistics
Сan you explain the difference between an SurroundMultiBlockFormItemRecipe, LayeredMultiBlockFormItemRecipe and UniformMultiBlockFormItemRecipe? =(
 

Adeon

terasology.ru
Contributor
Architecture
GUI
Logistics
And why the method getLastMatchingInDirection has infinity loop? o_O
 

Marcin Sciesinski

Code ALL the Ages!
Contributor
World
Architecture
MultiBlockFormItemRecipe interface defines a multi-block detection and forming.

The following implementations are provided, feel free to add new ones:
1. UniformMultiBlockFormItemRecipe - All blocks in the multi-block match the same Predicate uniformly (hence the name).
2. LayeredMultiBlockFormItemRecipe - The definition of the multi-block is defined by horizontal layers. You define predicates for each layer and acceptable layer height separately. As an example - bloomery in CopperAndBronze requires a layer of CopperStructure of 1 height (1 block) and a layer of Bricks block - two blocks high.
3. SurroundMultiBlockFormItemRecipe - Definition of the multi-block defined by an outer layer. You have to provide a Predicate for the outer blocks and for the inner blocks. For example - CharcoalPit requires Cobblestone blocks surrounding Air block(s).

As for the getLastMatchingInDirection - the purpose of the method is to find a last block matching a predicate in a specified direction. It is assumed that this method should always finish, so it is advised that no naturally generated blocks should be matching any Predicates used to define the multi-blocks.
 

Adeon

terasology.ru
Contributor
Architecture
GUI
Logistics
So if I want create multiblock like this:
curve.png (all blocks are different)
Should I create UniformMultiBlockFormItemRecipe? And what I should write in the getLastMatchingInDirection method I little confused o_O
 

Marcin Sciesinski

Code ALL the Ages!
Contributor
World
Architecture
MultiBlock supports only Cuboid shaped multi-block structures, because it uses BlockRegionComponent underneath.

Theoretically you could make any shaped multi-block, just specifying that the remaining blocks would be "air" or any blocks, however entities with BlockRegionComponent have some built-in behaviours. For example, when you destroy such a multi-block, all blocks in the cuboid regions get destroyed.

None of the three implementations I described fit the shape you have laid out, so you'd have to write your own implementation.

As for your last question I don't know what you mean, the MultiBlockFormItemRecipe has two methods you need to implement, and that's it.

If you provide more details on what you are trying to achieve, and most importantly - why do you want this to be a multi-block, I could try to provide you some more insight or guidance.
 
Top