Skip to content

Commit

Permalink
revert: removal of unused param from AbstractFamily constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrueckert committed Oct 30, 2023
1 parent 01e8edd commit b841271
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
package org.terasology.engine.world.block.family;

import com.google.common.collect.Sets;
import org.terasology.engine.world.block.BlockBuilderHelper;
import org.terasology.engine.world.block.BlockUri;
import org.terasology.engine.world.block.loader.BlockFamilyDefinition;
import org.terasology.engine.world.block.shapes.BlockShape;

import java.util.Locale;
import java.util.Set;
Expand All @@ -14,7 +16,12 @@ public abstract class AbstractBlockFamily implements BlockFamily {
private BlockUri uri;
private Set<String> categories = Sets.newHashSet();

protected AbstractBlockFamily(BlockFamilyDefinition definition) {
protected AbstractBlockFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
setBlockUri(new BlockUri(definition.getUrn()));
setCategory(definition.getCategories());
}

protected AbstractBlockFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
setBlockUri(new BlockUri(definition.getUrn()));
setCategory(definition.getCategories());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.terasology.engine.world.block.BlockBuilderHelper;
import org.terasology.engine.world.block.BlockUri;
import org.terasology.engine.world.block.loader.BlockFamilyDefinition;
import org.terasology.engine.world.block.shapes.BlockShape;
import org.terasology.gestalt.naming.Name;

import java.util.Locale;
Expand All @@ -27,13 +28,13 @@ public class AttachedToSurfaceFamily extends AbstractBlockFamily {
private Map<Side, Block> blocks = Maps.newEnumMap(Side.class);
private Block archetype;

public AttachedToSurfaceFamily(BlockFamilyDefinition definition) {
super(definition);
public AttachedToSurfaceFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition, shape, blockBuilder);
throw new UnsupportedOperationException("Freeform blocks not supported");
}

public AttachedToSurfaceFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition);
super(definition, blockBuilder);

Map<Side, Block> blockMap = Maps.newEnumMap(Side.class);
if (definition.getData().hasSection("top")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public CeilingSupportingHorizontalFamily(BlockFamilyDefinition definition, Block
}

public CeilingSupportingHorizontalFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition);
super(definition, blockBuilder);

BlockUri uri = new BlockUri(definition.getUrn());
populateBlockMaps(blockBuilder, null, definition, uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class FreeformFamily extends AbstractBlockFamily implements SideDefinedBl
private Block archetypeBlock;

public FreeformFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition);
super(definition, shape, blockBuilder);
BlockUri uri;
if (CUBE_SHAPE_URN.equals(shape.getUrn())) {
uri = new BlockUri(definition.getUrn());
Expand All @@ -54,8 +54,8 @@ public FreeformFamily(BlockFamilyDefinition definition, BlockShape shape, BlockB
setBlockUri(uri);
}

public FreeformFamily(BlockFamilyDefinition blockFamilyDefinition) {
super(blockFamilyDefinition);
public FreeformFamily(BlockFamilyDefinition blockFamilyDefinition, BlockBuilderHelper blockBuilderHelper) {
super(blockFamilyDefinition, blockBuilderHelper);
throw new UnsupportedOperationException("Shape expected");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class HorizontalFamily extends AbstractBlockFamily implements SideDefined
private Map<Side, Block> blocks = Maps.newEnumMap(Side.class);

public HorizontalFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition);
super(definition, shape, blockBuilder);
BlockUri uri;
if (CUBE_SHAPE_URN.equals(shape.getUrn())) {
uri = new BlockUri(definition.getUrn());
Expand All @@ -48,7 +48,7 @@ public HorizontalFamily(BlockFamilyDefinition definition, BlockShape shape, Bloc
}

public HorizontalFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition);
super(definition, blockBuilder);
BlockUri uri = new BlockUri(definition.getUrn());
for (Rotation rot : Rotation.horizontalRotations()) {
Side side = rot.rotate(Side.FRONT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.terasology.engine.world.block.BlockBuilderHelper;
import org.terasology.engine.world.block.BlockUri;
import org.terasology.engine.world.block.loader.BlockFamilyDefinition;
import org.terasology.engine.world.block.shapes.BlockShape;
import org.terasology.gestalt.naming.Name;

import java.util.Locale;
Expand All @@ -38,13 +39,24 @@ public abstract class MultiConnectFamily extends AbstractBlockFamily implements

protected TByteObjectMap<Block> blocks = new TByteObjectHashMap<>();

/**
* Constructor for a block with a specified shape
*
* @param definition Family definition
* @param shape The shape of the block
* @param blockBuilder The builder to make the blocks for the family
*/
public MultiConnectFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition, shape, blockBuilder);
}

/**
* Constructor for a regular block
*
* @param definition Family definition
*/
public MultiConnectFamily(BlockFamilyDefinition definition) {
super(definition);
public MultiConnectFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition, blockBuilder);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SymmetricFamily extends AbstractBlockFamily {
private Block block;

public SymmetricFamily(BlockFamilyDefinition definition, BlockShape shape, BlockBuilderHelper blockBuilder) {
super(definition);
super(definition, shape, blockBuilder);
BlockUri uri;
if (CUBE_SHAPE_URN.equals(shape.getUrn())) {
uri = new BlockUri(definition.getUrn());
Expand All @@ -33,7 +33,7 @@ public SymmetricFamily(BlockFamilyDefinition definition, BlockShape shape, Block
}

public SymmetricFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) {
super(definition);
super(definition, blockBuilder);
block = blockBuilder.constructSimpleBlock(definition, new BlockUri(definition.getUrn()), this);
}

Expand Down

0 comments on commit b841271

Please sign in to comment.