added continuity to optional modrinth dependencies + made blocks addition possible by placing correct shape on existing frame

This commit is contained in:
2024-03-27 23:14:24 +01:00
parent 319d247e4c
commit 3afee9e501
18 changed files with 522 additions and 98 deletions

View File

@@ -7,6 +7,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.property.Property;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
@@ -49,6 +50,29 @@ public abstract class ReFramedDoubleBlock extends ReFramedBlock {
return 0;
}
@SafeVarargs
public final <T extends Comparable<T>> boolean matchesAnyOutline(Vec3d hit, BlockPos pos, Property<T> property, T... values) {
for (T value : values)
if (matchesOutline(hit, pos, property, value)) return true;
return false;
}
public <T extends Comparable<T>> boolean matchesOutline(Vec3d hit, BlockPos pos, Property<T> property, T value) {
Vec3d rel = BlockHelper.getRelativePos(hit, pos);
return BlockHelper.cursorMatchesFace(
getOutlineShape(getDefaultState().with(property, value), null, null, null),
rel
);
}
public <T extends Comparable<T>> boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) {
Vec3d rel = BlockHelper.getRelativePos(hit, pos);
return BlockHelper.cursorMatchesFace(
getShape(state, i),
rel
);
}
@Override
public boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {
return world.getBlockEntity(pos) instanceof ThemeableBlockEntity framed_entity