mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-06-27 12:51:42 +02:00
25 lines
826 B
Java
25 lines
826 B
Java
package de.ellpeck.naturesaura.api.multiblock;
|
|
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.tags.TagKey;
|
|
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;
|
|
|
|
public record Matcher(BlockState defaultState, ICheck check) {
|
|
|
|
public static Matcher any() {
|
|
return new Matcher(Blocks.AIR.defaultBlockState(), null);
|
|
}
|
|
|
|
public static Matcher tag(Block defaultBlock, TagKey<Block> tag) {
|
|
return new Matcher(defaultBlock.defaultBlockState(), (level, start, offset, pos, state, c) -> state.is(tag));
|
|
}
|
|
|
|
public interface ICheck {
|
|
|
|
boolean matches(Level level, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c);
|
|
}
|
|
}
|