<commit_before>package com.infinityraider.infinitylib.block.property;

import com.infinityraider.infinitylib.utility.DirectionalConnectivity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.*;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;

import java.util.Collection;
import java.util.Optional;
import java.util.function.Predicate;

public class InfProperty<T extends Comparable<T>> {
    private final Property<T> property;
    private final T defaultValue;
    private final MirrorHandler<T> mirrorHandler;
    private final RotationHandler<T> rotationHandler;

    private InfProperty(Property<T> property, T defaultValue, MirrorHandler<T> mirrorHandler, RotationHandler<T> rotationHandler) {
        this.property = property;
        this.defaultValue = defaultValue;
        this.mirrorHandler = mirrorHandler;
        this.rotationHandler = rotationHandler;
    }

    public final String getName() {
        return this.getProperty().getName();
    }

    public final T getDefaultValue() {
        return this.defaultValue;
    }

    public final Property<T> getProperty() {
        return this.property;
    }

    public final Collection<T> getAllowedValues() {
        return this.getProperty().getAllowedValues();
    }

    protected StateContainer.Builder<Block, BlockState> apply(StateContainer.Builder<Block, BlockState> builder) {
        builder.add(this.getProperty());
        return builder;
    }

    public final BlockState apply(BlockState state) {
        return this.apply(state, this.getDefaultValue());
    }

    public final BlockState apply(BlockState state, T value) {
        return state.with(this.getProperty(), value);
    }

    public final T fetch(BlockState state) {
        return state.get(this.getProperty());
    }

    public BlockState mirror(BlockState state, Mirror mirror) {
        return this.apply(state, this.mirrorHandler.handle(mirror, this.fetch(state)));
    }

    public BlockState rotate(BlockState state, Rotation rotation) {
        return this.apply(state, this.rotationHandler.handle(rotation, this.fetch(state)));
    }

    public static class Defaults {
        private Defaults() {}

        private static final InfProperty<Boolean> WATERLOGGED = Creators.create(BlockStateProperties.WATERLOGGED, false);
        private static final InfProperty<DirectionalConnectivity> CONNECTIVITY = Creators.create("connectivity", DirectionalConnectivity.NONE);

        public static InfProperty<Boolean> waterlogged() {
            return WATERLOGGED;
        }

        public static InfProperty<DirectionalConnectivity> connectivity() {
            return CONNECTIVITY;
        }
    }

    public static final class Creators {
        private Creators() {}

        public static InfProperty<Boolean> create(String name, boolean defaultValue) {<commit_msg>Add method to mimic properties between block states<commit_after>package com.infinityraider.infinitylib.block.property;

import com.infinityraider.infinitylib.utility.DirectionalConnectivity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.*;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;

import java.util.Collection;
import java.util.Optional;
import java.util.function.Predicate;

public class InfProperty<T extends Comparable<T>> {
    private final Property<T> property;
    private final T defaultValue;
    private final MirrorHandler<T> mirrorHandler;
    private final RotationHandler<T> rotationHandler;

    private InfProperty(Property<T> property, T defaultValue, MirrorHandler<T> mirrorHandler, RotationHandler<T> rotationHandler) {
        this.property = property;
        this.defaultValue = defaultValue;
        this.mirrorHandler = mirrorHandler;
        this.rotationHandler = rotationHandler;
    }

    public final String getName() {
        return this.getProperty().getName();
    }

    public final T getDefaultValue() {
        return this.defaultValue;
    }

    public final Property<T> getProperty() {
        return this.property;
    }

    public final Collection<T> getAllowedValues() {
        return this.getProperty().getAllowedValues();
    }

    protected StateContainer.Builder<Block, BlockState> apply(StateContainer.Builder<Block, BlockState> builder) {
        builder.add(this.getProperty());
        return builder;
    }

    public final BlockState apply(BlockState state) {
        return this.apply(state, this.getDefaultValue());
    }

    public final BlockState apply(BlockState state, T value) {
        return state.with(this.getProperty(), value);
    }

    public final T fetch(BlockState state) {
        return state.get(this.getProperty());
    }

    public final BlockState mimic(BlockState from, BlockState to) {
        return this.apply(to, this.fetch(from));
    }

    public BlockState mirror(BlockState state, Mirror mirror) {
        return this.apply(state, this.mirrorHandler.handle(mirror, this.fetch(state)));
    }

    public BlockState rotate(BlockState state, Rotation rotation) {
        return this.apply(state, this.rotationHandler.handle(rotation, this.fetch(state)));
    }

    public static class Defaults {
        private Defaults() {}

        private static final InfProperty<Boolean> WATERLOGGED = Creators.create(BlockStateProperties.WATERLOGGED, false);
        private static final InfProperty<DirectionalConnectivity> CONNECTIVITY = Creators.create("connectivity", DirectionalConnectivity.NONE);

        public static InfProperty<Boolean> waterlogged() {
            return WATERLOGGED;
        }

        public static InfProperty<DirectionalConnectivity> connectivity() {
            return CONNECTIVITY;
        }
    }

    public static final class Creators {
        private Creators() {}

        public static InfProperty<Boolean> create(String name, boolean defaultValue) {
{'fraction_non_alphanumeric': 0.09115668055110542, 'fraction_numerical': 0.0, 'mean_word_length': 3.662434652725915, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3753516', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1620, 'n_words': 393}