Skip to content

Commit

Permalink
Removed BuilderTypes (replaced by helper system)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fureniku committed Jan 11, 2024
1 parent 0f0e296 commit a1a0f98
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.fureniku.metropolis.blocks.decorative.helpers.OffsetHelper;
import com.fureniku.metropolis.datagen.TextureSet;
import com.fureniku.metropolis.enums.BlockConnectionType;
import com.fureniku.metropolis.enums.DecorativeBuilderType;
import com.fureniku.metropolis.utils.SimpleUtils;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
Expand All @@ -24,16 +23,10 @@ public class MetroBlockDecorativeBuilder<T extends MetroBlockDecorativeBase> {
protected String _modelName = null;
protected String _tag = "untagged";
protected TextureSet[] _textures = null;
protected DecorativeBuilderType _type;
protected ArrayList<HelperBase> _helpers = new ArrayList<>();

public MetroBlockDecorativeBuilder(BlockBehaviour.Properties props) {
this(props, DecorativeBuilderType.DECORATIVE);
}

public MetroBlockDecorativeBuilder(BlockBehaviour.Properties props, DecorativeBuilderType type) {
_props = props;
_type = type;
}

public MetroBlockDecorativeBuilder(MetroBlockDecorativeBuilder partial) {
Expand All @@ -43,7 +36,6 @@ public MetroBlockDecorativeBuilder(MetroBlockDecorativeBuilder partial) {
_modelName = partial._modelName;
_tag = partial._tag;
_textures = partial._textures;
_type = partial._type;
_helpers = partial._helpers;
}

Expand Down Expand Up @@ -93,6 +85,11 @@ public MetroBlockDecorativeBuilder setHelpers(HelperBase... helpers) {
return this;
}

public MetroBlockDecorativeBuilder addHelper(HelperBase helper) {
_helpers.add(helper);
return this;
}

public MetroBlockDecorativeBuilder setConnectHorizontalHelper(BlockConnectionType connectionType, VoxelShape[] shapes) {
_helpers.add(new ConnectHorizontalHelper.Builder(connectionType, shapes).build());
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fureniku.metropolis.enums;

import com.fureniku.metropolis.blocks.decorative.MetroBlockDecorative;
import com.fureniku.metropolis.blocks.decorative.MetroBlockDecorativeBase;
import com.fureniku.metropolis.blocks.decorative.helpers.ConnectHorizontalHelper;

/**
Expand Down Expand Up @@ -35,7 +35,7 @@ public enum BlockConnectionType {
CONNECTING,

/**
* Connect to any block that extends {@link MetroBlockDecorative}
* Connect to any block that extends {@link MetroBlockDecorativeBase}
*/
METRO,

Expand Down

This file was deleted.

35 changes: 17 additions & 18 deletions src/main/java/com/fureniku/metropolis/test/RegistrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.fureniku.metropolis.blocks.decorative.helpers.ConnectHorizontalHelper;
import com.fureniku.metropolis.datagen.MetroBlockStateProvider;
import com.fureniku.metropolis.enums.BlockConnectionType;
import com.fureniku.metropolis.enums.DecorativeBuilderType;
import com.fureniku.metropolis.utils.CreativeTabSet;
import com.fureniku.metropolis.utils.ShapeUtils;
import net.minecraft.data.DataGenerator;
Expand Down Expand Up @@ -54,112 +53,112 @@ public void init(IEventBus modEventBus) {
VoxelShape[] shapes = ShapeUtils.combineMultiShapes(shapeA, shapeB);

//TODO re-test partials (not currently working)
MetroBlockDecorativeBuilder partial = new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL).setModelDirectory("blocks/decorative/");
MetroBlockDecorativeBuilder partial = new MetroBlockDecorativeBuilder(_props).setModelDirectory("blocks/decorative/");

blockNames.add(registerBlockSet("test_connecting_enum_same", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setConnectHorizontalHelper(BlockConnectionType.SAME, shapes)
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_sameclass_a", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setConnectHorizontalHelper(BlockConnectionType.SAMECLASS, shapes)
.build())); //Not really a valid test
blockNames.add(registerBlockSet("test_connecting_enum_sameclass_b", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setConnectHorizontalHelper(BlockConnectionType.SAMECLASS, shapes)
.build())); //Not really a valid test
blockNames.add(registerBlockSet("test_connecting_enum_tag_a", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setConnectHorizontalHelper(BlockConnectionType.TAG, shapes)
.setTag("tag_a")
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_tag_b", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setConnectHorizontalHelper(BlockConnectionType.TAG, shapes)
.setTag("tag_b")
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_connecting", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setConnectHorizontalHelper(BlockConnectionType.CONNECTING, shapes)
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_metro", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setConnectHorizontalHelper(BlockConnectionType.METRO, shapes)
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_no_solid_same", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setHelpers(new ConnectHorizontalHelper.Builder(BlockConnectionType.SAME, shapes).setDontConnectSolid().build())
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_no_solid_sameclass_a", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setHelpers(new ConnectHorizontalHelper.Builder(BlockConnectionType.SAMECLASS, shapes).setDontConnectSolid().build())
.build())); //Not really a valid test
blockNames.add(registerBlockSet("test_connecting_enum_no_solid_sameclass_b", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setHelpers(new ConnectHorizontalHelper.Builder(BlockConnectionType.SAMECLASS, shapes).setDontConnectSolid().build())
.build())); //Not really a valid test
blockNames.add(registerBlockSet("test_connecting_enum_no_solid_tag_a", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setHelpers(new ConnectHorizontalHelper.Builder(BlockConnectionType.TAG, shapes).setDontConnectSolid().build())
.setTag("tag_a")
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_no_solid_tag_b", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setHelpers(new ConnectHorizontalHelper.Builder(BlockConnectionType.TAG, shapes).setDontConnectSolid().build())
.setTag("tag_b")
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_no_solid_conecting", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setHelpers(new ConnectHorizontalHelper.Builder(BlockConnectionType.CONNECTING, shapes).setDontConnectSolid().build())
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_no_solid_metro", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
.setHelpers(new ConnectHorizontalHelper.Builder(BlockConnectionType.METRO, shapes).setDontConnectSolid().build())
.build()));
blockNames.add(registerBlockSet("test_connecting_enum_all", () ->
new MetroBlockDecorativeBuilder<MetroEntityBlockDecorative>(_props, DecorativeBuilderType.DECORATIVE_CONNECT_HORIZONTAL)
new MetroBlockDecorativeBuilder<MetroEntityBlockDecorative>(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
Expand All @@ -176,7 +175,7 @@ public void init(IEventBus modEventBus) {
.buildEntity());*/

TEST_BLOCK_ENTITY_DECORATIVE_ENTITY = registerBlockEntityWithBlock("test_block_entity_decorative", () ->
new MetroBlockDecorativeBuilder(_props, DecorativeBuilderType.DECORATIVE)
new MetroBlockDecorativeBuilder(_props)
.setModelDirectory("blocks/decorative/")
.setModelName("barrier_concrete_middle")
.setTextures(TEST_TEXTURE_1)
Expand Down

0 comments on commit a1a0f98

Please sign in to comment.