package space.eptaproject.vmodextras; import lombok.ToString; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.registries.ForgeRegistries; import org.slf4j.LoggerFactory; import org.slf4j.Logger; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import space.eptaproject.vmodextras.util.ResourceLocationUtil; @ToString public class Validator implements IValidator { public static final Logger LOGGER = LoggerFactory.getLogger("Validator"); public static ResourceLocation RB = ResourceLocationUtil.fromNamespaceAndPath(VmodExtras.MODID, "example_block"); public Validator() { } @Override public void valid(Block block, ResourceLocation location, CallbackInfoReturnable info) { if (Config.parsedList.contains(location) && Config.Schematic_Blocked_Blocks_Enable) { Block replacement = ForgeRegistries.BLOCKS.getValue(Config.replace); if (replacement != null) { info.setReturnValue(replacement.defaultBlockState()); info.cancel(); } } } }