2018-11-23 19:21:52 +01:00
|
|
|
package de.ellpeck.naturesaura.api.multiblock;
|
|
|
|
|
2021-12-04 19:17:21 +01:00
|
|
|
import net.minecraft.core.BlockPos;
|
2022-03-04 15:59:04 +01:00
|
|
|
import net.minecraft.tags.TagKey;
|
2021-12-04 19:17:21 +01:00
|
|
|
import net.minecraft.world.level.Level;
|
|
|
|
import net.minecraft.world.level.block.Block;
|
|
|
|
import net.minecraft.world.level.block.Blocks;
|
|
|
|
import net.minecraft.world.level.block.state.BlockState;
|
2018-11-23 19:21:52 +01:00
|
|
|
|
2021-12-08 00:31:29 +01:00
|
|
|
public record Matcher(BlockState defaultState, ICheck check) {
|
2018-11-23 19:21:52 +01:00
|
|
|
|
|
|
|
public static Matcher wildcard() {
|
2021-12-04 19:17:21 +01:00
|
|
|
return new Matcher(Blocks.AIR.defaultBlockState(), null);
|
2018-11-23 19:21:52 +01:00
|
|
|
}
|
|
|
|
|
2022-03-04 15:59:04 +01:00
|
|
|
public static Matcher tag(Block defaultBlock, TagKey<Block> tag) {
|
|
|
|
return new Matcher(defaultBlock.defaultBlockState(), (level, start, offset, pos, state, c) -> state.is(tag));
|
2018-11-23 19:21:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public interface ICheck {
|
2021-12-04 19:17:21 +01:00
|
|
|
|
2021-12-04 15:40:09 +01:00
|
|
|
boolean matches(Level level, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c);
|
2018-11-23 19:21:52 +01:00
|
|
|
}
|
|
|
|
}
|