Skip to content

Block Family File

The Ghost in the Machine edited this page Dec 12, 2017 · 1 revision

Each unique block family needs it's own java file to define it's behavior. In this tutorial, we'll be extending the new MultiConnectFamily created by @pollend. You can find the engine with the new version here. The reason we are using this version is it's much cleaner to use and removes a lot of the confusion about block families. Here is the base block family file we'll be using:

ArrowBlockFamily.java

package org.terasology;

import org.terasology.math.Side;
import org.terasology.math.geom.Vector3i;
import org.terasology.world.block.Block;
import org.terasology.world.block.BlockBuilderHelper;
import org.terasology.world.block.family.MultiConnectFamily;
import org.terasology.world.block.loader.BlockFamilyDefinition;

public class ArrowBlockFamily extends MultiConnectFamily {

    public ArrowBlockFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
        super(definition, blockBuilder);
    }

    @Override
    protected boolean connectionCondition(Vector3i blockLocation, Side connectSide) {
        return false;
    }

    @Override
    public byte getConnectionSides() {
        return 0;
    }

    @Override
    public Block getArchetypeBlock() {
        return null;
    }

}

Clone this wiki locally