Skip to content

Commit

Permalink
feat: add block tags to explicitly allow/disallow attachment of flesh…
Browse files Browse the repository at this point in the history
… veins to specific blocks
  • Loading branch information
Elenterius committed Nov 13, 2023
1 parent c87b9c7 commit 77c1fee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ protected void addTags() {
Blocks.ROOTED_DIRT, Blocks.MUDDY_MANGROVE_ROOTS, Blocks.MUD
);

tag(ModBlockTags.ALLOW_VEINS_TO_ATTACH)
.add(Blocks.DIRT_PATH, Blocks.FARMLAND);

tag(ModBlockTags.DISALLOW_VEINS_TO_ATTACH)
.add(ModBlocks.MALIGNANT_BLOOM.get());

tag(BlockTags.DOORS).add(ModBlocks.FLESH_DOOR.get()).add(ModBlocks.FULL_FLESH_DOOR.get());
tag(BlockTags.TRAPDOORS).add(ModBlocks.FLESH_IRIS_DOOR.get());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ protected static BlockState removeFace(BlockState state, BooleanProperty face) {
}

public static boolean canVeinsAttachTo(BlockGetter level, Direction direction, BlockPos pos, BlockState state) {
return state.is(ModBlockTags.PRIMORDIAL_ECO_SYSTEM_REPLACEABLE) || Block.isFaceFull(state.getBlockSupportShape(level, pos), direction.getOpposite()) || Block.isFaceFull(state.getCollisionShape(level, pos), direction.getOpposite());
if (state.is(ModBlockTags.DISALLOW_VEINS_TO_ATTACH)) return false;
if (state.is(ModBlockTags.ALLOW_VEINS_TO_ATTACH)) return true;
return Block.isFaceFull(state.getBlockSupportShape(level, pos), direction.getOpposite()) || Block.isFaceFull(state.getCollisionShape(level, pos), direction.getOpposite());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public final class ModBlockTags {
//CONVERTABLE_TO_PRIMAL_FLESH
//CONVERTABLE_TO_MALIGNANT_FLESH
public static final TagKey<Block> PRIMORDIAL_ECO_SYSTEM_REPLACEABLE = tag("primordial_ecosystem_replaceable");
public static final TagKey<Block> ALLOW_VEINS_TO_ATTACH = tag("allow_veins_to_attach");
public static final TagKey<Block> DISALLOW_VEINS_TO_ATTACH = tag("disallow_veins_to_attach");

private ModBlockTags() {}

Expand Down

0 comments on commit 77c1fee

Please sign in to comment.