[Suggestion] Interface for BubbleColumnBlock soils
UpcraftLP opened this issue ยท 3 comments
Currently, the bubble column block checks a hardcoded set of blocks for it's soil,
That could be easily made into an interface to decide based on the current block state or block entity.
example:
public interface BubbleColumnProvider {
boolean shouldSustainBubbleColumn(ViewableWorld world, BlockPos pos, BlockState state);
}
Mixin:
@Mixin(BubbleColumnBlock.class)
public class MixinBubbleColumn {
@Inject(method = "canPlaceAt", at = @At("RETURN"), cancellable = true)
private void injectManaPool(BlockState state, ViewableWorld world, BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
BlockPos soilPos = pos.down();
BlockState soilState = world.getBlockState(soilPos);
if(soilState.getBlock() instanceof BubbleColumnProvider) {
cir.setReturnValue(((BubbleColumnProvider) soilState.getBlock()).shouldSustainBubbleColumn(world, soilPos, soilState));
}
}
}
This seems a bit too specific for the main API. Would this help with interoperability in any way ?
For this (and other such scenarios), it wouldn't be a huge stretch (1-2 lines of code) to just offer a tag - this is the approach I'm most partial to; however, tags are to some degree limiting.
For this (and other such scenarios), it wouldn't be a huge stretch (1-2 lines of code) to just offer a tag - this is the approach I'm most partial to; however, tags are to some degree limiting.
well a block tag wouldn't be as dynamic as I need it, plus, since bubble columns require the soil block to actively call BubbleColumnBlock.update()
, I feel like this is not suited for a datapack.